r50947 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50946‎ | r50947 | r50948 >
Date:08:29, 24 May 2009
Author:siebrand
Status:ok
Tags:
Comment:
Proper casing for getDBkey()
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Category.php (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategoryInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalRepo.php (modified) (history)
  • /trunk/phase3/includes/parser/CoreParserFunctions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialExport.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListUserRestrictions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMovepage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -112,7 +112,7 @@
113113 array(
114114 'rd_from' => $this->getID(),
115115 'rd_namespace' => $retval->getNamespace(),
116 - 'rd_title' => $retval->getDBKey()
 116+ 'rd_title' => $retval->getDBkey()
117117 ),
118118 __METHOD__
119119 );
@@ -2619,7 +2619,7 @@
26202620 $dbw->delete( 'recentchanges',
26212621 array( 'rc_type != '.RC_LOG,
26222622 'rc_namespace' => $this->mTitle->getNamespace(),
2623 - 'rc_title' => $this->mTitle->getDBKey() ),
 2623+ 'rc_title' => $this->mTitle->getDBkey() ),
26242624 __METHOD__ );
26252625 $dbw->delete( 'recentchanges',
26262626 array( 'rc_type != '.RC_LOG, 'rc_cur_id' => $id ),
Index: trunk/phase3/includes/parser/CoreParserFunctions.php
@@ -175,7 +175,7 @@
176176 if( !is_null( $title ) ) {
177177 # Convert NS_MEDIA -> NS_FILE
178178 if( $title->getNamespace() == NS_MEDIA ) {
179 - $title = Title::makeTitle( NS_FILE, $title->getDBKey() );
 179+ $title = Title::makeTitle( NS_FILE, $title->getDBkey() );
180180 }
181181 if( !is_null( $arg ) ) {
182182 $text = $title->$func( $arg );
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -642,7 +642,7 @@
643643 $fields = OldLocalFile::selectFields();
644644 $conds = $opts = $join_conds = array();
645645 $eq = $inc ? "=" : "";
646 - $conds[] = "oi_name = " . $dbr->addQuotes( $this->title->getDBKey() );
 646+ $conds[] = "oi_name = " . $dbr->addQuotes( $this->title->getDBkey() );
647647 if( $start ) {
648648 $conds[] = "oi_timestamp <$eq " . $dbr->addQuotes( $dbr->timestamp( $start ) );
649649 }
@@ -1796,7 +1796,7 @@
17971797 $this->file = $file;
17981798 $this->target = $target;
17991799 $this->oldHash = $this->file->repo->getHashPath( $this->file->getName() );
1800 - $this->newHash = $this->file->repo->getHashPath( $this->target->getDBKey() );
 1800+ $this->newHash = $this->file->repo->getHashPath( $this->target->getDBkey() );
18011801 $this->oldName = $this->file->getName();
18021802 $this->newName = $this->file->repo->getNameFromTitle( $this->target );
18031803 $this->oldRel = $this->oldHash . $this->oldName;
Index: trunk/phase3/includes/filerepo/LocalRepo.php
@@ -127,7 +127,7 @@
128128 'page_id', //Field
129129 array( //Conditions
130130 'page_namespace' => $title->getNamespace(),
131 - 'page_title' => $title->getDBKey(),
 131+ 'page_title' => $title->getDBkey(),
132132 ),
133133 __METHOD__ //Function name
134134 );
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php
@@ -110,7 +110,7 @@
111111 else
112112 $this->addFields($resultPageSet->getPageTableFields());
113113 $this->addFields('page_is_redirect');
114 - $this->addWhereFld($this->bl_title, $this->rootTitle->getDBKey());
 114+ $this->addWhereFld($this->bl_title, $this->rootTitle->getDBkey());
115115 if($this->hasNS)
116116 $this->addWhereFld($this->bl_ns, $this->rootTitle->getNamespace());
117117 $this->addWhereFld('page_namespace', $this->params['namespace']);
@@ -143,14 +143,14 @@
144144 // We can't use LinkBatch here because $this->hasNS may be false
145145 $titleWhere = array();
146146 foreach($this->redirTitles as $t)
147 - $titleWhere[] = "{$this->bl_title} = ".$db->addQuotes($t->getDBKey()).
 147+ $titleWhere[] = "{$this->bl_title} = ".$db->addQuotes($t->getDBkey()).
148148 ($this->hasNS ? " AND {$this->bl_ns} = '{$t->getNamespace()}'" : "");
149149 $this->addWhere($db->makeList($titleWhere, LIST_OR));
150150 $this->addWhereFld('page_namespace', $this->params['namespace']);
151151 if(!is_null($this->redirID))
152152 {
153153 $first = $this->redirTitles[0];
154 - $title = $db->strencode($first->getDBKey());
 154+ $title = $db->strencode($first->getDBkey());
155155 $ns = $first->getNamespace();
156156 $from = $this->redirID;
157157 if($this->hasNS)
Index: trunk/phase3/includes/api/ApiQueryCategoryInfo.php
@@ -53,7 +53,7 @@
5454 foreach($categories as $c)
5555 {
5656 $t = $titles[$c];
57 - $cattitles[$c] = $t->getDBKey();
 57+ $cattitles[$c] = $t->getDBkey();
5858 }
5959
6060 $this->addTables(array('category', 'page', 'page_props'));
Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -301,10 +301,10 @@
302302 $this->protections[$title->getNamespace()][$title->getDBkey()];
303303 $this->getResult()->setIndexedTagName($pageInfo['protection'], 'pr');
304304 }
305 - if($this->fld_talkid && isset($this->talkids[$title->getNamespace()][$title->getDBKey()]))
306 - $pageInfo['talkid'] = $this->talkids[$title->getNamespace()][$title->getDBKey()];
307 - if($this->fld_subjectid && isset($this->subjectids[$title->getNamespace()][$title->getDBKey()]))
308 - $pageInfo['subjectid'] = $this->subjectids[$title->getNamespace()][$title->getDBKey()];
 305+ if($this->fld_talkid && isset($this->talkids[$title->getNamespace()][$title->getDBkey()]))
 306+ $pageInfo['talkid'] = $this->talkids[$title->getNamespace()][$title->getDBkey()];
 307+ if($this->fld_subjectid && isset($this->subjectids[$title->getNamespace()][$title->getDBkey()]))
 308+ $pageInfo['subjectid'] = $this->subjectids[$title->getNamespace()][$title->getDBkey()];
309309 if($this->fld_url) {
310310 $pageInfo['fullurl'] = $title->getFullURL();
311311 $pageInfo['editurl'] = $title->getFullURL('action=edit');
@@ -404,7 +404,7 @@
405405 $images = $others = array();
406406 foreach ($this->everything as $title)
407407 if ($title->getNamespace() == NS_FILE)
408 - $images[] = $title->getDBKey();
 408+ $images[] = $title->getDBkey();
409409 else
410410 $others[] = $title;
411411
Index: trunk/phase3/includes/Title.php
@@ -2599,7 +2599,7 @@
26002600 if( $nt->getText() != wfStripIllegalFilenameChars( $nt->getText() ) ) {
26012601 $errors[] = array('imageinvalidfilename');
26022602 }
2603 - if( !File::checkExtensionCompatibility( $file, $nt->getDBKey() ) ) {
 2603+ if( !File::checkExtensionCompatibility( $file, $nt->getDBkey() ) ) {
26042604 $errors[] = array('imagetypemismatch');
26052605 }
26062606 }
@@ -3018,8 +3018,8 @@
30193019 // don't move it twice
30203020 continue;
30213021 $newPageName = preg_replace(
3022 - '#^'.preg_quote( $this->getDBKey(), '#' ).'#',
3023 - $nt->getDBKey(), $oldSubpage->getDBKey() );
 3022+ '#^'.preg_quote( $this->getDBkey(), '#' ).'#',
 3023+ $nt->getDBkey(), $oldSubpage->getDBkey() );
30243024 if( $oldSubpage->isTalkPage() ) {
30253025 $newNs = $nt->getTalkPage()->getNamespace();
30263026 } else {
@@ -3381,7 +3381,7 @@
33823382 case NS_FILE:
33833383 return wfFindFile( $this ); // file exists, possibly in a foreign repo
33843384 case NS_SPECIAL:
3385 - return SpecialPage::exists( $this->getDBKey() ); // valid special page
 3385+ return SpecialPage::exists( $this->getDBkey() ); // valid special page
33863386 case NS_MAIN:
33873387 return $this->mDbkeyform == ''; // selflink, possibly with fragment
33883388 case NS_MEDIAWIKI:
Index: trunk/phase3/includes/specials/SpecialAllpages.php
@@ -125,8 +125,8 @@
126126
127127 $from = Title::makeTitleSafe( $namespace, $from );
128128 $to = Title::makeTitleSafe( $namespace, $to );
129 - $from = ( $from && $from->isLocal() ) ? $from->getDBKey() : null;
130 - $to = ( $to && $to->isLocal() ) ? $to->getDBKey() : null;
 129+ $from = ( $from && $from->isLocal() ) ? $from->getDBkey() : null;
 130+ $to = ( $to && $to->isLocal() ) ? $to->getDBkey() : null;
131131
132132 if( isset($from) )
133133 $where[] = 'page_title >= '.$dbr->addQuotes( $from );
Index: trunk/phase3/includes/specials/SpecialExport.php
@@ -389,7 +389,7 @@
390390 array_merge( $join,
391391 array(
392392 'page_namespace' => $title->getNamespace(),
393 - 'page_title' => $title->getDBKey() ) ),
 393+ 'page_title' => $title->getDBkey() ) ),
394394 __METHOD__ );
395395 foreach( $result as $row ) {
396396 $template = Title::makeTitle( $row->namespace, $row->title );
Index: trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php
@@ -73,7 +73,7 @@
7474 if( $title && $title->getText() != '' ) {
7575 $dbr = wfGetDB( DB_SLAVE );
7676 $image = $dbr->tableName( 'image' );
77 - $encFilename = $dbr->addQuotes( htmlspecialchars( $title->getDBKey() ) );
 77+ $encFilename = $dbr->addQuotes( htmlspecialchars( $title->getDBkey() ) );
7878 $sql = "SELECT img_sha1 from $image where img_name = $encFilename";
7979 $res = $dbr->query( $sql );
8080 $row = $dbr->fetchRow( $res );
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -69,7 +69,7 @@
7070 return $this->tryShowFile( $this->file );
7171 }
7272 # Logs must have a type given
73 - if( $this->logids && !strpos($this->page->getDBKey(),'/') ) {
 73+ if( $this->logids && !strpos($this->page->getDBkey(),'/') ) {
7474 return $wgOut->showErrorPage( 'revdelete-nologtype-title', 'revdelete-nologtype-text' );
7575 }
7676 # Give a link to the logs/hist for this page
@@ -270,7 +270,7 @@
271271 $result = $dbr->select( 'archive', '*',
272272 array(
273273 'ar_namespace' => $this->page->getNamespace(),
274 - 'ar_title' => $this->page->getDBKey(),
 274+ 'ar_title' => $this->page->getDBkey(),
275275 'ar_timestamp' => $where
276276 ),
277277 __METHOD__
@@ -372,11 +372,11 @@
373373 if( $this->deleteKey == 'oldimage' ) {
374374 // Run through and pull all our data in one query
375375 foreach( $this->ofiles as $timestamp ) {
376 - $where[] = $timestamp.'!'.$this->page->getDBKey();
 376+ $where[] = $timestamp.'!'.$this->page->getDBkey();
377377 }
378378 $result = $dbr->select( 'oldimage', '*',
379379 array(
380 - 'oi_name' => $this->page->getDBKey(),
 380+ 'oi_name' => $this->page->getDBkey(),
381381 'oi_archive_name' => $where
382382 ),
383383 __METHOD__
@@ -388,7 +388,7 @@
389389 }
390390 // Check through our images
391391 foreach( $this->ofiles as $timestamp ) {
392 - $archivename = $timestamp.'!'.$this->page->getDBKey();
 392+ $archivename = $timestamp.'!'.$this->page->getDBkey();
393393 if( !isset($filesObjs[$archivename]) ) {
394394 continue;
395395 } else if( !$filesObjs[$archivename]->userCan(File::DELETED_RESTRICTED) ) {
@@ -411,7 +411,7 @@
412412 }
413413 $result = $dbr->select( 'filearchive', '*',
414414 array(
415 - 'fa_name' => $this->page->getDBKey(),
 415+ 'fa_name' => $this->page->getDBkey(),
416416 'fa_id' => $where
417417 ),
418418 __METHOD__
@@ -501,7 +501,7 @@
502502 foreach( $this->events as $logid ) {
503503 $where[] = intval($logid);
504504 }
505 - list($log,$logtype) = explode( '/',$this->page->getDBKey(), 2 );
 505+ list($log,$logtype) = explode( '/',$this->page->getDBkey(), 2 );
506506 $result = $dbr->select( 'logging', '*',
507507 array( 'log_type' => $logtype, 'log_id' => $where ),
508508 __METHOD__
@@ -960,7 +960,7 @@
961961 $result = $this->dbw->select( 'archive', '*',
962962 array(
963963 'ar_namespace' => $title->getNamespace(),
964 - 'ar_title' => $title->getDBKey(),
 964+ 'ar_title' => $title->getDBkey(),
965965 'ar_timestamp' => $where
966966 ), __METHOD__
967967 );
@@ -1026,10 +1026,10 @@
10271027 $set = array();
10281028 // Run through and pull all our data in one query
10291029 foreach( $items as $timestamp ) {
1030 - $where[] = $timestamp.'!'.$title->getDBKey();
 1030+ $where[] = $timestamp.'!'.$title->getDBkey();
10311031 }
10321032 $result = $this->dbw->select( 'oldimage', '*',
1033 - array( 'oi_name' => $title->getDBKey(), 'oi_archive_name' => $where ),
 1033+ array( 'oi_name' => $title->getDBkey(), 'oi_archive_name' => $where ),
10341034 __METHOD__
10351035 );
10361036 while( $row = $this->dbw->fetchObject( $result ) ) {
@@ -1039,7 +1039,7 @@
10401040 }
10411041 // To work!
10421042 foreach( $items as $timestamp ) {
1043 - $archivename = $timestamp.'!'.$title->getDBKey();
 1043+ $archivename = $timestamp.'!'.$title->getDBkey();
10441044 if( !isset($filesObjs[$archivename]) ) {
10451045 $success = false;
10461046 continue; // Must exist
@@ -1121,7 +1121,7 @@
11221122 $where[] = intval($id);
11231123 }
11241124 $result = $this->dbw->select( 'filearchive', '*',
1125 - array( 'fa_name' => $title->getDBKey(),
 1125+ array( 'fa_name' => $title->getDBkey(),
11261126 'fa_id' => $where ),
11271127 __METHOD__ );
11281128 while( $row = $this->dbw->fetchObject( $result ) ) {
@@ -1175,7 +1175,7 @@
11761176 foreach( $items as $logid ) {
11771177 $where[] = intval($logid);
11781178 }
1179 - list($log,$logtype) = explode( '/',$title->getDBKey(), 2 );
 1179+ list($log,$logtype) = explode( '/',$title->getDBkey(), 2 );
11801180 $result = $this->dbw->select( 'logging', '*',
11811181 array( 'log_type' => $logtype, 'log_id' => $where ),
11821182 __METHOD__
@@ -1348,7 +1348,7 @@
13491349 $this->dbw->update( 'archive',
13501350 array( 'ar_deleted' => $bitfield ),
13511351 array( 'ar_namespace' => $title->getNamespace(),
1352 - 'ar_title' => $title->getDBKey(),
 1352+ 'ar_title' => $title->getDBkey(),
13531353 // use timestamp for index
13541354 'ar_timestamp' => $this->dbw->timestamp( $rev->getTimestamp() ),
13551355 'ar_rev_id' => $rev->getId()
Index: trunk/phase3/includes/specials/SpecialBlockip.php
@@ -527,7 +527,7 @@
528528 $delAction = LogPage::DELETED_ACTION | Revision::DELETED_RESTRICTED;
529529 # Normalize user name
530530 $userTitle = Title::makeTitleSafe( NS_USER, $name );
531 - $userDbKey = $userTitle->getDBKey();
 531+ $userDbKey = $userTitle->getDBkey();
532532 # To suppress, we OR the current bitfields with Revision::DELETED_USER
533533 # to put a 1 in the username *_deleted bit. To unsuppress we AND the
534534 # current bitfields with the inverse of Revision::DELETED_USER. The
Index: trunk/phase3/includes/specials/SpecialMovepage.php
@@ -422,7 +422,7 @@
423423 } elseif( $this->moveTalk ) {
424424 $conds = array(
425425 'page_namespace' => $ot->getTalkPage()->getNamespace(),
426 - 'page_title' => $ot->getDBKey()
 426+ 'page_title' => $ot->getDBkey()
427427 );
428428 } else {
429429 # Skip the query
@@ -450,9 +450,9 @@
451451 }
452452
453453 $newPageName = preg_replace(
454 - '#^'.preg_quote( $ot->getDBKey(), '#' ).'#',
455 - $nt->getDBKey(),
456 - $oldSubpage->getDBKey()
 454+ '#^'.preg_quote( $ot->getDBkey(), '#' ).'#',
 455+ $nt->getDBkey(),
 456+ $oldSubpage->getDBkey()
457457 );
458458 if( $oldSubpage->isTalkPage() ) {
459459 $newNs = $nt->getTalkPage()->getNamespace();
Index: trunk/phase3/includes/specials/SpecialListUserRestrictions.php
@@ -73,7 +73,7 @@
7474 $title = Title::newFromText( $page );
7575 if( $title ) {
7676 $conds['ur_page_namespace'] = $title->getNamespace();
77 - $conds['ur_page_title'] = $title->getDBKey();
 77+ $conds['ur_page_title'] = $title->getDBkey();
7878 }
7979
8080 return $conds;
Index: trunk/phase3/includes/LogPage.php
@@ -332,7 +332,7 @@
333333 break;
334334 default:
335335 if( $title->getNamespace() == NS_SPECIAL ) {
336 - list( $name, $par ) = SpecialPage::resolveAliasWithSubpage( $title->getDBKey() );
 336+ list( $name, $par ) = SpecialPage::resolveAliasWithSubpage( $title->getDBkey() );
337337 # Use the language name for log titles, rather than Log/X
338338 if( $name == 'Log' ) {
339339 $titleLink = '('.$skin->link( $title, LogPage::logName( $par ) ).')';
Index: trunk/phase3/includes/Category.php
@@ -26,7 +26,7 @@
2727 */
2828 protected function initialize() {
2929 if ( $this->mName === null && $this->mTitle )
30 - $this->mName = $title->getDBKey();
 30+ $this->mName = $title->getDBkey();
3131
3232 if( $this->mName === null && $this->mID === null ) {
3333 throw new MWException( __METHOD__.' has both names and IDs null' );
@@ -50,7 +50,7 @@
5151 if ( $this->mTitle ) {
5252 # If there is a title object but no record in the category table, treat this as an empty category
5353 $this->mID = false;
54 - $this->mName = $this->mTitle->getDBKey();
 54+ $this->mName = $this->mTitle->getDBkey();
5555 $this->mPages = 0;
5656 $this->mSubcats = 0;
5757 $this->mFiles = 0;
@@ -91,7 +91,7 @@
9292 }
9393
9494 $cat->mTitle = $title;
95 - $cat->mName = $title->getDBKey();
 95+ $cat->mName = $title->getDBkey();
9696
9797 return $cat;
9898 }
@@ -106,7 +106,7 @@
107107 $cat = new self();
108108
109109 $cat->mTitle = $title;
110 - $cat->mName = $title->getDBKey();
 110+ $cat->mName = $title->getDBkey();
111111
112112 return $cat;
113113 }
@@ -149,7 +149,7 @@
150150 # but we can't know that here...
151151 return false;
152152 } else {
153 - $cat->mName = $title->getDBKey(); # if we have a title object, fetch the category name from there
 153+ $cat->mName = $title->getDBkey(); # if we have a title object, fetch the category name from there
154154 }
155155
156156 $cat->mID = false;

Status & tagging log