r44638 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44637‎ | r44638 | r44639 >
Date:23:32, 15 December 2008
Author:aaron
Status:ok
Tags:
Comment:
NS_IMAGE -> NS_FILE
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -72,10 +72,10 @@
7373 $wgFlaggedRevsLowProfile = true;
7474
7575 # Allowed namespaces of reviewable pages
76 -$wgFlaggedRevsNamespaces = array( NS_MAIN, NS_IMAGE, NS_TEMPLATE );
 76+$wgFlaggedRevsNamespaces = array( NS_MAIN, NS_FILE, NS_TEMPLATE );
7777 # Patrollable namespaces (overridden by reviewable namespaces)
7878 $wgFlaggedRevsPatrolNamespaces = array();
79 -#$wgFlaggedRevsPatrolNamespaces = array( NS_CATEGORY, NS_IMAGE, NS_TEMPLATE );
 79+#$wgFlaggedRevsPatrolNamespaces = array( NS_CATEGORY, NS_FILE, NS_TEMPLATE );
8080
8181 # Pages exempt from reviewing
8282 $wgFlaggedRevsWhitelist = array();
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -1041,7 +1041,7 @@
10421042 array( 'fi_rev_id' => $frev->getRevId() ),
10431043 __METHOD__,
10441044 array(), /* OPTIONS */
1045 - array( 'page' => array('LEFT JOIN','page_namespace = '. NS_IMAGE .' AND page_title = fi_name'),
 1045+ array( 'page' => array('LEFT JOIN','page_namespace = '. NS_FILE .' AND page_title = fi_name'),
10461046 'image' => array('LEFT JOIN','img_name = fi_name'),
10471047 'flaggedpages' => array('LEFT JOIN','fp_page_id = page_id'),
10481048 'flaggedrevs' => array('LEFT JOIN','fr_page_id = fp_page_id AND fr_rev_id = fp_stable') )
@@ -1055,7 +1055,7 @@
10561056 }
10571057 $imgChanges = array();
10581058 while( $row = $dbr->fetchObject( $ret ) ) {
1059 - $title = Title::makeTitle( NS_IMAGE, $row->fi_name );
 1059+ $title = Title::makeTitle( NS_FILE, $row->fi_name );
10601060 // stable time -> time when reviewed (unless the other is newer)
10611061 $timestamp = isset($row->fr_img_timestamp) && $row->fr_img_timestamp >= $row->fi_img_timestamp ?
10621062 $row->fr_img_timestamp : $row->fi_img_timestamp;
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -475,7 +475,7 @@
476476 public static function getFileVersionFromCache( $revId, $dbKey ) {
477477 self::load();
478478 if( isset(self::$includeVersionCache[$revId]) ) {
479 - # All NS_IMAGE, no need to check namespace
 479+ # All NS_FILE, no need to check namespace
480480 if( isset(self::$includeVersionCache[$revId]['files'][$dbKey]) ) {
481481 $time_SHA1 = self::$includeVersionCache[$revId]['files'][$dbKey];
482482 foreach( $time_SHA1 as $time => $sha1 ) {
@@ -876,8 +876,8 @@
877877 */
878878 public static function isPageReviewable( $title ) {
879879 global $wgFlaggedRevsNamespaces, $wgFlaggedRevsWhitelist;
880 - # FIXME: Treat NS_MEDIA as NS_IMAGE
881 - $ns = ( $title->getNamespace() == NS_MEDIA ) ? NS_IMAGE : $title->getNamespace();
 880+ # FIXME: Treat NS_MEDIA as NS_FILE
 881+ $ns = ( $title->getNamespace() == NS_MEDIA ) ? NS_FILE : $title->getNamespace();
882882 # Check for MW: pages and whitelist for exempt pages
883883 if( $ns == NS_MEDIAWIKI || in_array( $title->getPrefixedDBKey(), $wgFlaggedRevsWhitelist ) ) {
884884 return false;
@@ -892,8 +892,8 @@
893893 */
894894 public static function isPageRateable( $title ) {
895895 global $wgFeedbackNamespaces, $wgFlaggedRevsWhitelist;
896 - # FIXME: Treat NS_MEDIA as NS_IMAGE
897 - $ns = ( $title->getNamespace() == NS_MEDIA ) ? NS_IMAGE : $title->getNamespace();
 896+ # FIXME: Treat NS_MEDIA as NS_FILE
 897+ $ns = ( $title->getNamespace() == NS_MEDIA ) ? NS_FILE : $title->getNamespace();
898898 # Check for MW: pages and whitelist for exempt pages
899899 if( $ns == NS_MEDIAWIKI || in_array( $title->getPrefixedDBKey(), $wgFlaggedRevsWhitelist ) ) {
900900 return false;
@@ -912,8 +912,8 @@
913913 if( self::isPageReviewable($title) ) {
914914 return false;
915915 }
916 - # FIXME: Treat NS_MEDIA as NS_IMAGE
917 - $ns = ( $title->getNamespace() == NS_MEDIA ) ? NS_IMAGE : $title->getNamespace();
 916+ # FIXME: Treat NS_MEDIA as NS_FILE
 917+ $ns = ( $title->getNamespace() == NS_MEDIA ) ? NS_FILE : $title->getNamespace();
918918 return ( in_array($ns,$wgFlaggedRevsPatrolNamespaces) && !$title->isTalkPage() );
919919 }
920920
@@ -1053,7 +1053,7 @@
10541054
10551055 # If this is an image page, store corresponding file info
10561056 $fileData = array();
1057 - if( $title->getNamespace() == NS_IMAGE && $file = wfFindFile($title) ) {
 1057+ if( $title->getNamespace() == NS_FILE && ($file = wfFindFile($title)) ) {
10581058 $fileData['name'] = $title->getDBkey();
10591059 $fileData['timestamp'] = $file->getTimestamp();
10601060 $fileData['sha1'] = $file->getSha1();
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -200,7 +200,7 @@
201201 }
202202 foreach( $parserOut->getImages() as $image => $n ) {
203203 if( !isset($linksUpdate->mImages[$image]) ) {
204 - self::addLink( $links, NS_IMAGE, $image );
 204+ self::addLink( $links, NS_FILE, $image );
205205 }
206206 }
207207 foreach( $parserOut->getTemplates() as $ns => $titles ) {
@@ -374,8 +374,8 @@
375375 }
376376 $file = null;
377377 $dbr = wfGetDB( DB_SLAVE );
378 - # Normalize NS_MEDIA to NS_IMAGE
379 - $title = $nt->getNamespace() == NS_IMAGE ? $nt : Title::makeTitle( NS_IMAGE, $nt->getDBKey() );
 378+ # Normalize NS_MEDIA to NS_FILE
 379+ $title = $nt->getNamespace() == NS_FILE ? $nt : Title::makeTitle( NS_FILE, $nt->getDBKey() );
380380 # Check for stable version of image if this feature is enabled.
381381 # Should be in reviewable namespace, this saves unneeded DB checks as
382382 # well as enforce site settings if they are later changed.
@@ -442,7 +442,7 @@
443443 */
444444 public static function galleryFindStableFileTime( $ig, $nt, &$time, &$query=false ) {
445445 # Trigger for stable version parsing only
446 - if( empty($ig->mParser->fr_isStable) || $nt->getNamespace() != NS_IMAGE ) {
 446+ if( empty($ig->mParser->fr_isStable) || $nt->getNamespace() != NS_FILE ) {
447447 return true;
448448 }
449449 $file = null;
@@ -535,7 +535,7 @@
536536 if( !empty($parser->mOutput->mImages) ) {
537537 foreach( $parser->mOutput->mImages as $filename => $x ) {
538538 # FIXME: it would be nice not to double fetch these!
539 - $file = wfFindFile( Title::makeTitleSafe( NS_IMAGE, $filename ) );
 539+ $file = wfFindFile( Title::makeTitleSafe( NS_FILE, $filename ) );
540540 $parser->mOutput->fr_ImageSHA1Keys[$filename] = array();
541541 if( $file ) {
542542 # Bug 15748, be lax about commons image sync status

Status & tagging log