summaryrefslogtreecommitdiff
path: root/includes/api/ApiProtect.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiProtect.php')
-rw-r--r--includes/api/ApiProtect.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php
index 3a1d18e0..5556262e 100644
--- a/includes/api/ApiProtect.php
+++ b/includes/api/ApiProtect.php
@@ -1,10 +1,10 @@
<?php
/**
- * API for MediaWiki 1.8+
+ *
*
* Created on Sep 1, 2007
*
- * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -63,6 +63,7 @@ class ApiProtect extends ApiBase {
}
$restrictionTypes = $titleObj->getRestrictionTypes();
+ $dbr = wfGetDB( DB_SLAVE );
$protections = array();
$expiryarray = array();
@@ -72,10 +73,10 @@ class ApiProtect extends ApiBase {
$protections[$p[0]] = ( $p[1] == 'all' ? '' : $p[1] );
if ( $titleObj->exists() && $p[0] == 'create' ) {
- $this->dieUsageMsg( array( 'create-titleexists' ) );
+ $this->dieUsageMsg( 'create-titleexists' );
}
if ( !$titleObj->exists() && $p[0] != 'create' ) {
- $this->dieUsageMsg( array( 'missingtitle-createonly' ) );
+ $this->dieUsageMsg( 'missingtitle-createonly' );
}
if ( !in_array( $p[0], $restrictionTypes ) && $p[0] != 'create' ) {
@@ -86,7 +87,7 @@ class ApiProtect extends ApiBase {
}
if ( in_array( $expiry[$i], array( 'infinite', 'indefinite', 'never' ) ) ) {
- $expiryarray[$p[0]] = Block::infinity();
+ $expiryarray[$p[0]] = $dbr->getInfinity();
} else {
$exp = strtotime( $expiry[$i] );
if ( $exp < 0 || !$exp ) {
@@ -100,7 +101,7 @@ class ApiProtect extends ApiBase {
$expiryarray[$p[0]] = $exp;
}
$resultProtections[] = array( $p[0] => $protections[$p[0]],
- 'expiry' => ( $expiryarray[$p[0]] == Block::infinity() ?
+ 'expiry' => ( $expiryarray[$p[0]] == $dbr->getInfinity() ?
'infinite' :
wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) );
}
@@ -129,8 +130,9 @@ class ApiProtect extends ApiBase {
$res['cascade'] = '';
}
$res['protections'] = $resultProtections;
- $this->getResult()->setIndexedTagName( $res['protections'], 'protection' );
- $this->getResult()->addValue( null, $this->getModuleName(), $res );
+ $result = $this->getResult();
+ $result->setIndexedTagName( $res['protections'], 'protection' );
+ $result->addValue( null, $this->getModuleName(), $res );
}
public function mustBePosted() {
@@ -222,7 +224,11 @@ class ApiProtect extends ApiBase {
);
}
+ public function getHelpUrls() {
+ return 'https://www.mediawiki.org/wiki/API:Protect';
+ }
+
public function getVersion() {
- return __CLASS__ . ': $Id: ApiProtect.php 77192 2010-11-23 22:05:27Z btongminh $';
+ return __CLASS__ . ': $Id: ApiProtect.php 104449 2011-11-28 15:52:04Z reedy $';
}
}