Index: trunk/phase3/includes/Article.php |
— | — | @@ -1831,11 +1831,11 @@ |
1832 | 1832 | * |
1833 | 1833 | * @param $limit Array: set of restriction keys |
1834 | 1834 | * @param $reason String |
1835 | | - * @param $cascade Integer |
| 1835 | + * @param &$cascade Integer. Set to false if cascading protection isn't allowed. |
1836 | 1836 | * @param $expiry Array: per restriction type expiration |
1837 | 1837 | * @return bool true on success |
1838 | 1838 | */ |
1839 | | - public function updateRestrictions( $limit = array(), $reason = '', $cascade = 0, $expiry = array() ) { |
| 1839 | + public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) { |
1840 | 1840 | global $wgUser, $wgRestrictionTypes, $wgContLang; |
1841 | 1841 | |
1842 | 1842 | $id = $this->mTitle->getArticleID(); |
— | — | @@ -1856,8 +1856,10 @@ |
1857 | 1857 | $updated = Article::flattenRestrictions( $limit ); |
1858 | 1858 | $changed = false; |
1859 | 1859 | foreach( $wgRestrictionTypes as $action ) { |
1860 | | - $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); |
1861 | | - $changed = ($changed || ($this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action]) ); |
| 1860 | + if( isset( $expiry[$action] ) ) { |
| 1861 | + $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); |
| 1862 | + $changed = ($changed || ($this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action]) ); |
| 1863 | + } |
1862 | 1864 | } |
1863 | 1865 | |
1864 | 1866 | $current = Article::flattenRestrictions( $current ); |
Index: trunk/phase3/includes/api/ApiProtect.php |
— | — | @@ -105,9 +105,10 @@ |
106 | 106 | wfTimestamp(TS_ISO_8601, $expiryarray[$p[0]]))); |
107 | 107 | } |
108 | 108 | |
| 109 | + $cascade = $params['cascade']; |
109 | 110 | if($titleObj->exists()) { |
110 | 111 | $articleObj = new Article($titleObj); |
111 | | - $ok = $articleObj->updateRestrictions($protections, $params['reason'], $params['cascade'], $expiryarray); |
| 112 | + $ok = $articleObj->updateRestrictions($protections, $params['reason'], $cascade, $expiryarray); |
112 | 113 | } else |
113 | 114 | $ok = $titleObj->updateTitleProtection($protections['create'], $params['reason'], $expiryarray['create']); |
114 | 115 | if(!$ok) |
— | — | @@ -115,7 +116,7 @@ |
116 | 117 | // Just throw an unknown error in this case, as it's very likely to be a race condition |
117 | 118 | $this->dieUsageMsg(array()); |
118 | 119 | $res = array('title' => $titleObj->getPrefixedText(), 'reason' => $params['reason']); |
119 | | - if($params['cascade']) |
| 120 | + if($cascade) |
120 | 121 | $res['cascade'] = ''; |
121 | 122 | $res['protections'] = $resultProtections; |
122 | 123 | $this->getResult()->setIndexedTagName($res['protections'], 'protection'); |
— | — | @@ -149,7 +150,8 @@ |
150 | 151 | 'expiry' => array('Expiry timestamps. If only one timestamp is set, it\'ll be used for all protections.', |
151 | 152 | 'Use \'infinite\', \'indefinite\' or \'never\', for a neverexpiring protection.'), |
152 | 153 | 'reason' => 'Reason for (un)protecting (optional)', |
153 | | - 'cascade' => 'Enable cascading protection (i.e. protect pages included in this page)' |
| 154 | + 'cascade' => array('Enable cascading protection (i.e. protect pages included in this page)', |
| 155 | + 'Ignored if not all protection levels are \'sysop\' or \'protect\''), |
154 | 156 | ); |
155 | 157 | } |
156 | 158 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -494,6 +494,8 @@ |
495 | 495 | * (bug 16548) list=search threw errors with an invalid error code |
496 | 496 | * (bug 16515) Added pst and onlypst parameters to action=parse |
497 | 497 | * (bug 16541) Added block expiry timestamp to list=logevents output |
| 498 | +* (bug 16613) action=protect doesn't tell when &cascade was set but cascading |
| 499 | + protection wasn't allowed |
498 | 500 | |
499 | 501 | === Languages updated in 1.14 === |
500 | 502 | |