Merge "Unblacklist group-specific JS/CSS for the user group"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 6 Dec 2013 20:45:27 +0000 (20:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 6 Dec 2013 20:45:27 +0000 (20:45 +0000)
includes/installer/LocalSettingsGenerator.php
includes/media/Bitmap.php
includes/media/DjVu.php
includes/media/MediaHandler.php
includes/media/SVG.php
includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc
tests/phpunit/includes/api/query/ApiQueryBasicTest.php

index 2433fbd..515cedb 100644 (file)
@@ -210,6 +210,7 @@ class LocalSettingsGenerator {
                }
 
                $groupRights = '';
+               $noFollow = '';
                if ( $this->groupPermissions ) {
                        $groupRights .= "# The following permissions were set based on your choice in the installer\n";
                        foreach ( $this->groupPermissions as $group => $rightArr ) {
@@ -220,11 +221,10 @@ class LocalSettingsGenerator {
                                                wfBoolToStr( $perm ) . ";\n";
                                }
                        }
-                       $noFollow = '';
                        if ( $this->groupPermissions['*']['edit'] === false
                                && $this->groupPermissions['*']['createaccount'] === false
                                && $this->groupPermissions['*']['read'] !== false ) {
-                               $noFollow = "# Set \$wgNoFollowLinks to true if you open up your wiki to editing by\n"
+                               $noFollow = "\n# Set \$wgNoFollowLinks to true if you open up your wiki to editing by\n"
                                        . "# the general public and wish to apply nofollow to external links as a\n"
                                        . "# deterrent to spammers. Nofollow is not a comprehensive anti-spam solution\n"
                                        . "# and open wikis will generally require other anti-spam measures; for more\n"
@@ -364,7 +364,6 @@ ${serverSetting}
 # Path to the GNU diff3 utility. Used for conflict resolution.
 \$wgDiff3 = \"{$this->values['wgDiff3']}\";
 
-{$groupRights}
-{$noFollow}";
+{$groupRights}{$noFollow}";
        }
 }
index 6f7130d..804393a 100644 (file)
@@ -495,19 +495,6 @@ class BitmapHandler extends ImageHandler {
                return false; # No error
        }
 
-       /**
-        * Log an error that occurred in an external process
-        *
-        * @param $retval int
-        * @param $err int
-        * @param $cmd string
-        */
-       protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
-               wfDebugLog( 'thumbnail',
-                       sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
-                               wfHostname(), $retval, trim( $err ), $cmd ) );
-       }
-
        /**
         * Get a MediaTransformError with error 'thumbnail_error'
         *
index fe3313a..cbb3ec2 100644 (file)
@@ -195,10 +195,7 @@ class DjVuHandler extends ImageHandler {
 
                $removed = $this->removeBadFile( $dstPath, $retval );
                if ( $retval != 0 || $removed ) {
-                       wfDebugLog( 'thumbnail',
-                               sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
-                                       wfHostname(), $retval, trim( $err ), $cmd ) );
-
+                       $this->logErrorForExternalProcess( $retval, $err, $cmd );
                        return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
                } else {
                        $params = array(
@@ -235,7 +232,10 @@ class DjVuHandler extends ImageHandler {
         * @return bool
         */
        function getMetaTree( $image, $gettext = false ) {
-               if ( isset( $image->dejaMetaTree ) ) {
+               if ( $gettext && isset( $image->djvuTextTree ) ) {
+                       return $image->djvuTextTree;
+               }
+               if ( !$gettext && isset( $image->dejaMetaTree ) ) {
                        return $image->dejaMetaTree;
                }
 
index f55e508..b002dfb 100644 (file)
@@ -31,6 +31,10 @@ abstract class MediaHandler {
        const METADATA_GOOD = true;
        const METADATA_BAD = false;
        const METADATA_COMPATIBLE = 2; // for old but backwards compatible.
+       /**
+        * Max length of error logged by logErrorForExternalProcess()
+        */
+       const MAX_ERR_LOG_SIZE = 65535;
 
        /** @var MediaHandler[] Instance cache with array of MediaHandler */
        protected static $handlers = array();
@@ -703,4 +707,25 @@ abstract class MediaHandler {
        public function getRotation( $file ) {
                return 0;
        }
+
+       /**
+        * Log an error that occurred in an external process
+        *
+        * Moved from BitmapHandler to MediaHandler with MediaWiki 1.23
+        *
+        * @since 1.23
+        * @param $retval int
+        * @param $err string Error reported by command. Anything longer than
+        * MediaHandler::MAX_ERR_LOG_SIZE is stripped off.
+        * @param $cmd string
+        */
+       protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
+               # Keep error output limited (bug 57985)
+               $errMessage = trim( substr( $err, 0, self::MAX_ERR_LOG_SIZE ) );
+
+               wfDebugLog( 'thumbnail',
+                       sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
+                                       wfHostname(), $retval, $errMessage, $cmd ) );
+       }
+
 }
index d06acd8..fef67f8 100644 (file)
@@ -208,9 +208,7 @@ class SvgHandler extends ImageHandler {
                }
                $removed = $this->removeBadFile( $dstPath, $retval );
                if ( $retval != 0 || $removed ) {
-                       wfDebugLog( 'thumbnail', sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
-                               wfHostname(), $retval, trim( $err ), $cmd ) );
-
+                       $this->logErrorForExternalProcess( $retval, $err, $cmd );
                        return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
                }
 
index bda8653..aafe432 100644 (file)
@@ -71,8 +71,8 @@ class ResourceLoaderUserCSSPrefsModule extends ResourceLoaderModule {
                                ( $options['underline'] ? 'underline' : 'none' ) . "; }";
                } else {
                        # The scripts of these languages are very hard to read with underlines
-                       $rules[] = 'a:lang(ar), a:lang(ckb), a:lang(kk-arab), ' .
-                       'a:lang(mzn), a:lang(ps), a:lang(ur) { text-decoration: none; }';
+                       $rules[] = 'a:lang(ar), a:lang(kk-arab), a:lang(mzn), ' .
+                       'a:lang(ps), a:lang(ur) { text-decoration: none; }';
                }
                if ( $options['justify'] ) {
                        $rules[] = "#article, #bodyContent, #mw_content { text-align: justify; }\n";
index db361aa..f5ecbe1 100644 (file)
@@ -1265,7 +1265,8 @@ If you choose to provide it, this will be used for giving the user attribution f
 'user-mail-no-body'      => 'Tried to send email with an empty or unreasonably short body.',
 
 # Change password dialog
-'resetpass'                 => 'Change password',
+'changepassword'            => 'Change password',
+'changepassword-summary'    => '', # do not translate or duplicate this message to other languages
 'resetpass_announce'        => 'You logged in with a temporary emailed code.
 To finish logging in, you must set a new password here:',
 'resetpass_text'            => '<!-- Add text here -->', # only translate this message to other languages if you have to change it
@@ -1879,8 +1880,6 @@ Note that their indexes of {{SITENAME}} content may be out of date.',
 'mypreferences'                 => 'Preferences',
 'prefs-edits'                   => 'Number of edits:',
 'prefsnologintext2'             => 'Please $1 to set user preferences.',
-'changepassword'                => 'Change password',
-'changepassword-summary'        => '', # do not translate or duplicate this message to other languages
 'prefs-skin'                    => 'Skin',
 'skin-preview'                  => 'Preview',
 'datedefault'                   => 'No preference',
@@ -2813,9 +2812,6 @@ You can narrow down the view by selecting a log type, the username (case-sensiti
 'allpagesto'              => 'Display pages ending at:',
 'allarticles'             => 'All pages',
 'allinnamespace'          => 'All pages ($1 namespace)',
-'allnotinnamespace'       => 'All pages (not in $1 namespace)',
-'allpagesprev'            => 'Previous',
-'allpagesnext'            => 'Next',
 'allpagessubmit'          => 'Go',
 'allpagesprefix'          => 'Display pages with prefix:',
 'allpagesbadtitle'        => 'The given page title was invalid or had an inter-language or inter-wiki prefix.
@@ -3452,7 +3448,6 @@ please be sure you understand the consequences of this before proceeding.",
 In those cases, you will have to move or merge the page manually if desired.",
 'movearticle'                  => 'Move page:',
 'moveuserpage-warning'         => "'''Warning:''' You are about to move a user page. Please note that only the page will be moved and the user will ''not'' be renamed.",
-'movenologin'                  => 'Not logged in',
 'movenologintext'              => 'You must be a registered user and [[Special:UserLogin|logged in]] to move a page.',
 'movenotallowed'               => 'You do not have permission to move pages.',
 'movenotallowedfile'           => 'You do not have permission to move files.',
@@ -3468,9 +3463,6 @@ In those cases, you will have to move or merge the page manually if desired.",
 'articleexists'                => 'A page of that name already exists, or the name you have chosen is not valid.
 Please choose another name.',
 'cantmove-titleprotected'      => 'You cannot move a page to this location because the new title has been protected from creation',
-'talkexists'                   => "'''The page itself was moved successfully, but the talk page could not be moved because one already exists at the new title.
-Please merge them manually.'''",
-'movedto'                      => 'moved to',
 'movetalk'                     => 'Move associated talk page',
 'move-subpages'                => 'Move subpages (up to $1)',
 'move-talk-subpages'           => 'Move subpages of talk page (up to $1)',
index bd85486..f74f78b 100644 (file)
@@ -1593,10 +1593,10 @@ Used on the account creation form when creating another user's account. Similar
 'changepassword-success' => 'Used in [[Special:ChangePassword]].',
 'resetpass_forbidden' => "Used as error message in changing password. Maybe the external auth plugin won't allow local password changes.",
 'resetpass-no-info' => 'Error message for [[Special:ChangePassword]].',
-'resetpass-submit-loggedin' => 'Button on [[Special:ResetPass]] to submit new password.
+'resetpass-submit-loggedin' => 'Button on [[Special:ChangePassword]] to submit new password.
 
 {{Identical|Change password}}',
-'resetpass-submit-cancel' => 'Used on [[Special:ResetPass]].
+'resetpass-submit-cancel' => 'Used on [[Special:ChangePassword]].
 {{Identical|Cancel}}',
 'resetpass-wrong-oldpass' => 'Error message shown on [[Special:ChangePassword]] when the old password is not valid.',
 'resetpass-temp-password' => 'The label of the input box for the temporary password (received by email) on the form displayed after logging in with a temporary password.',
@@ -2951,8 +2951,8 @@ See also:
 'prefs-edits' => 'In user preferences.',
 'prefsnologintext2' => 'Parameters:
 * $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description',
-'changepassword' => "Section heading on [[Special:Preferences]], tab 'User profile'.
-{{Identical|Change password}}",
+'changepassword' => 'Title of [[Special:ChangePassword]].
+{{Identical|Change password}}',
 'prefs-skin' => 'Used in user preferences.
 {{Identical|Skin}}',
 'skin-preview' => '{{doc-actionlink}}
@@ -2982,7 +2982,7 @@ See also:
 'prefs-watchlist-edits-max' => 'Shown as hint in [[Special:Preferences]], tab "Watchlist"',
 'prefs-watchlist-token' => 'Used in [[Special:Preferences]], tab Watchlist.',
 'prefs-misc' => 'Tab used on the [[Special:Preferences|user preferences]] special page.',
-'prefs-resetpass' => 'Button on user data tab in user preferences. When you click the button you go to the special page [[Special:ResetPass]].
+'prefs-resetpass' => 'Button on user data tab in user preferences. When you click the button you go to the special page [[Special:ChangePassword]].
 
 {{Identical|Change password}}',
 'prefs-changeemail' => 'Link on [[Special:Preferences]] to [[Special:ChangeEmail]].
index 1e11da2..450da62 100644 (file)
@@ -571,7 +571,8 @@ $wgMessageStructure = array(
                'user-mail-no-body',
        ),
        'resetpass' => array(
-               'resetpass',
+               'changepassword',
+               'changepassword-summary',
                'resetpass_announce',
                'resetpass_text',
                'resetpass_header',
@@ -1008,8 +1009,6 @@ $wgMessageStructure = array(
                'mypreferences',
                'prefs-edits',
                'prefsnologintext2',
-               'changepassword',
-               'changepassword-summary',
                'prefs-skin',
                'skin-preview',
                'datedefault',
@@ -1869,9 +1868,6 @@ $wgMessageStructure = array(
                'allpagesto',
                'allarticles',
                'allinnamespace',
-               'allnotinnamespace',
-               'allpagesprev',
-               'allpagesnext',
                'allpagessubmit',
                'allpagesprefix',
                'allpagesbadtitle',
@@ -2389,7 +2385,6 @@ $wgMessageStructure = array(
                'movepagetalktext',
                'movearticle',
                'moveuserpage-warning',
-               'movenologin',
                'movenologintext',
                'movenotallowed',
                'movenotallowedfile',
@@ -2404,8 +2399,6 @@ $wgMessageStructure = array(
                'movepage-moved-noredirect',
                'articleexists',
                'cantmove-titleprotected',
-               'talkexists',
-               'movedto',
                'movetalk',
                'move-subpages',
                'move-talk-subpages',
index 9c5b3ca..e486c4f 100644 (file)
@@ -350,52 +350,4 @@ class ApiQueryBasicTest extends ApiQueryTestBase {
                        )
                ) );
        }
-
-       /**
-        * Recursively merges the expected values in the $item into the $all
-        */
-       private function mergeExpected( &$all, $item ) {
-               foreach ( $item as $k => $v ) {
-                       if ( array_key_exists( $k, $all ) ) {
-                               if ( is_array( $all[$k] ) ) {
-                                       $this->mergeExpected( $all[$k], $v );
-                               } else {
-                                       $this->assertEquals( $all[$k], $v );
-                               }
-                       } else {
-                               $all[$k] = $v;
-                       }
-               }
-       }
-
-       /**
-        * Recursively compare arrays, ignoring mismatches in numeric key and pageids.
-        *
-        * @param $expectedArray array expected values
-        * @param $resultArray array returned values
-        */
-       private function assertQueryResults( $expectedArray, $resultArray ) {
-               reset( $expectedArray );
-               reset( $resultArray );
-               while ( true ) {
-                       $expectedValue = each( $expectedArray );
-                       $resultValue = each( $resultArray );
-                       // If either of the arrays is shorter, abort. If both are done, success.
-                       $this->assertEquals( (bool)$expectedValue, (bool)$resultValue );
-                       if ( !$expectedValue ) {
-                               break; // done
-                       }
-                       // continue only if keys are identical or both keys are numeric
-                       $this->assertTrue( $expectedValue['key'] === $resultValue['key'] || ( is_numeric( $expectedValue['key'] ) && is_numeric( $resultValue['key'] ) ) );
-                       // don't compare pageids
-                       if ( $expectedValue['key'] !== 'pageid' ) {
-                               // If values are arrays, compare recursively, otherwise compare with ===
-                               if ( is_array( $expectedValue['value'] ) && is_array( $resultValue['value'] ) ) {
-                                       $this->assertQueryResults( $expectedValue['value'], $resultValue['value'] );
-                               } else {
-                                       $this->assertEquals( $expectedValue['value'], $resultValue['value'] );
-                               }
-                       }
-               }
-       }
 }