OJS -> Update failing

Hello everyone, long-time listener and first time caller here.

Long story short: I work for an academic institution and the previous assistant director of our library took another job in Texas and I adopted some of the previous duties left behind, one of them being management of our OJS system.

Now for the fun part: I’ve attempted to run the update through our c-panel interface to get the system to fix an error message that consistently appears whenever we try to input another volume of our journal. I’ve also tried through the c-panel file manager interface to manually apply the update from to but I received another fatal error that way.

The first fatal error, when attempting BOTH the update to is this:
Fatal error: Cannot redeclare class ThemePlugin in /home/dbqedu/public_html/digitalud/ojs/lib/pkp/classes/plugins/ThemePlugin.inc.php on line 59

The second fatal error (which I don’t have exact reference information) is a fatal error that references line 19 of the Plugin.inc.php file that mentioned “cannot re-declare class on line 19 of” and then the file information.

I’m not familiar with the system (though I did read through a fair bit of documentation) and cannot figure out how to rectify these errors. Any help would be great, thank you in advance.

1 Like

Also, I have looked through and compared the files both from the live Plugin.inc.php file and the file as well as the ThemePlugin file line 59 and cannot find anything that would be a reference issue or other error (to me, though I’m not familiar with OJS as I mentioned). I’m at a loss.

Hi @charlescmyers,

How did you update your code? If you copied the new code over the old installation directory, you might’ve left quite a bit of old code mixed in with the new code. The best way is to start with a fresh copy of the new code and only copy in what you need from the old installation (e.g. the public directory).

Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I read through the documentation on how to perform the upgrade and here’s what I did:

-Unpacked the tar.gz files into the c-panel
-Made a copy of the new config.inc.php file and copied over the current OJS config.inc.php file
-copied over the public/ folder information
-I didn’t have to touch the files directory folder information, as that wasn’t and isn’t contained within the OJS directory itself

Once I made sure all of that was taken care of, I switched the config.inc.php “installed=on” to “off” and attempted the update, where I received the error message of re-declaring the class on line 19. I did look through the config.inc.php files from both the and the and there are some differences in there that, according to the documentation, I might have to manually add back in to correspond with the correct files.

Would that fix the fatal error though?

Hi @charlescmyers,

Differences in the configuration file wouldn’t explain that message.

It still sounds to me like two different classes are declaring the ThemePlugin class. On my Linux box, I can search for this by running…

 fgrep -l "class ThemePlugin" `find . -name \*.inc.php` | less

If you have SSH access, I’d suggest trying that.

Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I’m going to try that today and see if I can find the two classes referencing the ThemePlugin class.

I have to go through my institution to setup the SSH access but I’ll give that a shot and post the results.

Thank you.

Hi @asmecher

I’m still waiting for someone to get back to me regarding the SSH access to check for duplicate class declarations but I thought this was interesting.

There are two files that are almost identical in their layout that we have in our OJS setup. Both are subsets of the /plugins folder but they reside in two separate areas.

The first is in our /ojs/classes/plugins folder, which is where the ThemePlugins.inc.php is.
The second is /ojs/lib/class/plugins folder, where another ThemePlugins.inc.php file is.

I was waiting around and looking through both of the files and thought, “What is there to lose?”, and deleted one of them at a time to see if the theme redirect issue went away. Turns out, the /ojs/classes/plugins folder ThemePlugins.inc.php file is the one that was causing the issue.

I’m able to access the management system field 5. The Look without getting the fatal error message I’ve been receiving.

Would you have any idea why there are duplicate files located in these two areas? Like I mentioned before, I didn’t set the system up and going through the update I didn’t notice anything odd. Do we need these two separate file locations?

I’m going to attempt the update again and see whether I run into the same issue as I did before. Thank you for your help on this thus far.

Hi @asmecher,

I went through our C-Panel interface to perform the upgrade, as I mentioned I was going to attempt earlier, and when the files were downloaded to perform the update, it created another copy of the ThemePlugin.inc.php file in the same location as the one I deleted earlier.

I solved it the same way I did before: I went into the duplicate file location folder and deleted it, clicked “Upgrade” on the OJS Install/Upgrade screen, and everything worked fine.

Still have the same question though: Why would it be creating a duplicate file of the ThemePlugin.inc.php? I would think that if it already had that file located in the lib/pkp/classes/plugins folder, it wouldn’t need to create a new one that would intentionally lead to a class redirect fatal error.

Thank you again for your help with this.

Hi @charlescmyers,

The only ThemePlugin.inc.php for OJS 2.4.8-1 should be in classes/plugins; the one for OJS 3.0 should be in lib/pkp/classes/plugins. In either case, I’m not sure where the other one is coming from; only one is included in each version’s .tar.gz file. The upgrade process as documented in docs/README should take care of updating the code without mixing the two versions together.

Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I’ll read through and try to cleanup the files that are included here. Like I said, since I wasn’t the one who setup the system I’m not sure where the files came from so this has all been very helpful.

Since I was able to update it to 2.8.4-1, I think I’ll focus on reading the documentation to cleanup some of the files that might not be necessary or might cause issues when moving to in the future.

Thanks for your help.