16

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

user3791372
  • 4,445
  • 6
  • 44
  • 78
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/), [Web Apps Stack Exchange](http://webapps.stackexchange.com/) or [Webmaster Stack Exchange](http://webmasters.stackexchange.com/) would be a better place to ask. – jww Nov 20 '15 at 13:28
  • 1
    @jww the simple fact the question is over a year old, not closed and has upvotes and answers with votes would suggest to you that a) it's a suitable question which is useful to the community or b) is in dire need of being closed. And besides, this question is about development of a mediawiki site which involved programming. – user3791372 Nov 21 '15 at 08:15

3 Answers3

10

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.

leo
  • 8,106
  • 7
  • 48
  • 80
6

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.

rubo77
  • 19,527
  • 31
  • 134
  • 226
  • 1
    This is the better answer. – snowguy Mar 02 '15 at 04:05
  • 3
    Note that this is not part of `LocalSettings.php` since MW 1.17. Instead, there is a setting called `$wgInvalidateCacheOnLocalSettingsChange` that will achieve pretty much the same. This method is great for smaller wikis, but [not recommended](https://www.mediawiki.org/wiki/Manual:$wgInvalidateCacheOnLocalSettingsChange) for high traffic wikis. – leo Oct 27 '15 at 08:55
0

Use purgePage.php as the equivalent to action=purge