runScheduledTasks.php fails in OJS 3.0.1 (Call to undefined method ScheduledTaskTool::ScheduledTaskTool())

Hello,

we just upgraded (successfully) to OJS 3.0.1 (from 3.0.0) but our runScheduledTasks.php cron job failed with PHP Fatal error: Call to undefined method ScheduledTaskTool::ScheduledTaskTool() in /opt/ojs3/tools/runScheduledTasks.php on line 28.

I had a look and it seems that commit 4772e4afa3463d8ab0b7d8f3df03f70db0f90add broke things with the modern constructor syntax. ScheduledTaskTool.inc.php went from version 3.0.0 to 3.0.1 renaming ScheduledTaskTool to __construct but file runScheduledTasks.php was not updated accordingly (the call is still for function ScheduledTaskTool instead of __construct). Calling __construct instead of ScheduledTaskTool in runScheduledTasks.php fixes the problem (and is the appropriate solution as far as I can tell).

If this is the case I’d be happy to make a PR, let me know. Cheers, Nikos

1 Like

Hi @kasioumis,

Good spotting – yes, please do send in a PR! (To either the ojs-stable-3_0_1 or master branches, I’ll take care of cherry-picking.)

Thanks,
Alec Smecher
Public Knowledge Project Team

Done :slight_smile:

Thanks, @kasioumis! An issue for the sake of tracking:

1 Like

Hi @asmecher,

After adopting this fix scheduled tasks started to work. But now I see that geoip is not saving in the metrics database table. Was it somehow changed in 3.0.1? I remember that in 3.0.0 it was necessary to deactivate php geoip because of conflicts with ojs plugin codes. Do I need to activate it again?

@Vitaliy

Just to double check: there were geo information int the table metrics in OJS 3.0 but there are no in 3.0.1, right?
And you have not changed the usage statistics plugin settings options i.e. data privacy, or city and region option?

Thanks!
Bozana

Hmmm… As far as I understand it, at some point (maybe in 2.4.2) the geo location tools came and the user who wanted to used it should get/install the geo database, s. ojs/upgrade.xml at ojs-stable-2_4_8 · pkp/ojs · GitHub and ojs/UPGRADE at ojs-stable-2_4_8 · pkp/ojs · GitHub, right?
For all further OJS versions there was no information for the users what should they do to get the geo DB and the geo DB was not provided with the release, right?
Thus if the DB file was missing there would be no geo infromation saved in the metrics table, s. ojs/GeoLocationTool.inc.php at ojs-stable-2_4_8 · pkp/ojs · GitHub and ojs/UsageStatsLoader.inc.php at ojs-stable-2_4_8 · pkp/ojs · GitHub, right? The same guilt for OJS 3.0 and 3.0.1.
@ctgraham, is this true/correct? Do you maybe also use the geo tools?

Yes, I think your are right about the documentation, @bozana. Information about the Geo Stats tool made it into the UPGRADE documentation, but not into the INSTALL documentation.

OJS 3.x appears to support the use of the GeoLiteCity.dat file, but there appears to be no documentation of how to download the tool.

Since download and using the tool requires an additional license agreement, this shouldn’t happen automatically, but it could be incorporated into the plugin’s settings, perhaps here:

Thanks a lot @ctgraham!
Hmmm… what should then be distributed under CC BY-SA 4.0? The statistics or the plugin code or both?

@Vitaliy, did you have the geo DB, were you using it earlier? If so do you have it now?

Hi @bozana,

Yep, Plugin worked in OJS 3.0. All data about geo is in the metrics table, except after upgrading to 3.0.1. I had not changed anything in the plugin options.

Just the .dat file is distributed CC BY-SA. The implication, however, is that the user of the .dat file must attribute the use somewhere.

The big change between 3.0.0 and 3.0.1 will be the modernization of the constructor:

Perhaps there is something that is failing due to an explicit call to GeoLocationTool::GeoLocationTool() ?

Greetings,

It must be added that after upgrade I have noticed another problem. For our new article stats data are not displayed at front-end by usage statics plugin. I know that there were >10 views, because I had provided the link to it on this forum as an example of bootstrap html galley styling and see the views count. For articles that were published before upgrade stats data are increasing as usual. Metrics table except geo data is also working as usual. @bozana where do you think the problem can be?

@Vitaliy

Do you have the file “GeoLiteCity.dat” in your lib/pkp/plugins/generic/usageStats directory?

I’ll take a look how the stats data is displayed and see if I could figure out something…

Best,
Bozana

Greetings @bozana,
This file is present in the mentioned directory. So after upgrade I see 2 problems. Geo ip data isn’t recording in the metrics table. And statistics chart is not displaying at front-end for the newly published article. I am wondering how latter is possible. Stat data are successfully recorded in the metrics table and are normally counted for articles published before upgrade.

What are you using to display the statistics chart on the front end? Is this a plugin, or a code change? I’m not familiar with native functionality which will do that.

It is Usage Statistics plugin: https://github.com/pkp/pkp-lib/tree/master/plugins/generic/usageStats

It shows download counts as a diagram on the article details page.

Hi @Vitaliy

Could you maybe post/send a few rows from your table metrics – a few for the article, that has the statistics displayed and a few for the article, that has no statistics displayed?

Thanks a lot!
Bozana

Hi @Vitaliy

I’ve just tested both features on my local installation, Geo and statistics display and both worked well here :slight_smile: To get the Geo DB I did exact the same steps as described here: ojs/UPGRADE at ojs-stable-2_4_8 · pkp/ojs · GitHub. I.e. the folder where the Geo DB has to be is plugins/generic/usageStats/ and not in the lib/pkp/... as I first thought.
Also, I see the statistics graph on the article page, I accessed today.
Thus, I am not sure what is going on on your installation :frowning:
I am using current master branch but it should be the same as 3.0.1. I will test it also with the ojs-stable-3_0_1 branch.
Do you have IP addresses in your recent usage stats log files (you will find them in your files folder under usageStats/. Already processed files you will find there in the folder archive/ and the most recent log files in usageEventLogs/)?
Could you maybe print out the Geo DB file name/path and if the file is find here: pkp-lib/GeoLocationTool.inc.php at ojs-stable-3_0_1 · pkp/pkp-lib · GitHub? – to be sure that the system finds it.
I have no idea why the graph is not displaying, if the statistics data are in the metrics table :-\ Could you post me some rows from the metrics table, for which the graph is not showing?

Hmmm…
Best,
Bozana