Merge "(bug 43177) API: Fix regression in case handling for sha1 params"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 17 Dec 2012 19:45:15 +0000 (19:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 17 Dec 2012 19:45:15 +0000 (19:45 +0000)
RELEASE-NOTES-1.21
includes/FormOptions.php
includes/api/ApiQueryRevisions.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php
includes/upload/UploadBase.php

index f2cfbb7..ca63bf4 100644 (file)
@@ -114,6 +114,7 @@ production.
   will require updates to your site's CSS or JS.
 * (bug 41342) jquery.suggestions should cancel any active (async) fetches
   before it triggers another fetch.
+* (bug 42184) $wgUploadSizeWarning missing second variable
 
 === API changes in 1.21 ===
 * prop=revisions can now report the contentmodel and contentformat.
@@ -126,6 +127,8 @@ production.
 * (bug 41042) Revert change to action=parse&page=... behavior when the page
   does not exist.
 * (bug 27202) Add timestamp sort to list=allimages.
+* (bug 43137) Don't return the sha1 of revisions through the API if the content is
+  revision-deleted
 
 === Languages updated in 1.21 ===
 
index 1cfe88e..8411bc4 100644 (file)
@@ -178,8 +178,9 @@ class FormOptions implements ArrayAccess {
 
        /**
         * @todo Document
-        * @param $name String: option name
-        * @return null
+        * @param string $name Option name
+        * @throws MWException If option does not exist.
+        * @return mixed Value or the default value if it is null.
         */
        public function consumeValue( $name ) {
                $this->validateName( $name, true );
index 66ff3f0..1d46b7a 100644 (file)
@@ -439,12 +439,14 @@ class ApiQueryRevisions extends ApiQueryBase {
                        }
                }
 
-               if ( $this->fld_sha1 ) {
+               if ( $this->fld_sha1 && !$revision->isDeleted( Revision::DELETED_TEXT ) ) {
                        if ( $revision->getSha1() != '' ) {
                                $vals['sha1'] = wfBaseConvert( $revision->getSha1(), 36, 16, 40 );
                        } else {
                                $vals['sha1'] = '';
                        }
+               } elseif ( $this->fld_sha1 ) {
+                       $vals['sha1hidden'] = '';
                }
 
                if ( $this->fld_contentmodel ) {
index ffa3046..08e1620 100644 (file)
@@ -649,23 +649,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                );
        }
 
-       /**
-        * Safe version of filemtime(), which doesn't throw a PHP warning if the file doesn't exist
-        * but returns 1 instead.
-        * @param $filename string File name
-        * @return int UNIX timestamp, or 1 if the file doesn't exist
-        */
-       protected static function safeFilemtime( $filename ) {
-               if ( file_exists( $filename ) ) {
-                       return filemtime( $filename );
-               } else {
-                       // We only ever map this function on an array if we're gonna call max() after,
-                       // so return our standard minimum timestamps here. This is 1, not 0, because
-                       // wfTimestamp(0) == NOW
-                       return 1;
-               }
-       }
-
        /**
         * Get whether CSS for this module should be flipped
         * @param $context ResourceLoaderContext
index 0e170fb..b3e1f93 100644 (file)
@@ -289,6 +289,16 @@ abstract class ResourceLoaderModule {
                return array();
        }
 
+       /**
+        * Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
+        * Default implementation hardcodes 'desktop'.
+        *
+        * @return array of strings
+        */
+       public function getTargets() {
+               return array( 'desktop' );
+       }
+
        /**
         * Get the files this module depends on indirectly for a given skin.
         * Currently these are only image files referenced by the module's CSS.
@@ -451,12 +461,19 @@ abstract class ResourceLoaderModule {
        }
 
        /**
-        * Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
-        * Default implementation hardcodes 'desktop'.
-        *
-        * @return array of strings
+        * Safe version of filemtime(), which doesn't throw a PHP warning if the file doesn't exist
+        * but returns 1 instead.
+        * @param $filename string File name
+        * @return int UNIX timestamp, or 1 if the file doesn't exist
         */
-       public function getTargets() {
-               return array( 'desktop' );
+       protected static function safeFilemtime( $filename ) {
+               if ( file_exists( $filename ) ) {
+                       return filemtime( $filename );
+               } else {
+                       // We only ever map this function on an array if we're gonna call max() after,
+                       // so return our standard minimum timestamps here. This is 1, not 0, because
+                       // wfTimestamp(0) == NOW
+                       return 1;
+               }
        }
 }
index fdd5f65..dc32a29 100644 (file)
@@ -581,7 +581,7 @@ abstract class UploadBase {
 
                global $wgUploadSizeWarning;
                if ( $wgUploadSizeWarning && ( $this->mFileSize > $wgUploadSizeWarning ) ) {
-                       $warnings['large-file'] = $wgUploadSizeWarning;
+                       $warnings['large-file'] = array( $wgUploadSizeWarning, $this->mFileSize );
                }
 
                if ( $this->mFileSize == 0 ) {