Merge "Add MediaWikiTestCase::checkHasDiff3 and use it"
[lhc/web/wiklou.git] / maintenance / purgeList.php
index 226d8ba..4b3c382 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
 
+/**
+ * Maintenance script that sends purge requests for listed pages to squid.
+ *
+ * @ingroup Maintenance
+ */
 class PurgeList extends Maintenance {
        public function __construct() {
                parent::__construct();
@@ -47,12 +53,12 @@ class PurgeList extends Maintenance {
 
                while ( !feof( $stdin ) ) {
                        $page = trim( fgets( $stdin ) );
-                       if ( substr( $page, 0, 7 ) == 'http://' ) {
+                       if ( preg_match( '%^https?://%', $page ) ) {
                                $urls[] = $page;
                        } elseif ( $page !== '' ) {
                                $title = Title::newFromText( $page );
                                if ( $title ) {
-                                       $url = $title->getFullUrl();
+                                       $url = $title->getInternalUrl();
                                        $this->output( "$url\n" );
                                        $urls[] = $url;
                                        if ( $this->getOption( 'purge' ) ) {
@@ -105,7 +111,7 @@ class PurgeList extends Maintenance {
                        $urls = array();
                        foreach( $result as $row ) {
                                $title = Title::makeTitle( $row->page_namespace, $row->page_title );
-                               $url = $title->getFullUrl();
+                               $url = $title->getInternalUrl();
                                $urls[] = $url;
                        }