From c426e6b9d7d3dc9528df528d61fb74d935f577ae Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 6 Nov 2008 22:38:42 +0000 Subject: [PATCH] Consistent casing for wfGetDB(), getDB(), and getDBKey() --- includes/Linker.php | 2 +- includes/Title.php | 2 +- includes/api/ApiQueryBacklinks.php | 6 +++--- includes/api/ApiQueryCategories.php | 2 +- includes/api/ApiQueryCategoryInfo.php | 2 +- includes/api/ApiQueryExtLinksUsage.php | 2 +- includes/api/ApiQueryImages.php | 2 +- includes/api/ApiQueryInfo.php | 18 +++++++++--------- includes/api/ApiQueryLangLinks.php | 2 +- includes/api/ApiQueryLinks.php | 2 +- includes/api/ApiQueryRecentChanges.php | 4 ++-- includes/api/ApiQueryUserContributions.php | 2 +- includes/api/ApiQueryUsers.php | 2 +- includes/filerepo/LocalFile.php | 2 +- includes/filerepo/LocalRepo.php | 2 +- includes/specials/SpecialExport.php | 2 +- .../specials/SpecialFileDuplicateSearch.php | 2 +- .../specials/SpecialListUserRestrictions.php | 2 +- includes/specials/SpecialRevisiondelete.php | 16 ++++++++-------- 19 files changed, 37 insertions(+), 37 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index c15e32843d..a861bc5a79 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -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'; diff --git a/includes/Title.php b/includes/Title.php index 5c9de3bf64..e3e702d224 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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'); } } diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index df4daf9ef5..48d8e85383 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -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)) diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index a1583a4efa..bfba5eb4eb 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -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')"); diff --git a/includes/api/ApiQueryCategoryInfo.php b/includes/api/ApiQueryCategoryInfo.php index ead2af0138..d495655fca 100644 --- a/includes/api/ApiQueryCategoryInfo.php +++ b/includes/api/ApiQueryCategoryInfo.php @@ -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'); diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index 7dd92fa495..c61e53a06b 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -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'); diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index 35166e03ba..1f89f6219c 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -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')"); diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index fbea988ba2..624058cea2 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -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'); diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index 735f67c0c6..9c905e3705 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -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')"); diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 1ed0de4ce7..4438c06e80 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -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 ". diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 0798f3b700..52d34db29c 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -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); } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 1d8451213e..96ce8511d5 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -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. diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 9a0bde061a..a8b56321e2 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -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); diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index c15afc409e..49528a3159 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -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; diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 90b198c806..612fef9993 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -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 ); diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 18c657f71f..b99c84d8e1 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -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 ); diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index 98454d839e..bf4b3d2580 100644 --- a/includes/specials/SpecialFileDuplicateSearch.php +++ b/includes/specials/SpecialFileDuplicateSearch.php @@ -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 ); diff --git a/includes/specials/SpecialListUserRestrictions.php b/includes/specials/SpecialListUserRestrictions.php index 6c3817a117..27b2429822 100644 --- a/includes/specials/SpecialListUserRestrictions.php +++ b/includes/specials/SpecialListUserRestrictions.php @@ -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; diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 47ecfb32ca..74b118e205 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -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 ) ) { -- 2.20.1