X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiProtect.php;h=c07aaca436020f289ec447b8666c62516064cfeb;hb=d2278d1c2ae98e2c177acdab400614f29ac54591;hp=4736cfb54bc1b7e3a8b658f014aed7d8fb024093;hpb=65294205a1cda97c5c20f1c1e0495252b54fcdcd;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 4736cfb54b..c07aaca436 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -29,6 +29,8 @@ */ class ApiProtect extends ApiBase { public function execute() { + global $wgContLang; + $params = $this->extractRequestParams(); $pageObj = $this->getTitleOrPageId( $params, 'fromdbmaster' ); @@ -78,7 +80,7 @@ class ApiProtect extends ApiBase { } if ( wfIsInfinity( $expiry[$i] ) ) { - $expiryarray[$p[0]] = $db->getInfinity(); + $expiryarray[$p[0]] = 'infinity'; } else { $exp = strtotime( $expiry[$i] ); if ( $exp < 0 || !$exp ) { @@ -93,10 +95,7 @@ class ApiProtect extends ApiBase { } $resultProtections[] = array( $p[0] => $protections[$p[0]], - 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() - ? 'infinite' - : wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) - ) + 'expiry' => $wgContLang->formatExpiry( $expiryarray[$p[0]], TS_ISO_8601, 'infinite' ), ); } @@ -124,11 +123,11 @@ class ApiProtect extends ApiBase { 'reason' => $params['reason'] ); if ( $cascade ) { - $res['cascade'] = ''; + $res['cascade'] = true; } $res['protections'] = $resultProtections; $result = $this->getResult(); - $result->setIndexedTagName( $res['protections'], 'protection' ); + ApiResult::setIndexedTagName( $res['protections'], 'protection' ); $result->addValue( null, $this->getModuleName(), $res ); }