Update packages to do with karma
[lhc/web/wiklou.git] / maintenance / namespaceDupes.php
index 088f677..6e5cd38 100644 (file)
@@ -67,7 +67,7 @@ class NamespaceConflictChecker extends Maintenance {
        }
 
        public function execute() {
-               $this->db = wfGetDB( DB_MASTER );
+               $this->db = $this->getDB( DB_MASTER );
 
                $options = array(
                        'fix' => $this->hasOption( 'fix' ),
@@ -179,22 +179,22 @@ class NamespaceConflictChecker extends Maintenance {
 
                foreach ( $spaces as $name => $ns ) {
                        if ( $ns != 0 ) {
-                               // Fix up link destinations for non-interwiki links only.
-                               //
-                               // For example if a page has [[Foo:Bar]] and then a Foo namespace
-                               // is introduced, pagelinks needs to be updated to have
-                               // page_namespace = NS_FOO.
-                               //
-                               // If instead an interwiki prefix was introduced called "Foo",
-                               // the link should instead be moved to the iwlinks table. If a new
-                               // language is introduced called "Foo", or if there is a pagelink
-                               // [[fr:Bar]] when interlanguage magic links are turned on, the
-                               // link would have to be moved to the langlinks table. Let's put
-                               // those cases in the too-hard basket for now. The consequences are
-                               // not especially severe.
-                               //
-                               // @fixme Handle interwiki links, and pagelinks to Category:, File:
-                               // which probably need reparsing.
+                               /* Fix up link destinations for non-interwiki links only.
+                                *
+                                * For example if a page has [[Foo:Bar]] and then a Foo namespace
+                                * is introduced, pagelinks needs to be updated to have
+                                * page_namespace = NS_FOO.
+                                *
+                                * If instead an interwiki prefix was introduced called "Foo",
+                                * the link should instead be moved to the iwlinks table. If a new
+                                * language is introduced called "Foo", or if there is a pagelink
+                                * [[fr:Bar]] when interlanguage magic links are turned on, the
+                                * link would have to be moved to the langlinks table. Let's put
+                                * those cases in the too-hard basket for now. The consequences are
+                                * not especially severe.
+                                * @fixme Handle interwiki links, and pagelinks to Category:, File:
+                                * which probably need reparsing.
+                                */
 
                                $this->checkLinkTable( 'pagelinks', 'pl', $ns, $name, $options );
                                $this->checkLinkTable( 'templatelinks', 'tl', $ns, $name, $options );
@@ -390,7 +390,8 @@ class NamespaceConflictChecker extends Maintenance {
                                                $titleField => $row->$titleField,
                                                $fromField => $row->$fromField
                                        ),
-                                       __METHOD__
+                                       __METHOD__,
+                                       array( 'IGNORE' )
                                );
                                $this->output( "$table $logTitle -> " .
                                        $destTitle->getPrefixedDBkey() . "\n" );
@@ -569,6 +570,7 @@ class NamespaceConflictChecker extends Maintenance {
         *
         * @param integer $id The page_id
         * @param Title $newTitle The new title
+        * @return bool
         */
        private function mergePage( $row, Title $newTitle ) {
                $id = $row->page_id;
@@ -582,7 +584,7 @@ class NamespaceConflictChecker extends Maintenance {
                $wikiPage->loadPageData( 'fromdbmaster' );
 
                $destId = $newTitle->getArticleId();
-               $this->db->begin( __METHOD__ );
+               $this->beginTransaction( $this->db, __METHOD__ );
                $this->db->update( 'revision',
                        // SET
                        array( 'rev_page' => $destId ),
@@ -592,17 +594,18 @@ class NamespaceConflictChecker extends Maintenance {
 
                $this->db->delete( 'page', array( 'page_id' => $id ), __METHOD__ );
 
-               // Call LinksDeletionUpdate to delete outgoing links from the old title,
-               // and update category counts.
-               //
-               // Calling external code with a fake broken Title is a fairly dubious
-               // idea. It's necessary because it's quite a lot of code to duplicate,
-               // but that also makes it fragile since it would be easy for someone to
-               // accidentally introduce an assumption of title validity to the code we
-               // are calling.
+               /* Call LinksDeletionUpdate to delete outgoing links from the old title,
+                * and update category counts.
+                *
+                * Calling external code with a fake broken Title is a fairly dubious
+                * idea. It's necessary because it's quite a lot of code to duplicate,
+                * but that also makes it fragile since it would be easy for someone to
+                * accidentally introduce an assumption of title validity to the code we
+                * are calling.
+                */
                $update = new LinksDeletionUpdate( $wikiPage );
                $update->doUpdate();
-               $this->db->commit( __METHOD__ );
+               $this->commitTransaction( $this->db, __METHOD__ );
 
                return true;
        }