Manual talk:Maintenance scripts

Executing the maintenance scripts
What is meant by "filling in the required connection instructions"? Do I have to write these instructions into the "AdminSettings.php"? Sorry for asking such stupid questions. My best, --84.75.55.96 22:30, 6 November 2007 (UTC)
 * In the AdminSettings.sample, the connection information is generic. You will notice that :
 * $wgDBadminuser     = 'wikiadmin';
 * $wgDBadminpassword = 'adminpass';
 * You should simply replace the values of 'wikiadmin' and 'adminpass' with your own database username and password in your AdminSettings.php file.
 * Stéphane Thibault 05:20, 27 December 2007 (UTC)


 * Ok, thanks! I did that. But how do I establish a commandline connection with the database server? I am working on a Mac and our wiki is installed on server of a hosting provider. But I think I have Shell access; at least it says shell access via "/bin/false". But I really have no clue how to connect. Do I need a particular program for that? My best, --Gollum 19:54, 26 February 2008 (UTC)


 * If the shell of a user is set to "/bin/false" it is usually the technical way of saying "no shell access". A shell is a program that reads your commands and executes them, while /bin/false only does one thing: exits immediately. --Myhr 13:14, 27 February 2008 (UTC)


 * Oh, that does not sound too good. What can I do then? Is there another way to execute the maintenance scripts then? Is it normal to ask the provider to do so? Any other ideas? My best, --Gollum 21:35, 27 February 2008 (UTC)


 * I have the same problem. I do not have access to SSH. I set up a cron job like this one:
 * */45 * * * * /usr/local/bin/php /home/httpd/public_html/wiki/maintenance/generateSitemap.php wiki.mydomain.com --fspath /home/httpd/public_html/wiki/
 * Is that ok? (sorry for my poor english). --89.217.47.34 02:23, 1 April 2008 (UTC)

How to run maintenance scripts from a Web client?
Some users I'm helping are on hosted sites and aren't able to ssh in to run command-line scripts. It would be nice if there was some guideline and/or an alternative commandLine_ALLOW_FROM_WEB.inc that permits these users to run maintenance scripts from a Web page.

Renaming .htaccess to .htaccess_DISABLED lets one view the directory, but I think the next step is disabling the Web server check in commandLine.inc and replacing its command-line parsing with query string parsing. -- Skierpage 01:34, 24 October 2007 (UTC)


 * Well i think generally the idea of a maintenance script is that it's doing something too long-running and expensive to be triggered from the web, so I suspect if the developers were to answer this question, they'd say it's deliberately not possible.
 * However I have a situation where I would also like to do this. I'd say quite a few people are on web hosts without SSH access, so some of these functions could do with being web-callable somehow. Trouble is, for long-running batch operation would need to be broken up. E.g. avoid processing every page in the database, just do 500 per call.
 * -- Harry Wood (talk) 16:25, 29 September 2012 (UTC)


 * Having said that Extension:Maintenance and Extension:MaintenanceShell seem to be offering this -- Harry Wood (talk) 00:35, 8 October 2012 (UTC)

How do I purge the cache fo all my hundreds of image pages?
I need to purge the cache for all my "image:" pages. (all at once) Is there a maintenance script to do this? purgeList.php? How does it work? or some other script? puzzled and in need --Maxelrod 22:16, 20 March 2008 (UTC)

importTextFile.php
I can't figure out how to get this file to work! I have tried through many ways including the sourceforge project wiki_import. When I use the importTextFile.php directly I get this error:

I'm calling importTextFile.php using this code: I'm calling the wiki_import.sh using this code: and I get this error: --Greg 22:01, 12 April 2008 (UTC)

Extension:Maintenance
For those without command line access, I wrote an extension that runs a few of the scripts from a special page, but I'm not really all that sure how I should add a mention of it on the manual page. At first I was thinking about a simple see also link, but it should probably be outlined somewhere that there is an alternative (albeit not a very good one in terms of number of scripts it supports) for those without command line access. So... I don't know where to put a message like that :P -- Skiz zerz  23:19, 23 May 2008 (UTC)

Extension:MaintenanceShell
I expanded on Skizzerz ideas and made an extension which supports all maintenance scripts :) --Frantik 02:05, 31 May 2009 (UTC)

many scripts still not described
Is there anyone able to add some documentation about the scripts listed here with no corresponding page ? --New Morning 09:41, 2 July 2008 (UTC)

1&1
Hi,

When I try to run these scripts with putty, it answers : this version of Mediawiki requires php5 ; you are running 4.4.9. But I have already configured my htaccess with AddType x-mapp-php5 .php that is required on 1&1. I don't understand.
 * .htaccess only affects scripts run from the web server. When you use putty you're using the command line so htaccess isn't being used.  I'm not quite sure how to run php5 via the command line in 1&1.. maybe try "php5" instead of "php"? --Frantik 02:14, 31 May 2009 (UTC)

AdminSettings.php
Which scripts require this? I haven't renamed it and most of them seem to work.. or do i get improved security if I do set it up correctly? --Frantik 02:11, 31 May 2009 (UTC)

Godaddy php5 not installed
Took me a while to get this, so I'm gonna share it with all those running Mediawiki in Godaddy.

When using Putty to run maintenance scripts, you'll get a message about not having php5 installed even though you have PHP5 installed. This is because Godaddy defaults to PHP4. To run maintenance scripts, instead of writing, let's say:

php cleanupTitles.php

write...

web/cgi-bin/php5 "cleanupTitles.php"

This way you load php5 instead of the default php4. --Mark 08:23, 8 December 2009 (UTC)

404 error
I am following the instructions (and added screenshots) and logged into putty:

http://www.mediawiki.org/w/index.php?title=Manual:Maintenance_scripts&oldid=365943#Running_the_scripts

When I type: php rebuildall.php

I get the error: php rebuildall.php Status: 404 Content-type: text/html

Mediawiki states that:

1. I need to make sure the path is correct, for example:
 * php /home/httpd/host/XXXXXXX.com/httpdocs/wikidirectory/maintenance/refreshLinks.php
 * or

2. "you have to run it from the server, not through a browser. Either through SSH..." I have ssh access

Adamtheclown 18:36, 25 November 2010 (UTC)

404 error solution
With the help of emufarmers I figured it out:

[Bobtheperv@p9nlh999 ~]$ ls backup cgi  crontab  data  dea1031109999999.sql  html  mydatabase.sql [Bobtheperv@p9nlh999 ~]$ cd html [Bobtheperv@p9nlh999 html]$ ls

[Bobtheperv@p9nlh999 html]$ [Bobtheperv@p9nlh999 html]$ cd dr [Bobtheperv@p9nlh999 dr]$ cd maintenance [Bobtheperv@p9nlh999 maintenance]$ php rebuildall.php Content-type: text/html

Sorry! This version of MediaWiki requires PHP 5; you are running 4.4.9.

If you are sure you already have PHP 5 installed, it may be installed in a different path from PHP 4. Check with your system administrator. [Bobtheperv@p9nlh999 maintenance]$

Adamtheclown 01:42, 26 November 2010 (UTC)

namespaceDupes.php conflicts
i'm trying to do some reorganization of our namespaces, [including removing some] and unfortunately i've got a handful of pages that exist outside one the namespaces that were apparently put in before we created it.

i'm trying to run namespaceDupes.php to push pages formerly under a namespace into the main namespace, but it results in the following error:

Checking namespace 104: "Namespace" ... 2 conflicts detected: ... 2758 (0,"Namespace:FAQ") -> (104,"FAQ") Namespace:FAQ ... *** cannot resolve automatically; page exists with ID 2769 *** ... 2567 (0,"Namespace:Replication") -> (104,"Replication") Namespace:Replication ... *** cannot resolve automatically; page exists with ID 2759 ***

i found a number of pages via google that had this error but with no information as to how to go about resolving these conflicts.

Zeefreak 15:42, 10 October 2011 (UTC)

MW_INSTALL_PATH note is inaccurate?
The current version says "If your script fails to run, and spews out a lot of error messages, the first thing to try is to set the MW_INSTALL_PATH environment variable to point to the root of your MediaWiki installation. This will help scripts to find the necessary files, ..." But doing this actually caused the spewing of some error messages in my case, possibly because it was not finding necessary files. In particular, it somehow made the edit.php script look for a ../maintenance/include/Init.php; in fact, my maintenance directory contained no include directory, much less an include/Init.php. Odd. Perhaps there should be a "troubleshooting" section? Could this be an MW version dependency? Yakushima (talk) 06:43, 9 August 2012 (UTC)

How else to run update.php?
Hi, all.

Please, help me, a non-expert.

I'm trying to upgrade my local wiki (accessed on a single computer (running Windows XP), the same one where it's hosted) to MediaWiki 1.18.5. I've backed things up and pasted in the files and folders from the extracted archive of the new version. Now I need to run "C:\wamp\www\mywikipedia\maintenance\update.php". I've installed PuTTTY. I don't know how to find the IP address for my local wiki. In PuTTY's "Host Name (or IP Address)" box, I've tried, one at a time, "localhost" and each of the three strings of numbers I find from ipconfig (IP Address, Subnet Mask, and Default Gateway): all four result in errors; I never can get to the login screen.


 * 1) What shall I do?
 * 2) How shall I find the IP address of my local wiki?
 * 3) How can I get to the login screen in PuTTY?
 * 4) What (if any) other way is there to run the script?  (I don't want to install emulator after emulator, only to encounter again and again the same problem I'm having with PuTTY.)

Please, help. Thank you very much. — Preslethe (talk) 01:32, 23 September 2012 (UTC)

Update: I went to http://www.php.net/releases/ and got version 5.1.0. I installed it and then used "C:\PHP\php-cgi.exe" to run "C:\wamp\www\mywikipedia\maintenance\update.php". I've just now done it, so I don't yet know of any problems (though Apache did crash); but at least my wiki is accessible again. — Preslethe (talk) 02:03, 23 September 2012 (UTC)