r41227 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41226‎ | r41227 | r41228 >
Date:15:02, 24 September 2008
Author:aaron
Status:old
Tags:
Comment:
* Preserve protection on move for original title (now redirect) (bug 10527)
* Add a protection log entry to the new title on page move. Would be nice to have log_params set here too. (bug 8296)
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -2572,6 +2572,7 @@
25732573 }
25742574
25752575 $pageid = $this->getArticleID();
 2576+ $protected = $this->isProtected();
25762577 if( $nt->exists() ) {
25772578 $err = $this->moveOverExistingRedirect( $nt, $reason, $createRedirect );
25782579 $pageCountChange = ($createRedirect ? 0 : -1);
@@ -2606,8 +2607,28 @@
26072608 'cl_sortkey' => $this->getPrefixedText() ),
26082609 __METHOD__ );
26092610
 2611+ if( $protected ) {
 2612+ # Protect the redirect title as the title used to be...
 2613+ $dbw->insertSelect( 'page_restrictions', 'page_restrictions',
 2614+ array(
 2615+ 'pr_page' => $redirid,
 2616+ 'pr_type' => 'pr_type',
 2617+ 'pr_level' => 'pr_level',
 2618+ 'pr_cascade' => 'pr_cascade',
 2619+ 'pr_user' => 'pr_user',
 2620+ 'pr_expiry' => 'pr_expiry'
 2621+ ),
 2622+ array( 'pr_page' => $pageid ),
 2623+ __METHOD__,
 2624+ array( 'IGNORE' )
 2625+ );
 2626+ # Update the protection log
 2627+ $log = new LogPage( 'protect' );
 2628+ $comment = wfMsgForContent('1movedto2',$this->getPrefixedText(), $nt->getPrefixedText() );
 2629+ $log->addEntry( 'protect', $nt, $comment, array() ); // FIXME: $params?
 2630+ }
 2631+
26102632 # Update watchlists
2611 -
26122633 $oldnamespace = $this->getNamespace() & ~1;
26132634 $newnamespace = $nt->getNamespace() & ~1;
26142635 $oldtitle = $this->getDBkey();