Index: trunk/phase3/includes/Title.php |
— | — | @@ -1235,7 +1235,7 @@ |
1236 | 1236 | */ |
1237 | 1237 | private function checkQuickPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) { |
1238 | 1238 | $ns = $this->getNamespace(); |
1239 | | - |
| 1239 | + |
1240 | 1240 | if ( $action == 'create' ) { |
1241 | 1241 | if ( ( $this->isTalkPage() && !$user->isAllowed( 'createtalk', $ns ) ) || |
1242 | 1242 | ( !$this->isTalkPage() && !$user->isAllowed( 'createpage', $ns ) ) ) { |
— | — | @@ -1256,9 +1256,9 @@ |
1257 | 1257 | if ( !$user->isAllowed( 'move', $ns) ) { |
1258 | 1258 | // User can't move anything |
1259 | 1259 | |
1260 | | - $userCanMove = in_array( 'move', User::getGroupPermissions( |
| 1260 | + $userCanMove = in_array( 'move', User::getGroupPermissions( |
1261 | 1261 | array( 'user' ), $ns ), true ); |
1262 | | - $autoconfirmedCanMove = in_array( 'move', User::getGroupPermissions( |
| 1262 | + $autoconfirmedCanMove = in_array( 'move', User::getGroupPermissions( |
1263 | 1263 | array( 'autoconfirmed' ), $ns ), true ); |
1264 | 1264 | |
1265 | 1265 | if ( $user->isAnon() && ( $userCanMove || $autoconfirmedCanMove ) ) { |
— | — | @@ -1511,8 +1511,8 @@ |
1512 | 1512 | if( $title_protection['pt_create_perm'] == 'sysop' ) { |
1513 | 1513 | $title_protection['pt_create_perm'] = 'protect'; // B/C |
1514 | 1514 | } |
1515 | | - if( $title_protection['pt_create_perm'] == '' || |
1516 | | - !$user->isAllowed( $title_protection['pt_create_perm'], |
| 1515 | + if( $title_protection['pt_create_perm'] == '' || |
| 1516 | + !$user->isAllowed( $title_protection['pt_create_perm'], |
1517 | 1517 | $this->mNamespace ) ) { |
1518 | 1518 | $errors[] = array( 'titleprotected', User::whoIs( $title_protection['pt_user'] ), $title_protection['pt_reason'] ); |
1519 | 1519 | } |
— | — | @@ -2369,7 +2369,7 @@ |
2370 | 2370 | $fconditions[] = $dbr->bitAnd('fa_deleted', $suppressedTextBits ) . |
2371 | 2371 | ' != ' . $suppressedTextBits; |
2372 | 2372 | } |
2373 | | - |
| 2373 | + |
2374 | 2374 | $n += $dbr->selectField( 'filearchive', |
2375 | 2375 | 'COUNT(*)', |
2376 | 2376 | $fconditions, |
— | — | @@ -3339,7 +3339,8 @@ |
3340 | 3340 | $nt->resetArticleID( $oldid ); |
3341 | 3341 | |
3342 | 3342 | $article = new Article( $nt ); |
3343 | | - wfRunHooks( 'NewRevisionFromEditComplete', array( $article, $nullRevision, $latest, $wgUser ) ); |
| 3343 | + wfRunHooks( 'NewRevisionFromEditComplete', |
| 3344 | + array( $article, $nullRevision, $latest, $wgUser ) ); |
3344 | 3345 | $article->setCachedLastEditTime( $now ); |
3345 | 3346 | |
3346 | 3347 | # Recreate the redirect, this time in the other direction. |
— | — | @@ -3348,24 +3349,27 @@ |
3349 | 3350 | $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $nt->getPrefixedText() . "]]\n"; |
3350 | 3351 | $redirectArticle = new Article( $this ); |
3351 | 3352 | $newid = $redirectArticle->insertOn( $dbw ); |
3352 | | - $redirectRevision = new Revision( array( |
3353 | | - 'page' => $newid, |
3354 | | - 'comment' => $comment, |
3355 | | - 'text' => $redirectText ) ); |
3356 | | - $redirectRevision->insertOn( $dbw ); |
3357 | | - $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); |
| 3353 | + if ( $newid ) { // sanity |
| 3354 | + $redirectRevision = new Revision( array( |
| 3355 | + 'page' => $newid, |
| 3356 | + 'comment' => $comment, |
| 3357 | + 'text' => $redirectText ) ); |
| 3358 | + $redirectRevision->insertOn( $dbw ); |
| 3359 | + $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); |
3358 | 3360 | |
3359 | | - wfRunHooks( 'NewRevisionFromEditComplete', array( $redirectArticle, $redirectRevision, false, $wgUser ) ); |
| 3361 | + wfRunHooks( 'NewRevisionFromEditComplete', |
| 3362 | + array( $redirectArticle, $redirectRevision, false, $wgUser ) ); |
3360 | 3363 | |
3361 | | - # Now, we record the link from the redirect to the new title. |
3362 | | - # It should have no other outgoing links... |
3363 | | - $dbw->delete( 'pagelinks', array( 'pl_from' => $newid ), __METHOD__ ); |
3364 | | - $dbw->insert( 'pagelinks', |
3365 | | - array( |
3366 | | - 'pl_from' => $newid, |
3367 | | - 'pl_namespace' => $nt->getNamespace(), |
3368 | | - 'pl_title' => $nt->getDBkey() ), |
3369 | | - __METHOD__ ); |
| 3364 | + # Now, we record the link from the redirect to the new title. |
| 3365 | + # It should have no other outgoing links... |
| 3366 | + $dbw->delete( 'pagelinks', array( 'pl_from' => $newid ), __METHOD__ ); |
| 3367 | + $dbw->insert( 'pagelinks', |
| 3368 | + array( |
| 3369 | + 'pl_from' => $newid, |
| 3370 | + 'pl_namespace' => $nt->getNamespace(), |
| 3371 | + 'pl_title' => $nt->getDBkey() ), |
| 3372 | + __METHOD__ ); |
| 3373 | + } |
3370 | 3374 | $redirectSuppressed = false; |
3371 | 3375 | } else { |
3372 | 3376 | $this->resetArticleID( 0 ); |