Some of our journals show statistic and some do not show where we believe they should have some statistic data to show.
Can you one please show me how to troubleshoot this issue? I can take instruction and troubleshoot but I need a pointer from you. I have tried many different things but it just got more confusing. We would like to use Acron plugin to schedule tasks such as collecting Statistic and more…
Attached is the screenshots of stats from different journal.
Thank you for your question. Could you please confirm which version of OJS you are using and whether these versions are the same for both the journals you have screenshot.
Kind Regards,
Patricia M.
Public Knowledge Project Intern
I do not know if I should open a new issue, but I think it is best that I put these issues together since they seem to be related in the backend (code) and frontend (js) both.
So beside above issue that some journals display statistic some do not display statistic, I tested Filters and Monthly view and Daily view attached are issue I ran into (see also comments on screenshots for explanation)
I will update with any new findings, we are trying hard to troubleshoot.
This one is of a different kind. I’ve already created an issue for that:
However, @asmecher says “this is probably related to your rewriting configuration; I suspect the API URL is not getting routed to OJS, which is why the server is responding with a 404.” However, I do not know how to set it up properly so the API URL is routed OK
This Monday we will try to test rewrite rules which probably set in apaches config such as under …/ site-available directory. If we can get it working we will share the rules by posting back here. Thank you @Ph_We and other contributors.
We got stats to display correctly now for all custom domains journals (e.g … https://cdm.ucalgary.ca) it was the api url not resolving correctly. To fix this we made the following changes in file: /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:443>
...
# Rewrite custom domain to make api calls correctly
RewriteRule ^/(api/.*)$ /index.php/cdm/$1 [R,L]
...
</VirtualHost>
# Before applying the RewriteRules, the below uri is not found error 404
https://jmss.org/api/v1/stats/publishedSubmissions?count=20&offset=0&dateStart=2019-05-20&dateEnd=2019-06-19&timeSegment=month&orderBy=total&orderDirection=DESC&_=1561096128768
# After applying the following RewriteRules, the below uri works
# Rewrite custom domain to make api calls correctly
RewriteRule ^/(api/.*)$ /index.php/jmss/$1 [R,L]
https://jmss.org/index.php/jmss/api/v1/stats/publishedSubmissions?count=20&offset=0&dateStart=2019-05-20&dateEnd=2019-06-19&timeSegment=month&orderBy=total&orderDirection=DESC&_=1561096128768
@dung, thank you! However this does not seem to work in our case. And I still suspect there is some bug here. For we have already had a rewriting rule, that should work for all such cases. Here it is:
@Ph_We Hi, Where did you put your RewriteRules? Show me the RewriteRules section if you can. Your RewriteRules is wrong in relation to Statistic and you are almost there.
If you want to do RewriteRules in virtualhost sections here is how: in your /etc/apache2/site-enabled/ find your config file such as 000-default.conf and add each section like the below for every journal.
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName abcd.org
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/gjhgjgjern
RewriteEngine On
# Rewrite index requests to the journal index
RewriteRule ^/(index.php)?/?$ /index.php/abcd/index [L]
# Rewrite custom domain to make api calls correctly
RewriteRule ^/(api/.*)$ /index.php/abcd/$1 [R,L]
# if the incoming request references the journal shortname, use an external redirect to strip the journal shortname
RewriteRule ^/abcd/(.*)$ /$1 [R,L]
# Normal request processing
# Ignore if this request references index.php already
RewriteCond %{REQUEST_URI} !/index.php/
# Ignore if request is for a known OJS directory (Apache 2.2+)
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d
# Ignore if request is for a known OJS file (Apache 2.2+)
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
# Otherwise, rewrite all requests through index.php to this specific journal shortname
RewriteRule ^(.*)$ /index.php/abcd/$1 [QSA,L]
SSLEngine On
SSLCertificateFile /sdfdf/asdfdf/cxvxcv/dfsdfds.crt
SSLCertificateKeyFile /sdfdf/asdfdf/xcvxcvxc/sdfsdfd.key
SSLCertificateChainFile /sdfds/apsdfs/xcvxcvxc/sfsdfsdfs.crt
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info xcvxcvxcv:warn
ErrorLog ${APACHE_LOG_DIR}/brwqrwsf_error-xvcxv.log
CustomLog ${APACHE_LOG_DIR}/sfweradsa_access-dsdsdsa.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Or if you want to stick with RewriteRules in .htaccess you will need to resolve that error 404 Not Found and your Statistic will work, we had the exact same issue and we fixed that with rules:
Rewrite custom domain to make api calls correctly
RewriteRule ^/(api/.*)$ /index.php/abcd/$1 [R,L]
Where “abcd” is your “mirros”
This is what you api should return then the Stat will show
We’ve only managed to set up rewriting for this certain journal out of 23 so far. And this had to be set up in both .htaccess and VirtualHost. @dung, thanks once again.
@asmecher, (just to make it clear) Is there a reason why this certain API call should be different from any other? It might be really difficult to set this up in some cases.