]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - maintenance/purgeList.php
MediaWiki 1.15.1
[autoinstallsdev/mediawiki.git] / maintenance / purgeList.php
1 <?php
2 /**
3  * Send purge requests for listed pages to squid
4  *
5  * @file
6  * @ingroup Maintenance
7  */
8
9 require_once( "commandLine.inc" );
10
11 $stdin = fopen( "php://stdin", "rt" );
12 $urls = array();
13
14 while( !feof( $stdin ) ) {
15         $page = trim( fgets( $stdin ) );
16         if ( substr( $page, 0, 7 ) == 'http://' ) {
17                 $urls[] = $page;
18         } elseif( $page !== '' ) {
19                 $title = Title::newFromText( $page );
20                 if( $title ) {
21                         $url = $title->getFullUrl();
22                         echo "$url\n";
23                         $urls[] = $url;
24                         if( isset( $options['purge'] ) ) {
25                                 $title->invalidateCache();
26                         }
27                 } else {
28                         echo "(Invalid title '$page')\n";
29                 }
30         }
31 }
32
33 echo "Purging " . count( $urls ) . " urls...\n";
34 $u = new SquidUpdate( $urls );
35 $u->doUpdate();
36
37 echo "Done!\n";
38
39