r48578 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48577‎ | r48578 | r48579 >
Date:12:34, 19 March 2009
Author:demon
Status:ok
Tags:
Comment:
No more Image::newFromName/newFromTitle. wfFindFile() takes strings or titles.
Modified paths:
  • /trunk/extensions/Click/Click.php (modified) (history)
  • /trunk/extensions/FileSearch/FileSearchIndexer.php (modified) (history)
  • /trunk/extensions/Gnuplot/Gnuplot.php (modified) (history)
  • /trunk/extensions/Icon/Icon.php (modified) (history)
  • /trunk/extensions/ImageMap/ImageMap_body.php (modified) (history)
  • /trunk/extensions/ImageTagging/ImageTagging.php (modified) (history)
  • /trunk/extensions/ImageTagging/ImageTagging_body.php (modified) (history)
  • /trunk/extensions/Logo/Logo.php (modified) (history)
  • /trunk/extensions/MiniPreview/MiniPreview.php (modified) (history)
  • /trunk/extensions/News/NewsRenderer.php (modified) (history)
  • /trunk/extensions/Player/PlayerClass.php (modified) (history)
  • /trunk/extensions/ProofreadPage/ProofreadPage.php (modified) (history)
  • /trunk/extensions/RDF/Rdf.php (modified) (history)
  • /trunk/extensions/RdfRedland/Modelers/Image.php (modified) (history)
  • /trunk/extensions/SmoothGallery/SmoothGalleryParser.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php (modified) (history)
  • /trunk/extensions/TreeAndMenu/TreeAndMenu.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Gnuplot/Gnuplot.php
@@ -147,6 +147,6 @@
148148 * Output : the filesystem path for the file
149149 */
150150 function getSourceDataPath ( $name ) {
151 - $h = Image::newFromName($name);
 151+ $h = wfFindFile($name);
152152 return $h->exists() ? $h->getImagePath() : null;
153153 }
Index: trunk/extensions/RDF/Rdf.php
@@ -644,7 +644,7 @@
645645 'MwRdfImage');
646646
647647 while ($res && $row = $dbr->fetchObject($res)) {
648 - $img = Image::newFromName($row->il_to);
 648+ $img = wfFindFile($row->il_to);
649649 if ($img->exists()) {
650650 $iuri = $img->getURL();
651651 if ($iuri[0] == '/') {
Index: trunk/extensions/ImageMap/ImageMap_body.php
@@ -98,7 +98,7 @@
9999 $imageObj = wfFindFile( $imageTitle );
100100 } else {
101101 // Old MW
102 - $imageObj = Image::newFromTitle( $imageTitle );
 102+ $imageObj = wfFindFile( $imageTitle );
103103 }
104104 if ( !$imageObj || !$imageObj->exists() ) {
105105 return self::error( 'imagemap_invalid_image' );
Index: trunk/extensions/Icon/Icon.php
@@ -57,7 +57,7 @@
5858
5959 // check if we are dealing with an InterWiki link
6060 if ( $ititle->isLocal() ) {
61 - $image = Image::newFromName( $img );
 61+ $image = wfFindFile( $img );
6262 if (!$image->exists())
6363 return '[[Image:'.$img.']]';
6464
Index: trunk/extensions/SmoothGallery/SmoothGalleryParser.php
@@ -203,7 +203,7 @@
204204 $imageArray = Array();
205205
206206 //Get the image object from the database
207 - $img_obj = Image::newFromTitle( $title );
 207+ $img_obj = wfFindFile( $title );
208208
209209 if ( !$img_obj->exists() ) {
210210 //The user asked for an image that doesn't exist, let's
Index: trunk/extensions/FileSearch/FileSearchIndexer.php
@@ -47,7 +47,7 @@
4848 if( $namespace == NS_IMAGE ) {
4949 wfDebugLog( 'filesearch', "Update called for `{$title}`" );
5050 $titleObj = Title::makeTitle( NS_IMAGE, $title );
51 - $image = Image::newFromTitle( $titleObj );
 51+ $image = wfFindFile( $titleObj );
5252 if ( !$image->exists() ) {
5353 wfDebugLog( 'filesearch', "Image does not exist: $title" );
5454 return;
Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.php
@@ -977,7 +977,7 @@
978978 if( $fanbox['fantag_image_name'] ){
979979 $fantag_image_width = 45;
980980 $fantag_image_height = 53;
981 - $fantag_image = Image::newFromName( $fanbox['fantag_image_name'] );
 981+ $fantag_image = wfFindFile( $fanbox['fantag_image_name'] );
982982 $fantag_image_url = $fantag_image->createThumb($fantag_image_width, $fantag_image_height);
983983 $fantag_image_tag = '<img alt="" src="' . $fantag_image_url . '"/>';
984984 };
Index: trunk/extensions/ProofreadPage/ProofreadPage.php
@@ -83,7 +83,7 @@
8484 }
8585 if ( !$imageTitle ) return;
8686
87 - $image = Image::newFromTitle( $imageTitle );
 87+ $image = wfFindFile( $imageTitle );
8888
8989 //if it is multipage, we use the page order of the file
9090 if( $image->exists() && $image->isMultiPage() ) {
@@ -298,7 +298,7 @@
299299 return true;
300300 }
301301
302 - $image = Image::newFromTitle( $imageTitle );
 302+ $image = wfFindFile( $imageTitle );
303303 if ( $image->exists() ) {
304304 $width = $image->getWidth();
305305 $height = $image->getHeight();
@@ -540,7 +540,7 @@
541541 if ( !$imageTitle ) {
542542 return true;
543543 }
544 - $image = Image::newFromTitle( $imageTitle );
 544+ $image = wfFindFile( $imageTitle );
545545 $return="";
546546
547547 if ( $image->isMultipage() ) {
Index: trunk/extensions/MiniPreview/MiniPreview.php
@@ -388,7 +388,7 @@
389389 function wfMiniPreviewGetImageData ( $image_titles , &$image_data ) {
390390 $image_data = array(); # Paranoia
391391 foreach ( $image_titles AS $i ) {
392 - $image_data[$i] = Image::newFromName( $i );
 392+ $image_data[$i] = wfFindFile( $i );
393393 $image_data[$i]->load();
394394 }
395395 }
Index: trunk/extensions/Player/PlayerClass.php
@@ -49,7 +49,7 @@
5050 static function newFromTitle( $title, $options, $sizeDefault = 'imagesize' ) {
5151 wfLoadExtensionMessages( 'Player' );
5252
53 - $image = Image::newFromTitle( $title );
 53+ $image = wfFindFile( $title );
5454 if ( !$image->exists() ) {
5555 throw new PlayerException(wfMsg("player-not-found"), 404);
5656 }
@@ -379,7 +379,7 @@
380380 $thumbstyle = '';
381381 $thumbimg = NULL;
382382 $thumbname = @$attributes['thumb'];
383 - if ($thumbname) $thumbimg = Image::newFromName( $thumbname );
 383+ if ($thumbname) $thumbimg = wfFindFile( $thumbname );
384384
385385 if ($thumbimg && $thumbimg->exists()) {
386386 $tni = $thumbimg->getThumbnail( $this->width, $this->height );
Index: trunk/extensions/ImageTagging/ImageTagging.php
@@ -94,7 +94,7 @@
9595 $tagName = preg_replace( "/[\"'<>]/", "", $tagName );
9696 $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
9797
98 - $img = Image::newFromName($imgName);
 98+ $img = wfFindFile($imgName);
9999 if ($img) {
100100 $imgTitle = $img->getTitle();
101101
@@ -150,7 +150,7 @@
151151 $tagName = preg_replace( "/[\"'<>]/", "", $tagName );
152152 $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
153153
154 - $img = Image::newFromName($imgName);
 154+ $img = wfFindFile($imgName);
155155 if ($img) {
156156 $imgTitle = $img->getTitle();
157157
Index: trunk/extensions/ImageTagging/ImageTagging_body.php
@@ -60,7 +60,7 @@
6161
6262 $res = $db->query($SQL);
6363 while ($o = $db->fetchObject($res)) {
64 - $img = Image::newFromName($o->img_name);
 64+ $img = wfFindFile($o->img_name);
6565 $this->add($img, '');
6666 }
6767 $db->freeResult($res);
@@ -236,4 +236,4 @@
237237 $s .= $this->pagerHTML('bottom');
238238 return $s;
239239 }
240 -} //class
\ No newline at end of file
 240+} //class
Index: trunk/extensions/Logo/Logo.php
@@ -20,7 +20,7 @@
2121 if( is_object( $title ) ) {
2222 if( $title->getNamespace() != NS_IMAGE )
2323 $title = Title::makeTitle( NS_IMAGE, $title->getText() );
24 - $logo = Image::newFromTitle( $title );
 24+ $logo = wfFindFile( $title );
2525 if( $logo->exists() )
2626 $wgLogo = $logo->createThumb( 135 );
2727 }
Index: trunk/extensions/RdfRedland/Modelers/Image.php
@@ -43,7 +43,7 @@
4444 array('il_from = ' . $this->Agent->getTitle()->getArticleID()),
4545 'MwRdfImage');
4646 while ($res && $row = $dbr->fetchObject($res)) {
47 - $img = Image::newFromName($row->il_to);
 47+ $img = wfFindFile($row->il_to);
4848 if ( ! $img->exists() ) continue;
4949 $iuri = $img->getURL();
5050 if ($iuri[0] == '/') $iuri = $wgServer . $iuri;
Index: trunk/extensions/TreeAndMenu/TreeAndMenu.php
@@ -70,7 +70,7 @@
7171 # Convert image titles to file paths and store as JS to update dTree
7272 foreach ($wgTreeViewImages as $k => $v) {
7373 $title = Title::newFromText($v,NS_IMAGE);
74 - $image = Image::newFromTitle($title);
 74+ $image = wfFindFile($title);
7575 $v = $image && $image->exists() ? $image->getURL() : $wgTreeViewImages[$k];
7676 $this->images .= "tree.icon['$k'] = '$v';";
7777 }
Index: trunk/extensions/Click/Click.php
@@ -101,7 +101,7 @@
102102
103103 // Add image element, or use alt text on it's own if image doesn't exist.
104104 $imagetitle = Title::newFromText( $image );
105 - if( is_object( $imagetitle ) ) $imageimage = Image::newFromTitle( $imagetitle );
 105+ if( is_object( $imagetitle ) ) $imageimage = wfFindFile( $imagetitle );
106106 if( isset( $imageimage ) && is_object( $imagetitle ) && is_object( $imageimage ) && $imageimage->exists() ) {
107107 // Display image.
108108 if( !$width ) $width = $imageimage->getWidth();
Index: trunk/extensions/News/NewsRenderer.php
@@ -633,7 +633,7 @@
634634
635635 $ticon = $icon ? Title::newFromText($icon, NS_IMAGE) : NULL;
636636 if ( $ticon ) {
637 - $image = Image::newFromTitle( $ticon );
 637+ $image = wfFindFile( $ticon );
638638 if ( !$image->exists() ) {
639639 $image = false;
640640 }

Status & tagging log