Merge "Rewrite pref cleanup script"
[lhc/web/wiklou.git] / includes / MovePage.php
index ae12ba5..fe82465 100644 (file)
@@ -310,7 +310,7 @@ class MovePage {
                        # Protect the redirect title as the title used to be...
                        $res = $dbw->select(
                                'page_restrictions',
-                               '*',
+                               [ 'pr_type', 'pr_level', 'pr_cascade', 'pr_user', 'pr_expiry' ],
                                [ 'pr_page' => $pageid ],
                                __METHOD__,
                                'FOR UPDATE'
@@ -440,9 +440,8 @@ class MovePage {
         * @throws MWException
         */
        private function moveToInternal( User $user, &$nt, $reason = '', $createRedirect = true,
-               array $changeTags = [] ) {
-
-               global $wgContLang;
+               array $changeTags = []
+       ) {
                if ( $nt->exists() ) {
                        $moveOverRedirect = true;
                        $logType = 'move_redir';
@@ -455,7 +454,7 @@ class MovePage {
                        $overwriteMessage = wfMessage(
                                        'delete_and_move_reason',
                                        $this->oldTitle->getPrefixedText()
-                               )->text();
+                               )->inContentLanguage()->text();
                        $newpage = WikiPage::factory( $nt );
                        $errs = [];
                        $status = $newpage->doDeleteArticleReal(
@@ -501,7 +500,7 @@ class MovePage {
                $defaultContentModelChanging = ( $oldDefault !== $newDefault
                        && $oldDefault === $contentModel );
 
-               // bug 57084: log_page should be the ID of the *moved* page
+               // T59084: log_page should be the ID of the *moved* page
                $oldid = $this->oldTitle->getArticleID();
                $logTitle = clone $this->oldTitle;
 
@@ -511,7 +510,7 @@ class MovePage {
                $logEntry->setComment( $reason );
                $logEntry->setParameters( [
                        '4::target' => $nt->getPrefixedText(),
-                       '5::noredir' => $redirectContent ? '0': '1',
+                       '5::noredir' => $redirectContent ? '0' : '1',
                ] );
 
                $formatter = LogFormatter::newFromEntry( $logEntry );
@@ -520,8 +519,6 @@ class MovePage {
                if ( $reason ) {
                        $comment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
                }
-               # Truncate for whole multibyte characters.
-               $comment = $wgContLang->truncate( $comment, 255 );
 
                $dbw = wfGetDB( DB_MASTER );
 
@@ -550,13 +547,13 @@ class MovePage {
                );
 
                if ( !$redirectContent ) {
-                       // Clean up the old title *before* reset article id - bug 45348
+                       // Clean up the old title *before* reset article id - T47348
                        WikiPage::onArticleDelete( $this->oldTitle );
                }
 
                $this->oldTitle->resetArticleID( 0 ); // 0 == non existing
                $nt->resetArticleID( $oldid );
-               $newpage->loadPageData( WikiPage::READ_LOCKING ); // bug 46397
+               $newpage->loadPageData( WikiPage::READ_LOCKING ); // T48397
 
                $newpage->updateRevisionOn( $dbw, $nullRevision );
 
@@ -581,7 +578,7 @@ class MovePage {
                # Recreate the redirect, this time in the other direction.
                if ( $redirectContent ) {
                        $redirectArticle = WikiPage::factory( $this->oldTitle );
-                       $redirectArticle->loadFromRow( false, WikiPage::READ_LOCKING ); // bug 46397
+                       $redirectArticle->loadFromRow( false, WikiPage::READ_LOCKING ); // T48397
                        $newid = $redirectArticle->insertOn( $dbw );
                        if ( $newid ) { // sanity
                                $this->oldTitle->resetArticleID( $newid );