X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiProtect.php;h=80c76b30a71d0366523cd9d21ad6a8474e8b5be6;hb=a316b0788f91deaf32b3cc7a496188b3cbb85462;hp=7830c8b4dc40b02fef9fc241123cb864190044ca;hpb=f0a00a49b1be46b51aeef712f363305bce4448fa;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 7830c8b4dc..80c76b30a7 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -28,7 +28,6 @@ * @ingroup API */ class ApiProtect extends ApiBase { - public function execute() { global $wgRestrictionLevels; $params = $this->extractRequestParams(); @@ -47,7 +46,11 @@ class ApiProtect extends ApiBase { if ( count( $expiry ) == 1 ) { $expiry = array_fill( 0, count( $params['protections'] ), $expiry[0] ); } else { - $this->dieUsageMsg( array( 'toofewexpiries', count( $expiry ), count( $params['protections'] ) ) ); + $this->dieUsageMsg( array( + 'toofewexpiries', + count( $expiry ), + count( $params['protections'] ) + ) ); } } @@ -90,17 +93,23 @@ 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]] ) ) ); + 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() ? + 'infinite' : + wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) ); } $cascade = $params['cascade']; $watch = $params['watch'] ? 'watch' : $params['watchlist']; - $this->setWatch( $watch, $titleObj ); - - $status = $pageObj->doUpdateRestrictions( $protections, $expiryarray, $cascade, $params['reason'], $this->getUser() ); + $this->setWatch( $watch, $titleObj, 'watchdefault' ); + + $status = $pageObj->doUpdateRestrictions( + $protections, + $expiryarray, + $cascade, + $params['reason'], + $this->getUser() + ); if ( !$status->isOK() ) { $this->dieStatus( $status ); @@ -167,18 +176,25 @@ class ApiProtect extends ApiBase { public function getParamDescription() { $p = $this->getModulePrefix(); + return array( 'title' => "Title of the page you want to (un)protect. Cannot be used together with {$p}pageid", 'pageid' => "ID of the page you want to (un)protect. Cannot be used together with {$p}title", 'token' => 'A protect token previously retrieved through prop=info', 'protections' => 'List of protection levels, formatted action=group (e.g. edit=sysop)', - '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.' ), + '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.' + ), 'reason' => 'Reason for (un)protecting', - 'cascade' => array( 'Enable cascading protection (i.e. protect pages included in this page)', - 'Ignored if not all protection levels are \'sysop\' or \'protect\'' ), + 'cascade' => array( + 'Enable cascading protection (i.e. protect pages included in this page)', + 'Ignored if not all protection levels are \'sysop\' or \'protect\'' + ), 'watch' => 'If set, add the page being (un)protected to your watchlist', - 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch', + 'watchlist' => 'Unconditionally add or remove the page from your ' . + 'watchlist, use preferences or do not change watch', ); } @@ -221,8 +237,10 @@ class ApiProtect extends ApiBase { public function getExamples() { return array( - 'api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=sysop|move=sysop&cascade=&expiry=20070901163000|never', - 'api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=all|move=all&reason=Lifting%20restrictions' + 'api.php?action=protect&title=Main%20Page&token=123ABC&' . + 'protections=edit=sysop|move=sysop&cascade=&expiry=20070901163000|never', + 'api.php?action=protect&title=Main%20Page&token=123ABC&' . + 'protections=edit=all|move=all&reason=Lifting%20restrictions' ); }