Let crazy people run updates on broken setups like 5.3.1
[lhc/web/wiklou.git] / maintenance / attachLatest.php
index ca8d1aa..67f3088 100644 (file)
@@ -1,8 +1,8 @@
 <?php
-// quick hackjob to fix damages imports on wikisource
-// page records have page_latest wrong
-
 /**
+ * quick hackjob to fix damages imports on wikisource
+ * page records have page_latest wrong
+ *
  * Copyright (C) 2005 Brion Vibber <brion@pobox.com>
  * http://www.mediawiki.org/
  *
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
- * @file
  * @ingroup Maintenance
  */
 
-require_once( "Maintenance.php" );
+require_once( dirname(__FILE__) . '/Maintenance.php' );
 
 class AttachLatest extends Maintenance {
        
        public function __construct() {
                parent::__construct();
-               $this->addParam( "fix", "Actually fix the entries, will dry run otherwise" );
+               $this->addOption( "fix", "Actually fix the entries, will dry run otherwise" );
                $this->mDescription = "Fix page_latest entries in the page table";
        }
        
@@ -44,7 +43,7 @@ class AttachLatest extends Maintenance {
                        __METHOD__ );
 
                $n = 0;
-               while( $row = $dbw->fetchObject( $result ) ) {
+               foreach( $result as $row ) {
                        $pageId = intval( $row->page_id );
                        $title = Title::makeTitle( $row->page_namespace, $row->page_title );
                        $name = $title->getPrefixedText();