user3791372
user3791372

Reputation: 4665

Purging all pages in mediawiki

Is it possible to purge all pages in mediawiki? I've tried emptying the obejctcache table to no avail. I don't particularly want to hit each page with ?action=purge appended. Version 1.23.3

Upvotes: 18

Views: 6443

Answers (3)

Alexander Gesinn
Alexander Gesinn

Reputation: 113

Use purgePage.php as the equivalent to action=purge

Upvotes: 0

leo
leo

Reputation: 8520

You can either

  1. Use the maintainance script PurgeList.php like this: php purgeList.php --purge --all, for MW > 1.21, and php purgeList.php --all-namespaces for MW > 1.34. Really old MW versions do not have the --all option, so you will need a list of pages.

  2. Use the API: API:Purge, and feed it with a list of all pages (that you can get from API:Allpages)

  3. Invalidate all caches by setting $wgCacheEpoch to the current time in LocalSettings.php, e.g. $wgCacheEpoch = 20140901104232;.

  4. Set $wgInvalidateCacheOnLocalSettingsChange (since MW 1.17) to achieve pretty much the same thing. Only do this if your wiki has low to moderate traffic.

  5. Not sure if this is a good idea, but if you have access to the wiki's database you should also be able to achieve the same effect by truncating the table objectcache.

Upvotes: 10

rubo77
rubo77

Reputation: 20827

Invalidate all caches for all sites with this simple command:

touch /etc/mediawiki/LocalSettings.php 

because in the touch LocalSettings.php file there is this part:

# When you make changes to this configuration file, this will make
# sure that cached pages are cleared.
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );

__FILE__ is the LocalSettings.php file itself, so if the filetime is now, all cache older than the file will be purged.

Upvotes: 7

Related Questions