Update the WikiPage object with the new ID when undeleting
[lhc/web/wiklou.git] / maintenance / populateImageSha1.php
index d7c26d5..cc52239 100644 (file)
@@ -67,7 +67,7 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance {
                $isRegen = ( $force || $file != '' ); // forced recalculation?
 
                $t = -microtime( true );
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->getDB( DB_MASTER );
                if ( $file != '' ) {
                        $res = $dbw->select(
                                'image',
@@ -82,7 +82,10 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance {
                        }
                        $this->output( "Populating img_sha1 field for specified files\n" );
                } else {
-                       if ( $force ) {
+                       if ( $this->hasOption( 'multiversiononly' ) ) {
+                               $conds = array();
+                               $this->output( "Populating and recalculating img_sha1 field for versioned files\n" );
+                       } elseif ( $force ) {
                                $conds = array();
                                $this->output( "Populating and recalculating img_sha1 field\n" );
                        } else {