Merge "Change EXIF to Exif"
[lhc/web/wiklou.git] / maintenance / attachLatest.php
index 449b67f..cb480c2 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
- * quick hackjob to fix damages imports on wikisource
- * page records have page_latest wrong
+ * Corrects wrong values in the `page_latest` field in the database.
  *
  * Copyright © 2005 Brion Vibber <brion@pobox.com>
  * http://www.mediawiki.org/
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
 
+/**
+ * Maintenance script to correct wrong values in the `page_latest` field
+ * in the database.
+ *
+ * @ingroup Maintenance
+ */
 class AttachLatest extends Maintenance {
 
        public function __construct() {
@@ -65,8 +70,8 @@ class AttachLatest extends Maintenance {
                        $id = $revision->getId();
                        $this->output( wfWikiID() . " $pageId [[$name]] latest time $latestTime, rev id $id\n" );
                        if ( $this->hasOption( 'fix' ) ) {
-                               $article = new Article( $title );
-                               $article->updateRevisionOn( $dbw, $revision );
+                               $page = WikiPage::factory( $title );
+                               $page->updateRevisionOn( $dbw, $revision );
                        }
                        $n++;
                }
@@ -78,4 +83,4 @@ class AttachLatest extends Maintenance {
 }
 
 $maintClass = "AttachLatest";
-require_once( DO_MAINTENANCE );
+require_once RUN_MAINTENANCE_IF_MAIN;