How to update the site statistics in MediaWiki
MediaWiki has a tool for site statistics. You can use it to view the number of pages and files, number of page edits, registered users, etc. You can access it by going to Tools menu>Special Pages button>Data and tools section>Statistics button, or by directly opening the respective URL address. If main URL of your site is yourdomain.com, then the URL of the page with the site statistics will be yourdomain.com/index.php/Special:Statistics.
After you make certain changes on your site you may need to update the site statistics, if you want the information to be up to date. For example, if you turn namespaces into content namespaces this will affect which pages are counted as content pages/articles; in this case in order for the article count to be update in the statistics you have to update it.
You can update the site statistics by executing the script initSiteStats.php that comes prepackaged with MediaWiki. The file is in the maintenance folder, and that folder is in the root MediaWiki directory on your MediaWiki hosting account. If the application is installed directly in the public_html directory on the account, the path to the file will be public_html/maintenance/initSiteStats.php. You can update the statistics by executing the following command:
php initSiteStats.php --update
This can be done via SSH. All HostKnox customers have SSH access to their accounts as part of their hosting package. For more information check out the tutorial on how to connect to your account via SSH (or the shorter article version). In the SSH section of our knowledge base you'll also find articles on how to perform various actions via SSH.
Note however that the above command will work if the current working directory is the maintenance folder. That's the folder that contains the script. Otherwise, if you are in a different directory you have to specify the path to the initSiteStats.php file. You can change the current working directory with the cd command. The folder on the account into which a HostKnox customers is automatically logged in when they connect to the account via SSH is a parent folder of public_html. So if the application is installed in directly in public_html, to change the current working directory to the maintenance folder, execute the command cd public_html/maintenance right after you log in.
In case you execute the script without the --update option:
this will only list the current statistics without updating. To check the options that you can use with the script execute the command php initSiteStats.php --help.
Was this answer helpful?
- How to limit the sitemap to specific namespaces in MediaWiki
- How to disable and enable user account creation in MediaWiki
- How to make CSS modifications in MediaWiki
- How to change the period for which changes are kept on the Recent changes list in MediaWiki
- How to prevent users from viewing pages in MediaWiki