Usage log reprocesse issue / ojs 3.3.0.-14

Hi all

We try to reprocesse some usage log files by moving it back to the stage folder.

The command
php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml

then generates following fatal error:

PHP Fatal error:  Uncaught Error: Call to a member function getCategory() on null in /var/www/ojs/plugins/generic/usageStats/
Stack trace:
#0 /var/www/ojs/plugins/generic/usageStats/ UsageStatsLoader->getOJSAssoc()
#1 /var/www/ojs/plugins/generic/usageStats/ UsageStatsLoader->getAssoc()
#2 /var/www/ojs/lib/pkp/classes/task/ UsageStatsLoader->processFile()
#3 /var/www/ojs/plugins/generic/usageStats/ FileLoader->executeActions()
#4 /var/www/ojs/lib/pkp/classes/scheduledTask/ UsageStatsLoader->executeActions()
#5 /var/www/ojs/lib/pkp/classes/cliTool/ ScheduledTask->execute()
#6 /var/www/ojs/lib/pkp/classes/cliTool/ ScheduledTaskTool->executeTask()
#7 /var/www/ojs/lib/pkp/classes/cliTool/ ScheduledTaskTool->parseTasks()
#8 /var/www/ojs/tools/runScheduledTasks.php(34): Schedul in /var/www/ojs/plugins/generic/usageStats/ on line 513

We have problems to resolve it. Thanks.

The stack trace indicates that an article file is assigned an id for a genre (Article Component) which no longer exists in the database.

If you have access to the database via SQL to perform a query, you could try:
SELECT DISTINCT genre_id FROM submission_files WHERE genre_id NOT IN (SELECT genre_id FROM genres);

This would allow you to scope how many missing genres you might be dealing with.