Index: trunk/phase3/includes/ProtectionForm.php |
— | — | @@ -247,7 +247,7 @@ |
248 | 248 | * @return Boolean: success |
249 | 249 | */ |
250 | 250 | function save() { |
251 | | - global $wgRequest, $wgUser; |
| 251 | + global $wgRequest, $wgUser, $wgOut; |
252 | 252 | |
253 | 253 | # Permission check! |
254 | 254 | if ( $this->disabled ) { |
— | — | @@ -294,14 +294,11 @@ |
295 | 295 | !(isset($wgGroupPermissions[$edit_restriction]['protect']) && $wgGroupPermissions[$edit_restriction]['protect'] ) ) |
296 | 296 | $this->mCascade = false; |
297 | 297 | |
298 | | - if ($this->mTitle->exists()) { |
299 | | - $ok = $this->mArticle->updateRestrictions( $this->mRestrictions, $reasonstr, $this->mCascade, $expiry ); |
300 | | - } else { |
301 | | - $ok = $this->mTitle->updateTitleProtection( $this->mRestrictions['create'], $reasonstr, $expiry['create'] ); |
302 | | - } |
| 298 | + $status = $this->mArticle->doUpdateRestrictions( $this->mRestrictions, $expiry, $this->mCascade, $reasonstr, $wgUser ); |
303 | 299 | |
304 | | - if( !$ok ) { |
305 | | - throw new FatalError( "Unknown error at restriction save time." ); |
| 300 | + if ( !$status->isOK() ) { |
| 301 | + $this->show( $wgOut->parseInline( $status->getWikiText() ) ); |
| 302 | + return false; |
306 | 303 | } |
307 | 304 | |
308 | 305 | /** |
— | — | @@ -326,7 +323,7 @@ |
327 | 324 | } elseif ( $this->mTitle->userIsWatching() ) { |
328 | 325 | WatchAction::doUnwatch( $this->mTitle, $wgUser ); |
329 | 326 | } |
330 | | - return $ok; |
| 327 | + return true; |
331 | 328 | } |
332 | 329 | |
333 | 330 | /** |