r43270 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43269‎ | r43270 | r43271 >
Date:22:30, 6 November 2008
Author:siebrand
Status:old
Tags:
Comment:
Consistent casing for wfGetDB()
Modified paths:
  • /trunk/extensions/AuthorProtect/AuthorProtect.php (modified) (history)
  • /trunk/extensions/CategoryTests/CategoryTests.php (modified) (history)
  • /trunk/extensions/ChangeAuthor/ChangeAuthor.body.php (modified) (history)
  • /trunk/extensions/Invitations/Invitations_obj.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php (modified) (history)
  • /trunk/extensions/Translate/Stats.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUndelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiUndelete.php
@@ -67,7 +67,7 @@
6868 $params['timestamps'][$i] = wfTimestamp(TS_MW, $ts);
6969
7070 $pa = new PageArchive($titleObj);
71 - $dbw = wfGetDb(DB_MASTER);
 71+ $dbw = wfGetDB(DB_MASTER);
7272 $dbw->begin();
7373 $retval = $pa->undelete((isset($params['timestamps']) ? $params['timestamps'] : array()), $params['reason']);
7474 if(!is_array($retval))
Index: trunk/phase3/includes/Title.php
@@ -1623,7 +1623,7 @@
16241624
16251625 wfProfileIn( __METHOD__ );
16261626
1627 - $dbr = wfGetDb( DB_SLAVE );
 1627+ $dbr = wfGetDB( DB_SLAVE );
16281628
16291629 if ( $this->getNamespace() == NS_IMAGE ) {
16301630 $tables = array ('imagelinks', 'page_restrictions');
Index: trunk/extensions/CategoryTests/CategoryTests.php
@@ -65,7 +65,7 @@
6666 }
6767 $cattitle = Title::makeTitleSafe(NS_CATEGORY, $category);
6868 $catkey = $cattitle->getDBkey();
69 - $db = wfGetDb(DB_SLAVE);
 69+ $db = wfGetDB(DB_SLAVE);
7070 $res = $db->select(array('page', 'categorylinks'), 'cl_from', array(
7171 'page_id=cl_from',
7272 'page_namespace' => $ns,
@@ -89,7 +89,7 @@
9090 $page = $title->getDBkey();
9191 $ns = $title->getNamespace();
9292 }
93 - $db = wfGetDb(DB_SLAVE);
 93+ $db = wfGetDB(DB_SLAVE);
9494 $res = $db->select(array('page', 'categorylinks'), 'cl_from', array(
9595 'page_id=cl_from',
9696 'page_namespace' => $ns,
Index: trunk/extensions/AuthorProtect/AuthorProtect.php
@@ -151,7 +151,7 @@
152152 if(!$wgTitle instanceOf Title)
153153 return false; //quick hack to prevent the API from messing up.
154154 $id = $wgTitle->getArticleId();
155 - $dbr = wfGetDb(DB_SLAVE); //grab the slave for reading
 155+ $dbr = wfGetDB(DB_SLAVE); //grab the slave for reading
156156 $res = $dbr->query( "SELECT `rev_user` FROM `{$wgDBprefix}revision` WHERE rev_page={$id} LIMIT 1", __METHOD__ );
157157 $row = $dbr->fetchRow($res);
158158 return $wgUser->getID() == $row['rev_user'];
Index: trunk/extensions/ChangeAuthor/ChangeAuthor.body.php
@@ -210,7 +210,7 @@
211211 // $errMsg: Error message
212212 // Returns: HTML.
213213 global $wgScript;
214 - $dbr = wfGetDb(DB_SLAVE);
 214+ $dbr = wfGetDB(DB_SLAVE);
215215 $res = $dbr->select(
216216 'revision',
217217 Revision::selectFields(),
@@ -314,7 +314,7 @@
315315 {
316316 // Changes revision authors in the database
317317 // $authors: array, key=revid value=array(User from, User to)
318 - $dbw = wfGetDb(DB_MASTER);
 318+ $dbw = wfGetDB(DB_MASTER);
319319 $dbw->begin();
320320 $editcounts = array(); // Array to keep track of EC mutations; key=userid, value=mutation
321321 $log = new LogPage('changeauth');
Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php
@@ -444,7 +444,7 @@
445445 $article = new Article( $cspanTitle );
446446 $mRestrictions['edit']['sysop'] = true;
447447 $expiry = Block::infinity();
448 - $dbw = wfGetDb( DB_MASTER );
 448+ $dbw = wfGetDB( DB_MASTER );
449449 $dbw->begin();
450450 $ok = $article->updateRestrictions( $mRestrictions, wfMsg( 'mv_source_material' ), false, $expiry );
451451 if ( $ok ) {
Index: trunk/extensions/Translate/Stats.php
@@ -176,7 +176,7 @@
177177
178178 protected function getData( FormOptions $opts ) {
179179 global $wgLang, $wgTranslateMessageNamespaces;
180 - $dbr = wfGetDb( DB_SLAVE );
 180+ $dbr = wfGetDB( DB_SLAVE );
181181
182182 $now = time();
183183 $cutoff = $now - ( 3600 * 24 * $opts->getValue( 'days' ) - 1 );
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php
@@ -928,7 +928,7 @@
929929
930930 function optionAttributeValueExists($objectId, $optionId) {
931931 $dc=wdGetDataSetContext();
932 - $dbr =& wfGetDb(DB_SLAVE);
 932+ $dbr =& wfGetDB(DB_SLAVE);
933933 $queryResult = $dbr->query("SELECT value_id FROM {$dc}_option_attribute_values" .
934934 ' WHERE object_id = ' . $objectId .
935935 ' AND option_id = ' . $optionId .
@@ -945,7 +945,7 @@
946946 $dc=wdGetDataSetContext();
947947 $valueId = newObjectId("{$dc}_option_attribute_values");
948948
949 - $dbr =& wfGetDb(DB_MASTER);
 949+ $dbr =& wfGetDB(DB_MASTER);
950950 $sql = "INSERT INTO {$dc}_option_attribute_values(value_id,object_id,option_id,add_transaction_id)" .
951951 ' VALUES(' . $valueId .
952952 ',' . $objectId .
Index: trunk/extensions/Invitations/Invitations_obj.php
@@ -41,7 +41,7 @@
4242 if (!is_array($wgInvitationTypes[$feature]))
4343 return false;
4444
45 - $dbr = wfGetDb( DB_SLAVE );
 45+ $dbr = wfGetDB( DB_SLAVE );
4646
4747 $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(inv_timestamp)' :
4848 'EXTRACT(epoch FROM inv_timestamp)';
@@ -69,7 +69,7 @@
7070 if ($user === null)
7171 $user = $wgUser;
7272
73 - $dbr = wfGetDb( DB_SLAVE );
 73+ $dbr = wfGetDB( DB_SLAVE );
7474
7575 $res = $dbr->select( 'invitation', array( 'inv_type' ), array( 'inv_invitee' => $user->getId() ) );
7676
@@ -149,7 +149,7 @@
150150 if (!Invitations::checkDelay( $feature, $user, $accountAge ))
151151 return false;
152152
153 - $dbr = wfGetDb( DB_SLAVE );
 153+ $dbr = wfGetDB( DB_SLAVE );
154154
155155 $res = $dbr->select( 'invite_count',
156156 array( 'ic_count' ),
@@ -210,7 +210,7 @@
211211 $count = Invitations::getRemainingInvites( $feature, $user );
212212
213213 if ($count) {
214 - $dbw = wfGetDb( DB_MASTER );
 214+ $dbw = wfGetDB( DB_MASTER );
215215
216216 $dbw->replace( 'invite_count', array ('ic_user', 'ic_type'),
217217 array( 'ic_user' => $user->getId(), 'ic_type' => $feature, 'ic_count' => $count ),

Status & tagging log