https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112941
Revision: 112941
Author: aaron
Date: 2012-03-03 11:54:26 +0000 (Sat, 03 Mar 2012)
Log Message:
-----------
[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
trunk/extensions/FlaggedRevs/business/PageStabilityForm.php
trunk/extensions/FlaggedRevs/frontend/specialpages/actions/Stabilization_body.php
trunk/extensions/FlaggedRevs/frontend/specialpages/reports/StablePages_body.php
Modified: trunk/extensions/FlaggedRevs/backend/FRPageConfig.php
===================================================================
--- trunk/extensions/FlaggedRevs/backend/FRPageConfig.php 2012-03-03
11:50:18 UTC (rev 112940)
+++ trunk/extensions/FlaggedRevs/backend/FRPageConfig.php 2012-03-03
11:54:26 UTC (rev 112941)
@@ -32,8 +32,7 @@
*/
public static function getVisibilitySettingsFromRow( $row ) {
if ( $row ) {
- # This code should be refactored, now that it's being
used more generally.
- $expiry = Block::decodeExpiry( $row->fpc_expiry );
+ $expiry = wfGetDB( DB_SLAVE )->decodeExpiry(
$row->fpc_expiry );
# Only apply the settings if they haven't expired
if ( !$expiry || $expiry < wfTimestampNow() ) {
$row = null; // expired
@@ -49,7 +48,7 @@
$config = array(
'override' => $row->fpc_override ? 1 : 0,
'autoreview' => $level,
- 'expiry' => Block::decodeExpiry(
$row->fpc_expiry ) // TS_MW
+ 'expiry' => $expiry // TS_MW
);
# If there are protection levels defined check if this
is valid...
if ( FlaggedRevs::useProtectionLevels() ) {
@@ -96,7 +95,7 @@
$changed = ( $dbw->affectedRows() != 0 ); // did this
do anything?
# Otherwise, add/replace row if we are not just setting it to
the site default
} else {
- $dbExpiry = Block::encodeExpiry( $config['expiry'],
$dbw );
+ $dbExpiry = $dbw->encodeExpiry( $config['expiry'] );
# Get current config...
$oldRow = $dbw->selectRow( 'flaggedpage_config',
array( 'fpc_override', 'fpc_level',
'fpc_expiry' ),
Modified: trunk/extensions/FlaggedRevs/business/PageStabilityForm.php
===================================================================
--- trunk/extensions/FlaggedRevs/business/PageStabilityForm.php 2012-03-03
11:50:18 UTC (rev 112940)
+++ trunk/extensions/FlaggedRevs/business/PageStabilityForm.php 2012-03-03
11:54:26 UTC (rev 112941)
@@ -87,7 +87,7 @@
$value = $this->expirySelection;
}
if ( $value == 'infinite' || $value == 'indefinite' || $value
== 'infinity' ) {
- $time = Block::infinity();
+ $time = 'infinity';
} else {
$unix = strtotime( $value );
# On error returns -1 for PHP <5.1 and false for PHP
>=5.1
@@ -188,7 +188,7 @@
*/
public function doPreloadParameters() {
$oldConfig = $this->getOldConfig();
- if ( $oldConfig['expiry'] == Block::infinity() ) {
+ if ( $oldConfig['expiry'] == 'infinity' ) {
$this->expirySelection = 'infinite'; // no settings set
OR indefinite
} else {
$this->expirySelection = 'existing'; // settings set
and NOT indefinite
@@ -217,7 +217,7 @@
$expiry = $this->getExpiry();
if ( $expiry === false ) {
return 'stabilize_expiry_invalid';
- } elseif ( $expiry !== Block::infinity() && $expiry <
wfTimestampNow() ) {
+ } elseif ( $expiry !== 'infinity' && $expiry < wfTimestampNow()
) {
return 'stabilize_expiry_old';
}
# Update the DB row with the new config...
Modified:
trunk/extensions/FlaggedRevs/frontend/specialpages/actions/Stabilization_body.php
===================================================================
---
trunk/extensions/FlaggedRevs/frontend/specialpages/actions/Stabilization_body.php
2012-03-03 11:50:18 UTC (rev 112940)
+++
trunk/extensions/FlaggedRevs/frontend/specialpages/actions/Stabilization_body.php
2012-03-03 11:54:26 UTC (rev 112941)
@@ -113,10 +113,10 @@
$showProtectOptions = ( $scExpiryOptions !== '-' &&
$form->isAllowed() );
$dropdownOptions = array(); // array of <label,value>
# Add the current expiry as a dropdown option
- if ( $oldConfig['expiry'] && $oldConfig['expiry'] !=
Block::infinity() ) {
- $timestamp = $this->getLang()->timeanddate(
$oldConfig['expiry'] );
- $d = $this->getLang()->date( $oldConfig['expiry'] );
- $t = $this->getLang()->time( $oldConfig['expiry'] );
+ if ( $oldConfig['expiry'] && $oldConfig['expiry'] != 'infinity'
) {
+ $timestamp = $this->getLanguage()->timeanddate(
$oldConfig['expiry'] );
+ $d = $this->getLanguage()->date( $oldConfig['expiry'] );
+ $t = $this->getLanguage()->time( $oldConfig['expiry'] );
$dropdownOptions[] = array(
wfMsg( 'protect-existing-expiry', $timestamp,
$d, $t ), 'existing' );
}
@@ -239,7 +239,7 @@
</tr>' . Xml::closeElement( 'table' ) .
Html::hidden( 'title',
$this->getTitle()->getPrefixedDBKey() ) .
Html::hidden( 'page', $title->getPrefixedText()
) .
- Html::hidden( 'wpEditToken',
$this->getUser()->editToken() );
+ Html::hidden( 'wpEditToken',
$this->getUser()->getEditToken() );
} else {
$s .= Xml::closeElement( 'table' );
}
Modified:
trunk/extensions/FlaggedRevs/frontend/specialpages/reports/StablePages_body.php
===================================================================
---
trunk/extensions/FlaggedRevs/frontend/specialpages/reports/StablePages_body.php
2012-03-03 11:50:18 UTC (rev 112940)
+++
trunk/extensions/FlaggedRevs/frontend/specialpages/reports/StablePages_body.php
2012-03-03 11:54:26 UTC (rev 112941)
@@ -153,7 +153,7 @@
$conds['page_namespace'] = $this->namespace;
// Be sure not to include expired items
if( $this->indef ) {
- $conds['fpc_expiry'] = Block::infinity();
+ $conds['fpc_expiry'] = $this->mDb->getInfinity();
} else {
$encCutoff = $this->mDb->addQuotes(
$this->mDb->timestamp() );
$conds[] = "fpc_expiry > {$encCutoff}";
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs