Merge "Allow to export null values"
[lhc/web/wiklou.git] / maintenance / populateImageSha1.php
index 4964bf1..e9123aa 100644 (file)
@@ -36,7 +36,12 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance {
                $this->addOption( 'multiversiononly', "Calculate only for files with several versions" );
                $this->addOption( 'method', "Use 'pipe' to pipe to mysql command line,\n" .
                        "\t\tdefault uses Database class", false, true );
-               $this->addOption( 'file', 'Fix for a specific file, without File: namespace prefixed', false, true );
+               $this->addOption(
+                       'file',
+                       'Fix for a specific file, without File: namespace prefixed',
+                       false,
+                       true
+               );
        }
 
        protected function getUpdateKey() {
@@ -72,11 +77,15 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance {
                        );
                        if ( !$res ) {
                                $this->error( "No such file: $file", true );
+
                                return false;
                        }
                        $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 {