From 5e4288a658adba37391216954bf97486ef3b461f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 24 Sep 2008 15:02:02 +0000 Subject: [PATCH] * 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) --- includes/Title.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/includes/Title.php b/includes/Title.php index e2be4e7556..9cfdba1437 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2572,6 +2572,7 @@ class Title { } $pageid = $this->getArticleID(); + $protected = $this->isProtected(); if( $nt->exists() ) { $err = $this->moveOverExistingRedirect( $nt, $reason, $createRedirect ); $pageCountChange = ($createRedirect ? 0 : -1); @@ -2606,8 +2607,28 @@ class Title { 'cl_sortkey' => $this->getPrefixedText() ), __METHOD__ ); - # Update watchlists + if( $protected ) { + # Protect the redirect title as the title used to be... + $dbw->insertSelect( 'page_restrictions', 'page_restrictions', + array( + 'pr_page' => $redirid, + 'pr_type' => 'pr_type', + 'pr_level' => 'pr_level', + 'pr_cascade' => 'pr_cascade', + 'pr_user' => 'pr_user', + 'pr_expiry' => 'pr_expiry' + ), + array( 'pr_page' => $pageid ), + __METHOD__, + array( 'IGNORE' ) + ); + # Update the protection log + $log = new LogPage( 'protect' ); + $comment = wfMsgForContent('1movedto2',$this->getPrefixedText(), $nt->getPrefixedText() ); + $log->addEntry( 'protect', $nt, $comment, array() ); // FIXME: $params? + } + # Update watchlists $oldnamespace = $this->getNamespace() & ~1; $newnamespace = $nt->getNamespace() & ~1; $oldtitle = $this->getDBkey(); -- 2.20.1