Merge "Use ManualLogEntry instead of LogPage to add a new log entry of old file versi...
authorNikerabbit <niklas.laxstrom@gmail.com>
Mon, 2 Jul 2012 14:19:56 +0000 (14:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 2 Jul 2012 14:19:56 +0000 (14:19 +0000)
RELEASE-NOTES-1.20
includes/ChangesList.php
includes/ScopedPHPTimeout.php
includes/actions/HistoryAction.php
languages/Language.php
languages/messages/MessagesEn.php
resources/mediawiki.special/mediawiki.special.changeslist.css
tests/phpunit/includes/TimeAdjustTest.php
tests/phpunit/includes/TitlePermissionTest.php

index 021e4e8..3a373ff 100644 (file)
@@ -78,6 +78,10 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
   Will be null on previewing a page being created.
 * (bug 37627) UserNotLoggedIn() exception to show a generic error page whenever
   a user is not logged in.
+* Watched status in changes lists are no longer indicated by <strong></strong>
+  tags with class "mw-watched". Instead, each line now has a class
+  "mw-changeslist-line-watched" or "mw-changeslist-line-not-watched", and the
+  title itself is surrounded by <span></span> tags with class "mw-title".
 
 === Bug fixes in 1.20 ===
 * (bug 30245) Use the correct way to construct a log page title.
index e5be12d..da56050 100644 (file)
@@ -192,6 +192,7 @@ class ChangesList extends ContextSource {
                $this->rcCacheIndex = 0;
                $this->lastdate = '';
                $this->rclistOpen = false;
+               $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
                return '';
        }
 
@@ -369,10 +370,8 @@ class ChangesList extends ContextSource {
                if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
                        $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
                }
-               # Bolden pages watched by this user
-               if( $watched ) {
-                       $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
-               }
+               # To allow for boldening pages watched by this user
+               $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
                # RTL/LTR marker
                $articlelink .= $this->getLanguage()->getDirMark();
 
@@ -588,6 +587,10 @@ class OldChangesList extends ChangesList {
                        }
                }
 
+               // Indicate watched status on the line to allow for more
+               // comprehensive styling.
+               $classes[] = $watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
+
                // Moved pages (very very old, not supported anymore)
                if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
                // Log entries
@@ -837,14 +840,16 @@ class EnhancedChangesList extends ChangesList {
                wfProfileIn( __METHOD__ );
 
                # Add the namespace and title of the block as part of the class
+               $classes = array( 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' );
                if ( $block[0]->mAttribs['rc_log_type'] ) {
                        # Log entry
-                       $classes = 'mw-collapsible mw-collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-'
+                       $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
                                        . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] );
                } else {
-                       $classes = 'mw-collapsible mw-collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns'
+                       $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
                                        . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
                }
+               $classes[] = $block[0]->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
                $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
                        Html::openElement( 'tr' );
 
@@ -1148,14 +1153,16 @@ class EnhancedChangesList extends ChangesList {
 
                $type = $rcObj->mAttribs['rc_type'];
                $logType = $rcObj->mAttribs['rc_log_type'];
+               $classes = array( 'mw-enhanced-rc' );
                if( $logType ) {
                        # Log entry
-                       $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-'
+                       $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
                                        . $logType . '-' . $rcObj->mAttribs['rc_title'] );
                } else {
-                       $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' .
+                       $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
                                        $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
                }
+               $classes[] = $rcObj->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
                $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
                        Html::openElement( 'tr' );
 
index 359b20b..d1493c3 100644 (file)
 
 /**
  * Class to expand PHP execution time for a function call.
+ * Use this when performing changes that should not be interrupted.
+ *
  * On construction, set_time_limit() is called and set to $seconds.
+ * If the client aborts the connection, PHP will continue to run.
  * When the object goes out of scope, the timer is restarted, with
  * the original time limit minus the time the object existed.
  */
 class ScopedPHPTimeout {
        protected $startTime; // float; seconds
        protected $oldTimeout; // integer; seconds
+       protected $oldIgnoreAbort; // boolean
 
        protected static $stackDepth = 0; // integer
        protected static $totalCalls = 0; // integer
@@ -50,6 +54,7 @@ class ScopedPHPTimeout {
                        } elseif ( self::$stackDepth > 0 ) { // recursion guard
                                trigger_error( "Resursive invocation of " . __CLASS__ . " attempted." );
                        } else {
+                               $this->oldIgnoreAbort = ignore_user_abort( true );
                                $this->oldTimeout = ini_set( 'max_execution_time', $seconds );
                                $this->startTime = microtime( true );
                                ++self::$stackDepth;
@@ -73,6 +78,7 @@ class ScopedPHPTimeout {
                        // take some measures to prevent this. Track total time and calls.
                        self::$totalElapsed += $elapsed;
                        --self::$stackDepth;
+                       ignore_user_abort( $this->oldIgnoreAbort );
                }
        }
 }
index 50d210f..0c5560a 100644 (file)
@@ -635,6 +635,7 @@ class HistoryPager extends ReverseChronologicalPager {
 
                if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
                        $s2 .= ' <span class="updatedmarker">' .  $this->msg( 'updatedmarker' )->escaped() . '</span>';
+                       $classes[] = 'mw-history-line-updated';
                }
 
                $tools = array();
index b026fad..b531f2a 100644 (file)
@@ -1758,7 +1758,7 @@ class Language {
         * @return int
         */
        function userAdjust( $ts, $tz = false ) {
-               global $wgUser, $wgLocaltimezone, $wgLocalTZoffset;
+               global $wgUser, $wgLocalTZoffset;
 
                if ( $tz === false ) {
                        $tz = $wgUser->getOption( 'timecorrection' );
@@ -1766,18 +1766,6 @@ class Language {
 
                $data = explode( '|', $tz, 3 );
 
-               if ( $data[0] == 'System' || $tz == '' ) {
-                       # Global timezone
-                       if ( isset( $wgLocaltimezone ) ) {
-                               $data[0] = 'ZoneInfo';
-                               $data[2] = $wgLocaltimezone;
-                       }
-                       #  Global offset in minutes.
-                       if ( isset( $wgLocalTZoffset ) ) {
-                               $data[1] = $wgLocalTZoffset;
-                       }
-               }
-
                if ( $data[0] == 'ZoneInfo' ) {
                        wfSuppressWarnings();
                        $userTZ = timezone_open( $data[2] );
@@ -1793,7 +1781,12 @@ class Language {
                }
 
                $minDiff = 0;
-               if ( $data[0] == 'Offset' ) {
+               if ( $data[0] == 'System' || $tz == '' ) {
+                       #  Global offset in minutes.
+                       if ( isset( $wgLocalTZoffset ) ) {
+                               $minDiff = $wgLocalTZoffset;
+                       }
+               } elseif ( $data[0] == 'Offset' ) {
                        $minDiff = intval( $data[1] );
                } else {
                        $data = explode( ':', $tz );
index c7d1ed0..6a96c2d 100644 (file)
@@ -4639,7 +4639,7 @@ You can also [[Special:EditWatchlist|use the standard editor]].',
 'version-svn-revision'          => '(r$2)', # only translate this message to other languages if you have to change it
 'version-license'               => 'License',
 'version-poweredby-credits'     => "This wiki is powered by '''[//www.mediawiki.org/ MediaWiki]''', copyright © 2001-$1 $2.",
-'version-poweredby-others'      => 'others',
+'version-poweredby-others'      => '[{{SERVER}}{{SCRIPTPATH}}/CREDITS others]',
 'version-license-info'          => 'MediaWiki is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 
 MediaWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
index cdc9704..8a5421e 100644 (file)
@@ -57,3 +57,7 @@ table.mw-enhanced-rc td.mw-enhanced-rc-nested {
        /* @embed */
        background: url(images/arrow-expanded.png) no-repeat left center;
 }
+
+.mw-changeslist-line-watched .mw-title {
+       font-weight: bold;
+}
index 31304f3..cd027c5 100644 (file)
@@ -1,47 +1,31 @@
 <?php
 
 class TimeAdjustTest extends MediaWikiLangTestCase {
-       static $offset, $timezone;
+       static $offset;
 
        public function setUp() {
                parent::setUp();
-               global $wgLocalTZoffset, $wgLocaltimezone;
+               global $wgLocalTZoffset;
                self::$offset = $wgLocalTZoffset;
-               self::$timezone = $wgLocaltimezone;
 
                $this->iniSet( 'precision', 15 );
        }
 
        public function tearDown() {
-               global $wgLocalTZoffset, $wgLocaltimezone;
+               global $wgLocalTZoffset;
                $wgLocalTZoffset = self::$offset;
-               $wgLocaltimezone = self::$timezone;
                parent::tearDown();
        }
 
-       /**
-        * Test offset usage for a given language::userAdjust
-        * @dataProvider dataUserAdjustWithOffset
-        */
-       function testUserAdjustWithOffset( $inputDate, $offset, $expectedDate ) {
-               global $wgLocalTZoffset, $wgLocaltimezone, $wgContLang;
+       # Test offset usage for a given language::userAdjust
+       function testUserAdjust() {
+               global $wgLocalTZoffset, $wgContLang;
 
                $wgContLang = $en = Language::factory( 'en' );
 
-               $wgLocaltimezone = 'DummyTimezoneSoUserAdjustWillUseTzOffset';
-               $wgLocalTZoffset = $offset;
-
-               $this->assertEquals(
-                       strval( $expectedDate ),
-                       strval( $en->userAdjust( $inputDate, '' ) ),
-                       "User adjust {$inputDate} by {$offset} minutes should give {$expectedDate}"
-               );
-       }
-
-       function dataUserAdjustWithOffset() {
                #  Collection of parameters for Language_t_Offset.
                # Format: date to be formatted, localTZoffset value, expected date
-               return array(
+               $userAdjust_tests = array(
                        array( 20061231235959,   0, 20061231235959 ),
                        array( 20061231235959,   5, 20070101000459 ),
                        array( 20061231235959,  15, 20070101001459 ),
@@ -53,32 +37,15 @@ class TimeAdjustTest extends MediaWikiLangTestCase {
                        array( 20061231235959, -30, 20061231232959 ),
                        array( 20061231235959, -60, 20061231225959 ),
                );
-       }
-
-       /**
-        * Test timezone usage for a given language::userAdjust
-        * @dataProvider dataUserAdjustWithTimezone
-        */
-       function testUserAdjustWithTimezone( $inputDate, $timezone, $expectedDate ) {
-               global $wgLocalTZoffset, $wgLocaltimezone;
 
-               $wgContLang = $en = Language::factory( 'en' );
+               foreach ( $userAdjust_tests as $data ) {
+                       $wgLocalTZoffset = $data[1];
 
-               $wgLocaltimezone = $timezone;
-               $wgLocalTZoffset = 0;
-
-               $this->assertEquals(
-                       strval( $expectedDate ),
-                       strval( $en->userAdjust( $inputDate, '' ) ),
-                       "User adjust {$inputDate} with timezone {$timezone} should give {$expectedDate}"
-               );
-       }
-
-       function dataUserAdjustWithTimezone() {
-               return array(
-                       array( 20111028233711, 'Europe/Warsaw', 20111029013711 ),
-                       array( 20111108205929, 'Europe/Warsaw', 20111108215929 ),
-               );
+                       $this->assertEquals(
+                               strval( $data[2] ),
+                               strval( $en->userAdjust( $data[0], '' ) ),
+                               "User adjust {$data[0]} by {$data[1]} minutes should give {$data[2]}"
+                       );
+               }
        }
-
 }
index 6cf33f1..f62ac5d 100644 (file)
@@ -643,10 +643,8 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                // quickUserCan should ignore user blocks
                $this->assertEquals( true, $this->title->quickUserCan( 'move-target' ) );
 
-               global $wgLocalTZoffset, $wgLocaltimezone;
+               global $wgLocalTZoffset;
                $wgLocalTZoffset = -60;
-               $wgLocaltimezone = 'DummyTimezoneSoUserAdjustWillUseTzOffset';
-
                $this->user->mBlockedby = $this->user->getName();
                $this->user->mBlock = new Block( '127.0.8.1', 0, 1, 'no reason given', $now, 0, 10 );
                $this->assertEquals( array( array( 'blockedtext',