No need for (1), keep tinyint consistent with the other booleans.
[lhc/web/wiklou.git] / maintenance / convertLinks.inc
index df682f1..d0c57f7 100644 (file)
@@ -1,24 +1,23 @@
 <?php
 /**
  * @todo document
- * @package MediaWiki
- * @subpackage Maintenance
+ * @addtogroup Maintenance
  */
 
 /** */
 function convertLinks() {
        global $wgDBtype;
-       if( $wgDBtype == 'Postgres' ) {
-               print "Links table already ok on PostgreSQL.\n";
+       if( $wgDBtype == 'postgres' ) {
+               print "Links table already ok on Postgres.\n";
                return;
        }
 
        print "Converting links table to ID-ID...\n";
 
-       global $wgLang, $wgDBserver, $wgDBport, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
+       global $wgLang, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
        global $noKeys, $logPerformance, $fh;
 
-       $numRows = $tuplesAdded = $numBadLinks = $curRowsRead = 0; #counters etc
+       $tuplesAdded = $numBadLinks = $curRowsRead = 0; #counters etc
        $totalTuplesInserted = 0; # total tuples INSERTed into links_temp
 
        $reportCurReadProgress = true; #whether or not to give progress reports while reading IDs from cur table
@@ -43,8 +42,8 @@ function convertLinks() {
        $perfLogFilename = "convLinksPerf.txt";
        #--------------------------------------------------------------------
 
-       $dbw =& wfGetDB( DB_MASTER );
-       extract( $dbw->tableNames( 'cur', 'links', 'links_temp', 'links_backup' ) );
+       $dbw = wfGetDB( DB_MASTER );
+       list ($cur, $links, $links_temp, $links_backup) = $dbw->tableNamesN( 'cur', 'links', 'links_temp', 'links_backup' );
 
        $res = $dbw->query( "SELECT l_from FROM $links LIMIT 1" );
        if ( $dbw->fieldType( $res, 0 ) == "int" ) {
@@ -147,7 +146,7 @@ function convertLinks() {
        #--------------------------------------------------------------------
 
        if ( $overwriteLinksTable ) {
-               $dbConn = Database::newFromParams( $wgDBserver, $wgDBport, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
+               $dbConn = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
                if (!($dbConn->isOpen())) {
                        print "Opening connection to database failed.\n";
                        return;
@@ -174,9 +173,9 @@ function convertLinks() {
 #--------------------------------------------------------------------
 
 function createTempTable() {
-       global $wgDBserver, $wgDBport, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
+       global $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
        global $noKeys;
-       $dbConn = Database::newFromParams( $wgDBserver, $wgDBport, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
+       $dbConn = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
 
        if (!($dbConn->isOpen())) {
                print "Opening connection to database failed.\n";