r63690 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63689‎ | r63690 | r63691 >
Date:17:10, 13 March 2010
Author:aaron
Status:ok
Tags:
Comment:
Follow up r63674: deal with 'infinity' correctly
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -1171,31 +1171,32 @@
11721172 __METHOD__
11731173 );
11741174 if ( $row ) {
1175 - $now = wfTimestampNow();
11761175 # This code should be refactored, now that it's being used more generally.
11771176 $expiry = Block::decodeExpiry( $row->fpc_expiry );
11781177 # Only apply the settings if they haven't expired
1179 - if ( !$expiry || $expiry < $now ) {
 1178+ if ( !$expiry || $expiry < wfTimestampNow() ) {
11801179 $row = null; // expired
11811180 self::purgeExpiredConfigurations();
11821181 self::titleLinksUpdate( $title ); // re-find stable version
11831182 $title->invalidateCache(); // purge squid/memcached
11841183 }
11851184 }
1186 - # Return the default config if this page doesn't have its own
1187 - if ( !$row ) {
 1185+ // Is there a non-expired row?
 1186+ if ( $row ) {
 1187+ $config = array(
 1188+ 'select' => intval( $row->fpc_select ),
 1189+ 'override' => $row->fpc_override,
 1190+ 'autoreview' => $row->fpc_level,
 1191+ 'expiry' => Block::decodeExpiry( $row->fpc_expiry )
 1192+ );
 1193+ # If there are protection levels defined check if this is valid
 1194+ if ( self::useProtectionLevels() && self::getProtectionLevel( $config ) == 'invalid' ) {
 1195+ return self::getDefaultVisibilitySettings(); // revert to none
 1196+ }
 1197+ } else {
 1198+ # Return the default config if this page doesn't have its own
11881199 return self::getDefaultVisibilitySettings();
11891200 }
1190 - $config = array(
1191 - 'select' => intval( $row->fpc_select ),
1192 - 'override' => $row->fpc_override,
1193 - 'autoreview' => $row->fpc_level,
1194 - 'expiry' => wfTimestamp( TS_MW, $row->fpc_expiry )
1195 - );
1196 - # If there are protection levels defined check if this is valid
1197 - if ( self::useProtectionLevels() && self::getProtectionLevel( $config ) == 'invalid' ) {
1198 - return self::getDefaultVisibilitySettings(); // revert to none
1199 - }
12001201 return $config;
12011202 }
12021203
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -517,7 +517,7 @@
518518 # Otherwise, add a row unless we are just setting it as the site default,
519519 # or it is the same the current one...
520520 } elseif ( !$reset ) {
521 - $dbExpiry = $dbw->timestamp( $this->expiry );
 521+ $dbExpiry = Block::encodeExpiry( $this->expiry, $dbw );
522522 if ( !$oldRow // no previous config, or...
523523 || $oldRow->fpc_select != $this->select // ...precedence changed, or...
524524 || $oldRow->fpc_override != $this->override // ...override changed, or...

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r63674* Stabilization submit() fixes and refactoring...aaron13:52, 13 March 2010

Status & tagging log