00001 <?php 00023 require_once( dirname(__FILE__) . '/Maintenance.php' ); 00024 00025 class PurgeList extends Maintenance { 00026 public function __construct() { 00027 parent::__construct(); 00028 $this->mDescription = "Send purge requests for listed pages to squid"; 00029 } 00030 00031 public function execute() { 00032 $stdin = $this->getStdin(); 00033 $urls = array(); 00034 00035 while( !feof( $stdin ) ) { 00036 $page = trim( fgets( $stdin ) ); 00037 if ( substr( $page, 0, 7 ) == 'http://' ) { 00038 $urls[] = $page; 00039 } elseif( $page !== '' ) { 00040 $title = Title::newFromText( $page ); 00041 if( $title ) { 00042 $url = $title->getFullUrl(); 00043 $this->output( "$url\n" ); 00044 $urls[] = $url; 00045 if( isset( $options['purge'] ) ) { 00046 $title->invalidateCache(); 00047 } 00048 } else { 00049 $this->output( "(Invalid title '$page')\n" ); 00050 } 00051 } 00052 } 00053 00054 $this->output( "Purging " . count( $urls ) . " urls...\n" ); 00055 $u = new SquidUpdate( $urls ); 00056 $u->doUpdate(); 00057 00058 $this->output( "Done!\n" ); 00059 } 00060 } 00061 00062 $maintClass = "PurgeList"; 00063 require_once( DO_MAINTENANCE );