[OJS-3.4.0-4] Statistic problem

Hi @shantanusingh,

The fix is merged.

Before proceeding with the instructions here, please clear the failed statistics jobs again, and clear the usage stats temporary tables:

DELETE FROM `usage_stats_institution_temporary_records`
DELETE FROM `usage_stats_total_temporary_records`  
DELETE FROM `usage_stats_unique_item_investigations_temporary_records` 
DELETE FROM `usage_stats_unique_item_requests_temporary_records`

Do did you install the 3.4. version, using Git or .tar.gz package?

If you are using Git, you would only need to get the latest branch stable-3_4_0.
If you used release package, then you will need to apply the patches. To do so:

  1. go to your OJS folder and then to lib/pkp/ (cd lib/pkp)
  2. from OJS/lib/pkp/ run the following:
    wget -q -O - https://github.com/pkp/pkp-lib/commit/9f2123ed4ff41440856a829f2e01c06e154ef20a.diff | patch -p1
  3. go to the OJS folder (cd ../..)
  4. from OJS folder run the following:
    wget -q -O - https://github.com/pkp/ojs/commit/f8e4002e8d0ed9de475531f8728a3406701364a5.diff | patch -p1

Eventually you can experience some conflicts, because the code that you have is not 100% the same with the stable-3_4_0 branch on which the fix was done. In that case you would need to resolve the conflicts. Let me know if this happen i.e. if I can help somehow.
Here you can see which classes were changed and what changes you would then need to have:
for lib/pkp/: pkp/pkp-lib#9627 Add indexes to usage stats temporary tables, conside… · pkp/pkp-lib@9f2123e · GitHub
for ojs: pkp/pkp-lib#9627 Add indexes to usage stats temporary tables, decreas… · pkp/ojs@f8e4002 · GitHub
This might help you solve the conflicts, double check the code, to have the code correct.

Once the patch is successfully executed (and there are no conflicts) you will need to run an upgrade script, that will change you DB tables:

  1. go to your OJS folder
  2. run/call:
    php lib/pkp/tools/migration.php "PKP\migration\upgrade\v3_4_0\I9627_AddUsageStatsTemporaryTablesIndexes" up

After this there should be a new combined index (load_id, context_id, ip) in the usage stats temporary tables:

usage_stats_total_temporary_records, 
usage_stats_unique_item_investigations_temporary_records,
usage_stats_unique_item_requests_temporary_records

Also the ip column should be varchar(64).

Is this all so, is everything right till now?