summaryrefslogtreecommitdiff
path: root/maintenance/purgeList.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/purgeList.php')
-rw-r--r--maintenance/purgeList.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/maintenance/purgeList.php b/maintenance/purgeList.php
new file mode 100644
index 00000000..9bf7c1bf
--- /dev/null
+++ b/maintenance/purgeList.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * Send purge requests for listed pages to squid
+ */
+
+require_once( "commandLine.inc" );
+
+$stdin = fopen( "php://stdin", "rt" );
+$urls = array();
+
+while( !feof( $stdin ) ) {
+ $page = trim( fgets( $stdin ) );
+ if ( substr( $page, 0, 7 ) == 'http://' ) {
+ $urls[] = $page;
+ } elseif( $page !== '' ) {
+ $title = Title::newFromText( $page );
+ if( $title ) {
+ $url = $title->getFullUrl();
+ echo "$url\n";
+ $urls[] = $url;
+ } else {
+ echo "(Invalid title '$page')\n";
+ }
+ }
+}
+
+echo "Purging " . count( $urls ) . " urls...\n";
+$u = new SquidUpdate( $urls );
+$u->doUpdate();
+
+echo "Done!\n";
+
+?>