Merge "Add curly braces to while"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 14 Oct 2015 16:56:10 +0000 (16:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 14 Oct 2015 16:56:10 +0000 (16:56 +0000)
17 files changed:
docs/hooks.txt
includes/GlobalFunctions.php
includes/Title.php
includes/changes/ChangesList.php
includes/changes/EnhancedChangesList.php
includes/diff/DairikiDiff.php
includes/exception/MWExceptionHandler.php
includes/media/FormatMetadata.php
includes/mime.info
includes/mime.types
includes/page/WikiPage.php
includes/specials/SpecialUserrights.php
languages/i18n/en.json
languages/i18n/qqq.json
tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php
tests/phpunit/includes/debug/MWDebugTest.php

index 0e76d58..8d36603 100644 (file)
@@ -575,6 +575,7 @@ $error: if the deletion was prohibited, the (raw HTML) error message to display
   (added in 1.13)
 $status: Status object, modify this to throw an error. Overridden by $error
   (added in 1.20)
+$suppress: Whether this is a suppression deletion or not (added in 1.27)
 
 'ArticleDeleteAfterSuccess': Output after an article has been deleted.
 $title: Title of the article that has been deleted.
index 14327dc..8f2d43b 100644 (file)
@@ -1985,8 +1985,11 @@ function wfGetAllCallers( $limit = 3 ) {
  * @return string
  */
 function wfFormatStackFrame( $frame ) {
-       return isset( $frame['class'] ) ?
-               $frame['class'] . '::' . $frame['function'] :
+       if ( !isset( $frame['function'] ) ) {
+               return 'NO_FUNCTION_GIVEN';
+       }
+       return isset( $frame['class'] ) && isset( $frame['type'] ) ?
+               $frame['class'] . $frame['type'] . $frame['function'] :
                $frame['function'];
 }
 
index 7fb2b06..9ada4f3 100644 (file)
@@ -1418,6 +1418,7 @@ class Title {
         * Deprecated for public use, use Title::makeTitle() with fragment parameter.
         * Still in active use privately.
         *
+        * @private
         * @param string $fragment Text
         */
        public function setFragment( $fragment ) {
index fdc9944..01f10d8 100644 (file)
@@ -76,6 +76,21 @@ class ChangesList extends ContextSource {
                }
        }
 
+       /**
+        * Format a line
+        *
+        * @since 1.27
+        *
+        * @param RecentChange $rc Passed by reference
+        * @param bool $watched (default false)
+        * @param int $linenumber (default null)
+        *
+        * @return string|bool
+        */
+       public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
+               throw new RuntimeException( 'recentChangesLine should be implemented' );
+       }
+
        /**
         * Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag
         * @param bool $value
index 1dcb7ae..f10307d 100644 (file)
@@ -83,15 +83,16 @@ class EnhancedChangesList extends ChangesList {
        /**
         * Format a line for enhanced recentchange (aka with javascript and block of lines).
         *
-        * @param RecentChange $baseRC
+        * @param RecentChange $rc
         * @param bool $watched
+        * @param int $linenumber (default null)
         *
         * @return string
         */
-       public function recentChangesLine( &$baseRC, $watched = false ) {
+       public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
 
                $date = $this->getLanguage()->userDate(
-                       $baseRC->mAttribs['rc_timestamp'],
+                       $rc->mAttribs['rc_timestamp'],
                        $this->getUser()
                );
 
@@ -106,7 +107,7 @@ class EnhancedChangesList extends ChangesList {
                        $this->lastdate = $date;
                }
 
-               $cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $baseRC, $watched );
+               $cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $rc, $watched );
                $this->addCacheEntry( $cacheEntry );
 
                return $ret;
index d327433..14810da 100644 (file)
@@ -420,7 +420,7 @@ class DiffEngine {
                        }
 
                        $x1 = $xoff + (int)( ( $numer + ( $xlim - $xoff ) * $chunk ) / $nchunks );
-                       // @codingStandardsIgnoreFile Ignore Squiz.WhiteSpace.SemicolonSpacing.Incorrect
+                       // @codingStandardsIgnoreStart Ignore Squiz.WhiteSpace.SemicolonSpacing.Incorrect
                        for ( ; $x < $x1; $x++ ) {
                                // @codingStandardsIgnoreEnd
                                $line = $flip ? $this->yv[$x] : $this->xv[$x];
@@ -444,7 +444,7 @@ class DiffEngine {
                                        if ( $y > $this->seq[$k - 1] ) {
                                                assert( '$y < $this->seq[$k]' );
                                                // Optimization: this is a common case:
-                                               //      next match is just replacing previous match.
+                                               // next match is just replacing previous match.
                                                $this->in_seq[$this->seq[$k]] = false;
                                                $this->seq[$k] = $y;
                                                $this->in_seq[$y] = 1;
index 4e50070..5734902 100644 (file)
@@ -380,10 +380,12 @@ TXT;
                                $text .= "{$pad}#{$level} [internal function]: ";
                        }
 
-                       if ( isset( $frame['class'] ) ) {
+                       if ( isset( $frame['class'] ) && isset( $frame['type'] ) && isset( $frame['function'] ) ) {
                                $text .= $frame['class'] . $frame['type'] . $frame['function'];
-                       } else {
+                       } elseif ( isset( $frame['function'] ) ) {
                                $text .= $frame['function'];
+                       } else {
+                               $text .= 'NO_FUNCTION_GIVEN';
                        }
 
                        if ( isset( $frame['args'] ) ) {
index a1cb01c..5b57821 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-// @codingStandardsIgnoreFile
-// PHPCS can't handle the level of nesting in this file
 /**
  * Formatting of image metadata values into human readable form.
  *
index 840b9d8..999be92 100644 (file)
@@ -76,7 +76,7 @@ application/x-bzip2   [ARCHIVE]
 application/x-tar      [ARCHIVE]
 application/x-stuffit  [ARCHIVE]
 application/x-opc+zip  [ARCHIVE]
-
+application/x-7z-compressed [ARCHIVE]
 
 text/javascript application/x-javascript application/x-ecmascript text/ecmascript      [EXECUTABLE]
 application/x-bash     [EXECUTABLE]
index 210610a..3b9899f 100644 (file)
@@ -20,6 +20,7 @@ application/vnd.wap.wbxml wbxml
 application/vnd.wap.wmlc wmlc
 application/vnd.wap.wmlscriptc wmlsc
 application/voicexml+xml vxml
+application/x-7z-compressed 7z
 application/x-bcpio bcpio
 application/x-bzip bz
 application/x-bzip2 bz2
index d656bad..ee13ea3 100644 (file)
@@ -2780,7 +2780,7 @@ class WikiPage implements Page, IDBAccessObject {
 
                $user = is_null( $user ) ? $wgUser : $user;
                if ( !Hooks::run( 'ArticleDelete',
-                       array( &$this, &$user, &$reason, &$error, &$status )
+                       array( &$this, &$user, &$reason, &$error, &$status, $suppress )
                ) ) {
                        if ( $status->isOK() ) {
                                // Hook aborted but didn't set a fatal status
index 1ed392f..a6fe1b5 100644 (file)
@@ -31,6 +31,10 @@ class UserrightsPage extends SpecialPage {
        # either a GET parameter or a subpage-style parameter, so have a member
        # variable for it.
        protected $mTarget;
+       /*
+        * @var null|User $mFetchedUser The user object of the target username or null.
+        */
+       protected $mFetchedUser = null;
        protected $isself = false;
 
        public function __construct() {
@@ -75,6 +79,8 @@ class UserrightsPage extends SpecialPage {
                // any groups, it's a bit silly to give them the user search prompt.
 
                $user = $this->getUser();
+               $request = $this->getRequest();
+               $out = $this->getOutput();
 
                /*
                 * If the user is blocked and they only have "partial" access
@@ -85,8 +91,6 @@ class UserrightsPage extends SpecialPage {
                        throw new UserBlockedError( $user->getBlock() );
                }
 
-               $request = $this->getRequest();
-
                if ( $par !== null ) {
                        $this->mTarget = $par;
                } else {
@@ -110,13 +114,17 @@ class UserrightsPage extends SpecialPage {
                        $this->isself = true;
                }
 
+               $fetchedStatus = $this->fetchUser( $this->mTarget );
+               if ( $fetchedStatus->isOk() ) {
+                       $this->mFetchedUser = $fetchedStatus->value;
+               }
+
                if ( !$this->userCanChangeRights( $user, true ) ) {
                        if ( $this->isself && $request->getCheck( 'success' ) ) {
                                // bug 48609: if the user just removed its own rights, this would
                                // leads it in a "permissions error" page. In that case, show a
                                // message that it can't anymore use this page instead of an error
                                $this->setHeaders();
-                               $out = $this->getOutput();
                                $out->wrapWikiMsg( "<div class=\"successbox\">\n$1\n</div>", 'userrights-removed-self' );
                                $out->returnToMain();
 
@@ -128,12 +136,19 @@ class UserrightsPage extends SpecialPage {
                        throw new PermissionsError( null, array( array( $msg ) ) );
                }
 
+               // show a successbox, if the user rights was saved successfully
+               if ( $request->getCheck( 'success' ) && $this->mFetchedUser !== null ) {
+                       $out->wrapWikiMsg(
+                               "<div class=\"successbox\">\n$1\n</div>",
+                               array( 'savedrights', $this->mFetchedUser->getName() )
+                       );
+               }
+
                $this->checkReadOnly();
 
                $this->setHeaders();
                $this->outputHeader();
 
-               $out = $this->getOutput();
                $out->addModuleStyles( 'mediawiki.special' );
                $this->addHelpLink( 'Help:Assigning permissions' );
 
@@ -149,14 +164,13 @@ class UserrightsPage extends SpecialPage {
                        $user->matchEditToken( $request->getVal( 'wpEditToken' ), $this->mTarget )
                ) {
                        // save settings
-                       $status = $this->fetchUser( $this->mTarget );
-                       if ( !$status->isOK() ) {
-                               $this->getOutput()->addWikiText( $status->getWikiText() );
+                       if ( !$fetchedStatus->isOK() ) {
+                               $this->getOutput()->addWikiText( $fetchedStatus->getWikiText() );
 
                                return;
                        }
 
-                       $targetUser = $status->value;
+                       $targetUser = $this->mFetchedUser;
                        if ( $targetUser instanceof User ) { // UserRightsProxy doesn't have this method (bug 61252)
                                $targetUser->clearInstanceCache(); // bug 38989
                        }
index 3845370..8f4ef96 100644 (file)
        "prefs-help-recentchangescount": "This includes recent changes, page histories, and logs.",
        "prefs-help-watchlist-token2": "This is the secret key to the web feed of your watchlist.\nAnyone who knows it will be able to read your watchlist, so do not share it.\nIf you need to, [[Special:ResetTokens|you can reset it]].",
        "savedprefs": "Your preferences have been saved.",
+       "savedrights": "The user rights of {{GENDER:$1|$1}} have been saved.",
        "timezonelegend": "Time zone:",
        "localtime": "Local time:",
        "timezoneuseserverdefault": "Use wiki default ($1)",
index 6b593ce..95bd205 100644 (file)
        "prefs-help-recentchangescount": "Used in [[Special:Preferences]], tab \"Recent changes\".",
        "prefs-help-watchlist-token2": "Used in [[Special:Preferences]], tab Watchlist. (Formerly in {{msg-mw|prefs-help-watchlist-token}}.)",
        "savedprefs": "This message appears after saving changes to your user preferences.",
+       "savedrights": "This message appears after saving the user rights on [[Special:UserRights]].\n* $1 - The user name of the user which rights was saved.",
        "timezonelegend": "{{Identical|Time zone}}",
        "localtime": "Used as label in [[Special:Preferences#mw-prefsection-datetime|preferences]].",
        "timezoneuseserverdefault": "[[Special:Preferences]] > Date and time > Time zone\n\nThis option lets your time zone setting use the one that is used on the wiki (often UTC).\n\nParameters:\n* $1 - timezone name, or timezone offset (in \"%+03d:%02d\" format)",
index e39e02f..33479c6 100644 (file)
@@ -583,7 +583,6 @@ class GlobalTest extends MediaWikiTestCase {
                        // if you hack it just right are kinda pathological,
                        // and unreliable cross-platform or on IE which means they're
                        // unlikely to appear on intranets.
-                       //
                        // Those will survive the algorithm but with results that
                        // are less consistent.
 
index bb2b33f..8a7bfa5 100644 (file)
@@ -6,7 +6,7 @@
  */
 class WfGetCallerTest extends MediaWikiTestCase {
        public function testZero() {
-               $this->assertEquals( __METHOD__, wfGetCaller( 1 ) );
+               $this->assertEquals( 'WfGetCallerTest->testZero', wfGetCaller( 1 ) );
        }
 
        function callerOne() {
@@ -14,10 +14,10 @@ class WfGetCallerTest extends MediaWikiTestCase {
        }
 
        public function testOne() {
-               $this->assertEquals( 'WfGetCallerTest::testOne', self::callerOne() );
+               $this->assertEquals( 'WfGetCallerTest->testOne', self::callerOne() );
        }
 
-       function intermediateFunction( $level = 2, $n = 0 ) {
+       static function intermediateFunction( $level = 2, $n = 0 ) {
                if ( $n > 0 ) {
                        return self::intermediateFunction( $level, $n - 1 );
                }
@@ -26,11 +26,11 @@ class WfGetCallerTest extends MediaWikiTestCase {
        }
 
        public function testTwo() {
-               $this->assertEquals( 'WfGetCallerTest::testTwo', self::intermediateFunction() );
+               $this->assertEquals( 'WfGetCallerTest->testTwo', self::intermediateFunction() );
        }
 
        public function testN() {
-               $this->assertEquals( 'WfGetCallerTest::testN', self::intermediateFunction( 2, 0 ) );
+               $this->assertEquals( 'WfGetCallerTest->testN', self::intermediateFunction( 2, 0 ) );
                $this->assertEquals(
                        'WfGetCallerTest::intermediateFunction',
                        self::intermediateFunction( 1, 0 )
index 7280a97..3497c88 100644 (file)
@@ -29,7 +29,7 @@ class MWDebugTest extends MediaWikiTestCase {
                        array( array(
                                'msg' => 'logging a string',
                                'type' => 'log',
-                               'caller' => __METHOD__,
+                               'caller' => 'MWDebugTest->testAddLog',
                        ) ),
                        MWDebug::getLog()
                );