* Changed Article::updateRestrictions()'s $cascade parameter to a reference which is set to false if cascading protection isn't allowed
* Used this in ApiProtect
* Expand help message for &cascade a bit
* (bug 16548) list=search threw errors with an invalid error code
* (bug 16515) Added pst and onlypst parameters to action=parse
* (bug 16541) Added block expiry timestamp to list=logevents output
+* (bug 16613) action=protect doesn't tell when &cascade was set but cascading
+ protection wasn't allowed
=== Languages updated in 1.14 ===
*
* @param $limit Array: set of restriction keys
* @param $reason String
- * @param $cascade Integer
+ * @param &$cascade Integer. Set to false if cascading protection isn't allowed.
* @param $expiry Array: per restriction type expiration
* @return bool true on success
*/
- public function updateRestrictions( $limit = array(), $reason = '', $cascade = 0, $expiry = array() ) {
+ public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) {
global $wgUser, $wgRestrictionTypes, $wgContLang;
$id = $this->mTitle->getArticleID();
$updated = Article::flattenRestrictions( $limit );
$changed = false;
foreach( $wgRestrictionTypes as $action ) {
- $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
- $changed = ($changed || ($this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action]) );
+ if( isset( $expiry[$action] ) ) {
+ $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
+ $changed = ($changed || ($this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action]) );
+ }
}
$current = Article::flattenRestrictions( $current );
wfTimestamp(TS_ISO_8601, $expiryarray[$p[0]])));
}
+ $cascade = $params['cascade'];
if($titleObj->exists()) {
$articleObj = new Article($titleObj);
- $ok = $articleObj->updateRestrictions($protections, $params['reason'], $params['cascade'], $expiryarray);
+ $ok = $articleObj->updateRestrictions($protections, $params['reason'], $cascade, $expiryarray);
} else
$ok = $titleObj->updateTitleProtection($protections['create'], $params['reason'], $expiryarray['create']);
if(!$ok)
// Just throw an unknown error in this case, as it's very likely to be a race condition
$this->dieUsageMsg(array());
$res = array('title' => $titleObj->getPrefixedText(), 'reason' => $params['reason']);
- if($params['cascade'])
+ if($cascade)
$res['cascade'] = '';
$res['protections'] = $resultProtections;
$this->getResult()->setIndexedTagName($res['protections'], '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 neverexpiring protection.'),
'reason' => 'Reason for (un)protecting (optional)',
- 'cascade' => 'Enable cascading protection (i.e. protect pages included in this page)'
+ 'cascade' => array('Enable cascading protection (i.e. protect pages included in this page)',
+ 'Ignored if not all protection levels are \'sysop\' or \'protect\''),
);
}