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