Consistent casing for wfGetDB(), getDB(), and getDBKey()
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Thu, 6 Nov 2008 22:38:42 +0000 (22:38 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Thu, 6 Nov 2008 22:38:42 +0000 (22:38 +0000)
19 files changed:
includes/Linker.php
includes/Title.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryCategoryInfo.php
includes/api/ApiQueryExtLinksUsage.php
includes/api/ApiQueryImages.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQueryLinks.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryUsers.php
includes/filerepo/LocalFile.php
includes/filerepo/LocalRepo.php
includes/specials/SpecialExport.php
includes/specials/SpecialFileDuplicateSearch.php
includes/specials/SpecialListUserRestrictions.php
includes/specials/SpecialRevisiondelete.php

index c15e328..a861bc5 100644 (file)
@@ -191,7 +191,7 @@ class Linker {
                wfProfileIn( __METHOD__ . '-checkPageExistence' );
                if( !in_array( 'known', $options ) and !in_array( 'broken', $options ) ) {
                        if( $target->getNamespace() == NS_SPECIAL ) {
-                               if( SpecialPage::exists( $target->getDbKey() ) ) {
+                               if( SpecialPage::exists( $target->getDBKey() ) ) {
                                        $options []= 'known';
                                } else {
                                        $options []= 'broken';
index 5c9de3b..e3e702d 100644 (file)
@@ -2461,7 +2461,7 @@ class Title {
                                if( $nt->getText() != wfStripIllegalFilenameChars( $nt->getText() ) ) {
                                        $errors[] = array('imageinvalidfilename');
                                }
-                               if( !File::checkExtensionCompatibility( $file, $nt->getDbKey() ) ) {
+                               if( !File::checkExtensionCompatibility( $file, $nt->getDBKey() ) ) {
                                        $errors[] = array('imagetypemismatch');
                                }
                        }
index df4daf9..48d8e85 100644 (file)
@@ -100,7 +100,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                 * AND pl_title='Foo' AND pl_namespace=0
                 * LIMIT 11 ORDER BY pl_from
                 */
-               $db = $this->getDb();
+               $db = $this->getDB();
                $this->addTables(array('page', $this->bl_table));
                $this->addWhere("{$this->bl_from}=page_id");
                if(is_null($resultPageSet))
@@ -108,7 +108,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                else
                        $this->addFields($resultPageSet->getPageTableFields());
                $this->addFields('page_is_redirect');
-               $this->addWhereFld($this->bl_title, $this->rootTitle->getDbKey());
+               $this->addWhereFld($this->bl_title, $this->rootTitle->getDBKey());
                if($this->hasNS)
                        $this->addWhereFld($this->bl_ns, $this->rootTitle->getNamespace());
                $this->addWhereFld('page_namespace', $this->params['namespace']);
@@ -128,7 +128,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                 * AND (pl_title='Foo' AND pl_namespace=0) OR (pl_title='Bar' AND pl_namespace=1)
                 * LIMIT 11 ORDER BY pl_namespace, pl_title, pl_from
                 */
-               $db = $this->getDb();
+               $db = $this->getDB();
                $this->addTables(array('page', $this->bl_table));
                $this->addWhere("{$this->bl_from}=page_id");
                if(is_null($resultPageSet))
index a1583a4..bfba5eb 100644 (file)
@@ -87,7 +87,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                                $this->dieUsage("Invalid continue param. You should pass the " .
                                        "original value returned by the previous query", "_badcontinue");
                        $clfrom = intval($cont[0]);
-                       $clto = $this->getDb()->strencode($this->titleToKey($cont[1]));
+                       $clto = $this->getDB()->strencode($this->titleToKey($cont[1]));
                        $this->addWhere("cl_from > $clfrom OR ".
                                        "(cl_from = $clfrom AND ".
                                        "cl_to >= '$clto')");
index ead2af0..d495655 100644 (file)
@@ -52,7 +52,7 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
                foreach($categories as $c)
                {
                        $t = $titles[$c];
-                       $cattitles[$c] = $t->getDbKey();
+                       $cattitles[$c] = $t->getDBKey();
                }
 
                $this->addTables('category');
index 7dd92fa..c61e53a 100644 (file)
@@ -66,7 +66,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                else
                        $protocol = null;
 
-               $db = $this->getDb();
+               $db = $this->getDB();
                $this->addTables(array('page','externallinks'));        // must be in this order for 'USE INDEX'
                $this->addOption('USE INDEX', 'el_index');
                $this->addWhere('page_id=el_from');
index 35166e0..1f89f62 100644 (file)
@@ -66,7 +66,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
                                $this->dieUsage("Invalid continue param. You should pass the " .
                                        "original value returned by the previous query", "_badcontinue");
                        $ilfrom = intval($cont[0]);
-                       $ilto = $this->getDb()->strencode($this->titleToKey($cont[1]));
+                       $ilto = $this->getDB()->strencode($this->titleToKey($cont[1]));
                        $this->addWhere("il_from > $ilfrom OR ".
                                        "(il_from = $ilfrom AND ".
                                        "il_to >= '$ilto')");
index fbea988..624058c 100644 (file)
@@ -296,7 +296,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        $others = array();
                        foreach ($missing as $title)
                                if ($title->getNamespace() == NS_IMAGE)
-                                       $images[] = $title->getDbKey();
+                                       $images[] = $title->getDBKey();
                                else
                                        $others[] = $title;                                     
                        
@@ -449,10 +449,10 @@ class ApiQueryInfo extends ApiQueryBase {
                                        $result->setIndexedTagName($pageInfo['protection'], 'pr');
                                }
                        }
-                       if($fld_talkid && isset($talkids[$title->getNamespace()][$title->getDbKey()]))
-                               $pageInfo['talkid'] = $talkids[$title->getNamespace()][$title->getDbKey()];
-                       if($fld_subjectid && isset($subjectids[$title->getNamespace()][$title->getDbKey()]))
-                               $pageInfo['subjectid'] = $subjectids[$title->getNamespace()][$title->getDbKey()];
+                       if($fld_talkid && isset($talkids[$title->getNamespace()][$title->getDBKey()]))
+                               $pageInfo['talkid'] = $talkids[$title->getNamespace()][$title->getDBKey()];
+                       if($fld_subjectid && isset($subjectids[$title->getNamespace()][$title->getDBKey()]))
+                               $pageInfo['subjectid'] = $subjectids[$title->getNamespace()][$title->getDBKey()];
                        if($fld_url) {
                                $pageInfo['fullurl'] = $title->getFullURL();
                                $pageInfo['editurl'] = $title->getFullURL('action=edit');
@@ -496,10 +496,10 @@ class ApiQueryInfo extends ApiQueryBase {
                                                $res['query']['pages'][$pageid]['protection'] = array();
                                        $result->setIndexedTagName($res['query']['pages'][$pageid]['protection'], 'pr');
                                }
-                               if($fld_talkid && isset($talkids[$title->getNamespace()][$title->getDbKey()]))
-                                       $res['query']['pages'][$pageid]['talkid'] = $talkids[$title->getNamespace()][$title->getDbKey()];
-                               if($fld_subjectid && isset($subjectids[$title->getNamespace()][$title->getDbKey()]))
-                                       $res['query']['pages'][$pageid]['subjectid'] = $subjectids[$title->getNamespace()][$title->getDbKey()];
+                               if($fld_talkid && isset($talkids[$title->getNamespace()][$title->getDBKey()]))
+                                       $res['query']['pages'][$pageid]['talkid'] = $talkids[$title->getNamespace()][$title->getDBKey()];
+                               if($fld_subjectid && isset($subjectids[$title->getNamespace()][$title->getDBKey()]))
+                                       $res['query']['pages'][$pageid]['subjectid'] = $subjectids[$title->getNamespace()][$title->getDBKey()];
                                if($fld_url) {
                                        $res['query']['pages'][$pageid]['fullurl'] = $title->getFullURL();
                                        $res['query']['pages'][$pageid]['editurl'] = $title->getFullURL('action=edit');
index 735f67c..9c905e3 100644 (file)
@@ -58,7 +58,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
                                $this->dieUsage("Invalid continue param. You should pass the " .
                                        "original value returned by the previous query", "_badcontinue");
                        $llfrom = intval($cont[0]);
-                       $lllang = $this->getDb()->strencode($cont[1]);
+                       $lllang = $this->getDB()->strencode($cont[1]);
                        $this->addWhere("ll_from > $llfrom OR ".
                                        "(ll_from = $llfrom AND ".
                                        "ll_lang >= '$lllang')");
index 1ed0de4..4438c06 100644 (file)
@@ -92,7 +92,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                                        "original value returned by the previous query", "_badcontinue");
                        $plfrom = intval($cont[0]);
                        $plns = intval($cont[1]);
-                       $pltitle = $this->getDb()->strencode($this->titleToKey($cont[2]));
+                       $pltitle = $this->getDB()->strencode($this->titleToKey($cont[2]));
                        $this->addWhere("{$this->prefix}_from > $plfrom OR ".
                                        "({$this->prefix}_from = $plfrom AND ".
                                        "({$this->prefix}_namespace > $plns OR ".
index 0798f3b..52d34db 100644 (file)
@@ -112,10 +112,10 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                                        // LinkBatch refuses these, but we need them anyway
                                        if(!array_key_exists($obj->getNamespace(), $lb->data))
                                                $lb->data[$obj->getNamespace()] = array();
-                                       $lb->data[$obj->getNamespace()][$obj->getDbKey()] = 1;
+                                       $lb->data[$obj->getNamespace()][$obj->getDBKey()] = 1;
                                }
                        }
-                       $where = $lb->constructSet('rc', $this->getDb());
+                       $where = $lb->constructSet('rc', $this->getDB());
                        if($where != '')
                                $this->addWhere($where);
                }
index 1d84512..96ce851 100644 (file)
@@ -156,7 +156,7 @@ class ApiQueryContributions extends ApiQueryBase {
                $this->addWhereFld('rev_deleted', 0);
                // We only want pages by the specified users.
                if($this->prefixMode)
-                       $this->addWhere("rev_user_text LIKE '" . $this->getDb()->escapeLike($this->userprefix) . "%'");
+                       $this->addWhere("rev_user_text LIKE '" . $this->getDB()->escapeLike($this->userprefix) . "%'");
                else
                        $this->addWhereFld('rev_user_text', $this->usernames);
                // ... and in the specified timeframe.
index 9a0bde0..a8b5632 100644 (file)
@@ -71,7 +71,7 @@ if (!defined('MEDIAWIKI')) {
                if(!count($goodNames))
                        return $retval;
 
-               $db = $this->getDb();
+               $db = $this->getDB();
                $this->addTables('user', 'u1');
                $this->addFields('u1.user_name');
                $this->addWhereFld('u1.user_name', $goodNames);
index c15afc4..49528a3 100644 (file)
@@ -1716,7 +1716,7 @@ class LocalFileMoveBatch {
                $this->file = $file;
                $this->target = $target;
                $this->oldHash = $this->file->repo->getHashPath( $this->file->getName() );
-               $this->newHash = $this->file->repo->getHashPath( $this->target->getDbKey() );
+               $this->newHash = $this->file->repo->getHashPath( $this->target->getDBKey() );
                $this->oldName = $this->file->getName();
                $this->newName = $this->file->repo->getNameFromTitle( $this->target );
                $this->oldRel = $this->oldHash . $this->oldName;
index 90b198c..612fef9 100644 (file)
@@ -94,7 +94,7 @@ class LocalRepo extends FSRepo {
                        'page_id',      //Field
                        array(  //Conditions
                                'page_namespace' => $title->getNamespace(),
-                               'page_title' => $title->getDbKey(),
+                               'page_title' => $title->getDBKey(),
                        ),
                        __METHOD__      //Function name
                );
index 18c657f..b99c84d 100644 (file)
@@ -93,7 +93,7 @@ function wfExportGetLinks( $inputPages, $pageSet, $table, $fields, $join ) {
                                array_merge( $join,
                                        array(
                                                'page_namespace' => $title->getNamespace(),
-                                               'page_title' => $title->getDbKey() ) ),
+                                               'page_title' => $title->getDBKey() ) ),
                                __METHOD__ );
                        foreach( $result as $row ) {
                                $template = Title::makeTitle( $row->namespace, $row->title );
index 98454d8..bf4b3d2 100644 (file)
@@ -73,7 +73,7 @@ function wfSpecialFileDuplicateSearch( $par = null ) {
        if( $title && $title->getText() != '' ) {
                $dbr = wfGetDB( DB_SLAVE );
                $image = $dbr->tableName( 'image' );
-               $encFilename = $dbr->addQuotes( htmlspecialchars( $title->getDbKey() ) );
+               $encFilename = $dbr->addQuotes( htmlspecialchars( $title->getDBKey() ) );
                $sql = "SELECT img_sha1 from $image where img_name = $encFilename";
                $res = $dbr->query( $sql );
                $row = $dbr->fetchRow( $res );
index 6c3817a..27b2429 100644 (file)
@@ -72,7 +72,7 @@ class SpecialListUserRestrictionsForm {
                $title = Title::newFromText( $page );
                if( $title ) {
                        $conds['ur_page_namespace'] = $title->getNamespace();
-                       $conds['ur_page_title'] = $title->getDbKey();
+                       $conds['ur_page_title'] = $title->getDBKey();
                }
 
                return $conds;
index 47ecfb3..74b118e 100644 (file)
@@ -326,11 +326,11 @@ class RevisionDeleteForm {
                if( $this->deleteKey=='oldimage' ) {
                        // Run through and pull all our data in one query
                        foreach( $this->ofiles as $timestamp ) {
-                               $where[] = $dbr->addQuotes( $timestamp.'!'.$this->page->getDbKey() );
+                               $where[] = $dbr->addQuotes( $timestamp.'!'.$this->page->getDBKey() );
                        }
                        $whereClause = 'oi_archive_name IN(' . implode(',',$where) . ')';
                        $result = $dbr->select( 'oldimage', '*',
-                               array( 'oi_name' => $this->page->getDbKey(),
+                               array( 'oi_name' => $this->page->getDBKey(),
                                        $whereClause ),
                                __METHOD__ );
                        while( $row = $dbr->fetchObject( $result ) ) {
@@ -340,7 +340,7 @@ class RevisionDeleteForm {
                        }
                        // Check through our images
                        foreach( $this->ofiles as $timestamp ) {
-                               $archivename = $timestamp.'!'.$this->page->getDbKey();
+                               $archivename = $timestamp.'!'.$this->page->getDBKey();
                                if( !isset($filesObjs[$archivename]) ) {
                                        continue;
                                } else if( !$filesObjs[$archivename]->userCan(File::DELETED_RESTRICTED) ) {
@@ -364,7 +364,7 @@ class RevisionDeleteForm {
                        }
                        $whereClause = 'fa_id IN(' . implode(',',$where) . ')';
                        $result = $dbr->select( 'filearchive', '*',
-                               array( 'fa_name' => $this->page->getDbKey(),
+                               array( 'fa_name' => $this->page->getDBKey(),
                                        $whereClause ),
                                __METHOD__ );
                        while( $row = $dbr->fetchObject( $result ) ) {
@@ -939,11 +939,11 @@ class RevisionDeleter {
                $set = array();
                // Run through and pull all our data in one query
                foreach( $items as $timestamp ) {
-                       $where[] = $this->dbw->addQuotes( $timestamp.'!'.$title->getDbKey() );
+                       $where[] = $this->dbw->addQuotes( $timestamp.'!'.$title->getDBKey() );
                }
                $whereClause = 'oi_archive_name IN(' . implode(',',$where) . ')';
                $result = $this->dbw->select( 'oldimage', '*',
-                       array( 'oi_name' => $title->getDbKey(),
+                       array( 'oi_name' => $title->getDBKey(),
                                $whereClause ),
                        __METHOD__ );
                while( $row = $this->dbw->fetchObject( $result ) ) {
@@ -953,7 +953,7 @@ class RevisionDeleter {
                }
                // To work!
                foreach( $items as $timestamp ) {
-                       $archivename = $timestamp.'!'.$title->getDbKey();
+                       $archivename = $timestamp.'!'.$title->getDBKey();
                        if( !isset($filesObjs[$archivename]) ) {
                                $success = false;
                                continue; // Must exist
@@ -1036,7 +1036,7 @@ class RevisionDeleter {
                }
                $whereClause = 'fa_id IN(' . implode(',',$where) . ')';
                $result = $this->dbw->select( 'filearchive', '*',
-                       array( 'fa_name' => $title->getDbKey(),
+                       array( 'fa_name' => $title->getDBKey(),
                                $whereClause ),
                        __METHOD__ );
                while( $row = $this->dbw->fetchObject( $result ) ) {