summaryrefslogtreecommitdiff
path: root/includes/api/ApiProtect.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
commit370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch)
tree491674f4c242e4d6ba0d04eafa305174c35a3391 /includes/api/ApiProtect.php
parentf4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff)
Update auf 1.13.0
Diffstat (limited to 'includes/api/ApiProtect.php')
-rw-r--r--includes/api/ApiProtect.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php
index 40a4b73d..30bcfdbc 100644
--- a/includes/api/ApiProtect.php
+++ b/includes/api/ApiProtect.php
@@ -28,7 +28,7 @@ if (!defined('MEDIAWIKI')) {
}
/**
- * @addtogroup API
+ * @ingroup API
*/
class ApiProtect extends ApiBase {
@@ -40,7 +40,7 @@ class ApiProtect extends ApiBase {
global $wgUser;
$this->getMain()->requestWriteMode();
$params = $this->extractRequestParams();
-
+
$titleObj = NULL;
if(!isset($params['title']))
$this->dieUsageMsg(array('missingparam', 'title'));
@@ -55,12 +55,12 @@ class ApiProtect extends ApiBase {
$titleObj = Title::newFromText($params['title']);
if(!$titleObj)
$this->dieUsageMsg(array('invalidtitle', $params['title']));
-
+
$errors = $titleObj->getUserPermissionsErrors('protect', $wgUser);
if(!empty($errors))
// We don't care about multiple errors, just report one of them
$this->dieUsageMsg(current($errors));
-
+
if(in_array($params['expiry'], array('infinite', 'indefinite', 'never')))
$expiry = Block::infinity();
else
@@ -68,7 +68,7 @@ class ApiProtect extends ApiBase {
$expiry = strtotime($params['expiry']);
if($expiry < 0 || $expiry == false)
$this->dieUsageMsg(array('invalidexpiry'));
-
+
$expiry = wfTimestamp(TS_MW, $expiry);
if($expiry < wfTimestampNow())
$this->dieUsageMsg(array('pastexpiry'));
@@ -85,8 +85,6 @@ class ApiProtect extends ApiBase {
$this->dieUsageMsg(array('missingtitles-createonly'));
}
- $dbw = wfGetDb(DB_MASTER);
- $dbw->begin();
if($titleObj->exists()) {
$articleObj = new Article($titleObj);
$ok = $articleObj->updateRestrictions($protections, $params['reason'], $params['cascade'], $expiry);
@@ -96,7 +94,6 @@ class ApiProtect extends ApiBase {
// This is very weird. Maybe the article was deleted or the user was blocked/desysopped in the meantime?
// Just throw an unknown error in this case, as it's very likely to be a race condition
$this->dieUsageMsg(array());
- $dbw->commit();
$res = array('title' => $titleObj->getPrefixedText(), 'reason' => $params['reason']);
if($expiry == Block::infinity())
$res['expiry'] = 'infinity';
@@ -149,6 +146,6 @@ class ApiProtect extends ApiBase {
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiProtect.php 30222 2008-01-28 19:05:26Z catrope $';
+ return __CLASS__ . ': $Id: ApiProtect.php 35098 2008-05-20 17:13:28Z ialex $';
}
}