OJS 3.0.2-0 to OJS 3.1.1-2 upgrade issues

Description of issue or problem I’m having:
When I run the upgrade code with cli nothing happens.

Steps I took leading up to the issue:
I’m taking yet another stab at trying to upgrade our OJS instance. Last time I was told that I needed to upgrade in increments. I exported our 3.0.2-0 database and made a copy of our files_dir. I set up a new server specifically for this upgrade, as the old server has other sites that still require the older php that the upgrade cannot run on. I got a fresh copy of the 3.1.1-2 OJS and updated the config file to our database specifications and new server specifications.

When I ran the cli code, php tools/upgrade.php upgrade, nothing happened. In a fraction of a second the command line was ready for more input and nothing was output. Thinking that was strange, I checked the config file and installed was still set to off. I checked the database versions table (where product LIKE "%ojs%"). The current version was still 3.0.2-0 and nothing was new.

What I tried to resolve the issue:
I then tried using a different version of php. The previous version for the upgrade was 5.6. When I ran it as php 7.1 I got a fatal error due to 7.1 not recognizing mysql_connect.

Application Version - e.g., OJS 3.1.2:
OJS 3.0.2-0 to OJS 3.1.1-2

Additional information, such as screenshots and error log messages if applicable:

I’ve been putting debug messages along the code path and I think I see where it’s dying.

At the beginning of lib/pkp/classes/cliTool/UpgradeTool.inc.php's __construct function I added a debug message and that is appearing correctly. The one I added after parent::__construct($argv) is not showing up. Since UpgradeTool extendes CommandLineTool I added a debug message to the construction function of that, but it doesn’t seem to reach it.

Tried using the web interface to upgrade it, but once I click on the “Upgrade Open Journal Systems” button I get a 500.

Is the database table type MyISAM or InnoDB?

If it’s myisam I suggest you convert it to innodb.

image

I’ve converted the database to InnoDB but I’m still getting the same results. I tried just calling php tools/upgrade.php expecting to see the message in the code telling me I needed to choose one of the valid options, but it’s not getting that far before stopping.

Got a little further. lib/pkp/classes/cliTool/CliTool.inc.php lets me get through the __construct of CommandLineToolup until the line PluginRegistry::loadCategory('generic'); At which point it dies silently.

I am using php 5.6 for the upgrade.

Change your php version to 7.1, then try updating?

As mentioned in the original post, that causes an error.

PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/sites/epubs.test.lib.utah.edu/lib/pkp/lib/adodb/drivers/adodb-mysql.inc.php:456

5.6 appears to die in the same place, at least as far as I’ve gotten with the debugging, but it dies silently.

It seems to be dying in the register function of PluginRegistry.inc.php. I made simple debug messages, here is the updated code:

        static function register($category, &$plugin, $path, $mainContextId = null) {
echo "Registering\n";
                $pluginName = $plugin->getName();
echo "The plugin is $pluginName\n";
                $plugins =& PluginRegistry::getPlugins();
echo "rega\n";
                if (!$plugins) $plugins = array();
echo "regb\n";
                // If the plugin was already loaded, do not load it again.
                if (isset($plugins[$category][$pluginName])) return false;
echo "regc\n";
                // Allow the plugin to register.
                if (!$plugin->register($category, $path, $mainContextId)){
echo "returning false";
 return false;
}
echo "regd\n";
                if (isset($plugins[$category])) $plugins[$category][$pluginName] =& $plugin;
                else $plugins[$category] = array($pluginName => &$plugin);
echo "rege\n";
                Registry::set('plugins', $plugins);
echo "regf\n";
                return true;
        }

Here is what I get back when running the upgrade.

        plugins/generic/dublinCoreMeta //From an earlier debug message

The plugin is dublincoremetaplugin
rega
regb
regc
registering
12345

The registering and 12345 come from the following code in lib/pkp/classes/plugins/Plugin.inc.php

        function register($category, $path, $mainContextId = null) {
echo "registering\n";
                $this->pluginPath = $path;
                $this->pluginCategory = $category;
                if ($this->getInstallSchemaFile()) {
                        HookRegistry::register ('Installer::postInstall', array($this, 'updateSchema'));
                }
echo 1;
                if ($this->getInstallSitePluginSettingsFile()) {
                        HookRegistry::register ('Installer::postInstall', array($this, 'installSiteSettings'));
                }
                if ($this->getInstallControlledVocabFiles()) {
                        HookRegistry::register ('Installer::postInstall', array($this, 'installControlledVocabs'));
                }
                if ($this->getInstallEmailTemplatesFile()) {
                        HookRegistry::register ('Installer::postInstall', array($this, 'installEmailTemplates'));
                }
echo 2;
                if ($this->getInstallEmailTemplateDataFile()) {
                        HookRegistry::register ('Installer::postInstall', array($this, 'installEmailTemplateData'));
                        HookRegistry::register ('PKPLocale::installLocale', array($this, 'installLocale'));
                }
                if ($this->getInstallDataFile()) {
                        HookRegistry::register ('Installer::postInstall', array($this, 'installData'));
                }
echo 3;         if ($this->getContextSpecificPluginSettingsFile()) {
                        HookRegistry::register ($this->_getContextSpecificInstallationHook(), array($this, 'installContextSpecificSettings'));
                }
echo 4;
                HookRegistry::register ('Installer::postInstall', array($this, 'installFilters'));
echo 5;
                return true;
        }

So unless it’s crashing on return true; I can’t fathom what could be wrong here. It’s not getting to ‘regd’ or ‘returning false’ even though it says it’s finishing the register function fine.

What I tried to resolve the issue:
I then tried using a different version of php. The previous version for the upgrade was 5.6. When I ran it as php 7.1 I got a fatal error due to 7.1 not recognizing mysql_connect.

Can you try with php 7.1, mysql and mqsqli connect (in config). Mysql_connect has been deprecated in php 7.1

I’m not sure what specifically you’re referring to with mysql and mqsqli connect (in config). I updated the [database].driver to be mysqli instead of mysql but that doesn’t seem to have been the right thing. Now when I run as either 5.6 or 7.1 I get PHP Fatal Error: Call to undefined function mysqli_real_escape_string() in /.../adodb-mysqli.inc.php:227. The 7.1 call also gives a stack trace so I can tell that it’s not running the same thing.

OK. That is exactly what I was referring to. I broke an upgrade to 7.1 when I missed that step, mysqli in the db config.