r112941 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112940‎ | r112941 | r112942 >
Date:11:54, 3 March 2012
Author:aaron
Status:reverted
Tags:gerritmigration 
Comment:
[FlaggedRevs] Fixed various deprecation notices, cleaning up block expiry handling a bit in the process. Uses r112939.
Modified paths:
  • /trunk/extensions/FlaggedRevs/backend/FRPageConfig.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/business/PageStabilityForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/frontend/specialpages/actions/Stabilization_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/frontend/specialpages/reports/StablePages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/frontend/specialpages/actions/Stabilization_body.php
@@ -113,10 +113,10 @@
114114 $showProtectOptions = ( $scExpiryOptions !== '-' && $form->isAllowed() );
115115 $dropdownOptions = array(); // array of <label,value>
116116 # Add the current expiry as a dropdown option
117 - if ( $oldConfig['expiry'] && $oldConfig['expiry'] != Block::infinity() ) {
118 - $timestamp = $this->getLang()->timeanddate( $oldConfig['expiry'] );
119 - $d = $this->getLang()->date( $oldConfig['expiry'] );
120 - $t = $this->getLang()->time( $oldConfig['expiry'] );
 117+ if ( $oldConfig['expiry'] && $oldConfig['expiry'] != 'infinity' ) {
 118+ $timestamp = $this->getLanguage()->timeanddate( $oldConfig['expiry'] );
 119+ $d = $this->getLanguage()->date( $oldConfig['expiry'] );
 120+ $t = $this->getLanguage()->time( $oldConfig['expiry'] );
121121 $dropdownOptions[] = array(
122122 wfMsg( 'protect-existing-expiry', $timestamp, $d, $t ), 'existing' );
123123 }
@@ -239,7 +239,7 @@
240240 </tr>' . Xml::closeElement( 'table' ) .
241241 Html::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) .
242242 Html::hidden( 'page', $title->getPrefixedText() ) .
243 - Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
 243+ Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
244244 } else {
245245 $s .= Xml::closeElement( 'table' );
246246 }
Index: trunk/extensions/FlaggedRevs/frontend/specialpages/reports/StablePages_body.php
@@ -153,7 +153,7 @@
154154 $conds['page_namespace'] = $this->namespace;
155155 // Be sure not to include expired items
156156 if( $this->indef ) {
157 - $conds['fpc_expiry'] = Block::infinity();
 157+ $conds['fpc_expiry'] = $this->mDb->getInfinity();
158158 } else {
159159 $encCutoff = $this->mDb->addQuotes( $this->mDb->timestamp() );
160160 $conds[] = "fpc_expiry > {$encCutoff}";
Index: trunk/extensions/FlaggedRevs/backend/FRPageConfig.php
@@ -32,8 +32,7 @@
3333 */
3434 public static function getVisibilitySettingsFromRow( $row ) {
3535 if ( $row ) {
36 - # This code should be refactored, now that it's being used more generally.
37 - $expiry = Block::decodeExpiry( $row->fpc_expiry );
 36+ $expiry = wfGetDB( DB_SLAVE )->decodeExpiry( $row->fpc_expiry );
3837 # Only apply the settings if they haven't expired
3938 if ( !$expiry || $expiry < wfTimestampNow() ) {
4039 $row = null; // expired
@@ -49,7 +48,7 @@
5049 $config = array(
5150 'override' => $row->fpc_override ? 1 : 0,
5251 'autoreview' => $level,
53 - 'expiry' => Block::decodeExpiry( $row->fpc_expiry ) // TS_MW
 52+ 'expiry' => $expiry // TS_MW
5453 );
5554 # If there are protection levels defined check if this is valid...
5655 if ( FlaggedRevs::useProtectionLevels() ) {
@@ -96,7 +95,7 @@
9796 $changed = ( $dbw->affectedRows() != 0 ); // did this do anything?
9897 # Otherwise, add/replace row if we are not just setting it to the site default
9998 } else {
100 - $dbExpiry = Block::encodeExpiry( $config['expiry'], $dbw );
 99+ $dbExpiry = $dbw->encodeExpiry( $config['expiry'] );
101100 # Get current config...
102101 $oldRow = $dbw->selectRow( 'flaggedpage_config',
103102 array( 'fpc_override', 'fpc_level', 'fpc_expiry' ),
Index: trunk/extensions/FlaggedRevs/business/PageStabilityForm.php
@@ -87,7 +87,7 @@
8888 $value = $this->expirySelection;
8989 }
9090 if ( $value == 'infinite' || $value == 'indefinite' || $value == 'infinity' ) {
91 - $time = Block::infinity();
 91+ $time = 'infinity';
9292 } else {
9393 $unix = strtotime( $value );
9494 # On error returns -1 for PHP <5.1 and false for PHP >=5.1
@@ -188,7 +188,7 @@
189189 */
190190 public function doPreloadParameters() {
191191 $oldConfig = $this->getOldConfig();
192 - if ( $oldConfig['expiry'] == Block::infinity() ) {
 192+ if ( $oldConfig['expiry'] == 'infinity' ) {
193193 $this->expirySelection = 'infinite'; // no settings set OR indefinite
194194 } else {
195195 $this->expirySelection = 'existing'; // settings set and NOT indefinite
@@ -217,7 +217,7 @@
218218 $expiry = $this->getExpiry();
219219 if ( $expiry === false ) {
220220 return 'stabilize_expiry_invalid';
221 - } elseif ( $expiry !== Block::infinity() && $expiry < wfTimestampNow() ) {
 221+ } elseif ( $expiry !== 'infinity' && $expiry < wfTimestampNow() ) {
222222 return 'stabilize_expiry_old';
223223 }
224224 # Update the DB row with the new config...

Follow-up revisions

RevisionCommit summaryAuthorDate
r114402Revert r112773, r112941, r112942, r113389: unreviewed revisions in FlaggedRevs....catrope20:30, 21 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112939[DatabaseBase] Made encodeExpiry() recognize 'infinity' and added a decodeExp...aaron11:49, 3 March 2012

Status & tagging log