r38103 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38102‎ | r38103 | r38104 >
Date:18:09, 27 July 2008
Author:ialex
Status:old
Tags:
Comment:
Fix comment (Title::newFromTitle -> Title::newFromName) and mark Title::nameOf() as public static instead of doing this with in comments
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -4,21 +4,22 @@
55 * @file
66 */
77
8 -/** */
98 if ( !class_exists( 'UtfNormal' ) ) {
109 require_once( dirname(__FILE__) . '/normal/UtfNormal.php' );
1110 }
1211
1312 define ( 'GAID_FOR_UPDATE', 1 );
1413
15 -# Title::newFromTitle maintains a cache to avoid
16 -# expensive re-normalization of commonly used titles.
17 -# On a batch operation this can become a memory leak
18 -# if not bounded. After hitting this many titles,
19 -# reset the cache.
 14+/**
 15+ * Title::newFromText maintains a cache to avoid expensive re-normalization of
 16+ * commonly used titles. On a batch operation this can become a memory leak
 17+ * if not bounded. After hitting this many titles reset the cache.
 18+ */
2019 define( 'MW_TITLECACHE_MAX', 1000 );
2120
22 -# Constants for pr_cascade bitfield
 21+/**
 22+ * Constants for pr_cascade bitfield
 23+ */
2324 define( 'CASCADE', 1 );
2425
2526 /**
@@ -325,17 +326,14 @@
326327 * @param int $id the page_id of the article
327328 * @return Title an object representing the article, or NULL
328329 * if no such article was found
329 - * @static
330 - * @access public
331330 */
332 - function nameOf( $id ) {
333 - $fname = 'Title::nameOf';
 331+ public static function nameOf( $id ) {
334332 $dbr = wfGetDB( DB_SLAVE );
335333
336 - $s = $dbr->selectRow( 'page', array( 'page_namespace','page_title' ), array( 'page_id' => $id ), $fname );
 334+ $s = $dbr->selectRow( 'page', array( 'page_namespace','page_title' ), array( 'page_id' => $id ), __METHOD__ );
337335 if ( $s === false ) { return NULL; }
338336
339 - $n = Title::makeName( $s->page_namespace, $s->page_title );
 337+ $n = self::makeName( $s->page_namespace, $s->page_title );
340338 return $n;
341339 }
342340

Status & tagging log