X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiProtect.php;h=b9f97e3536a48296545a3f779a87b859cb794958;hb=3b658a2dd3339dce93ad74984eb0120f6c50ccd9;hp=80c76b30a71d0366523cd9d21ad6a8474e8b5be6;hpb=665f171a18061aacd339102a21f32d714c5de50d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 80c76b30a7..b9f97e3536 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -29,7 +29,6 @@ */ class ApiProtect extends ApiBase { public function execute() { - global $wgRestrictionLevels; $params = $this->extractRequestParams(); $pageObj = $this->getTitleOrPageId( $params, 'fromdbmaster' ); @@ -74,11 +73,11 @@ class ApiProtect extends ApiBase { if ( !in_array( $p[0], $restrictionTypes ) && $p[0] != 'create' ) { $this->dieUsageMsg( array( 'protect-invalidaction', $p[0] ) ); } - if ( !in_array( $p[1], $wgRestrictionLevels ) && $p[1] != 'all' ) { + if ( !in_array( $p[1], $this->getConfig()->get( 'RestrictionLevels' ) ) && $p[1] != 'all' ) { $this->dieUsageMsg( array( 'protect-invalidlevel', $p[1] ) ); } - if ( in_array( $expiry[$i], array( 'infinite', 'indefinite', 'never' ) ) ) { + if ( in_array( $expiry[$i], array( 'infinite', 'indefinite', 'infinity', 'never' ) ) ) { $expiryarray[$p[0]] = $db->getInfinity(); } else { $exp = strtotime( $expiry[$i] ); @@ -92,10 +91,13 @@ class ApiProtect extends ApiBase { } $expiryarray[$p[0]] = $exp; } - $resultProtections[] = array( $p[0] => $protections[$p[0]], - 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() ? - 'infinite' : - wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) ); + $resultProtections[] = array( + $p[0] => $protections[$p[0]], + 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() + ? 'infinite' + : wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) + ) + ); } $cascade = $params['cascade']; @@ -185,7 +187,7 @@ class ApiProtect extends ApiBase { 'expiry' => array( 'Expiry timestamps. If only one timestamp is ' . 'set, it\'ll be used for all protections.', - 'Use \'infinite\', \'indefinite\' or \'never\', for a never-expiring protection.' + 'Use \'infinite\', \'indefinite\', \'infinity\' or \'never\', for a never-expiring protection.' ), 'reason' => 'Reason for (un)protecting', 'cascade' => array( @@ -209,7 +211,7 @@ class ApiProtect extends ApiBase { } public function getDescription() { - return 'Change the protection level of a page'; + return 'Change the protection level of a page.'; } public function getPossibleErrors() {