r44640 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44639‎ | r44640 | r44641 >
Date:23:51, 15 December 2008
Author:aaron
Status:deferred
Tags:
Comment:
Fix bug where new image uploads would be reviewed but had "changes needing review" tag
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImagePage.php
@@ -22,6 +22,12 @@
2323 $this->dupes = null;
2424 $this->repo = null;
2525 }
 26+
 27+ public function setFile( $file ) {
 28+ $this->displayImg = $file;
 29+ $this->img = $file;
 30+ $this->fileLoaded = true;
 31+ }
2632
2733 protected function loadFile() {
2834 if( $this->fileLoaded ) {
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -890,6 +890,7 @@
891891
892892 $descTitle = $this->getTitle();
893893 $article = new ImagePage( $descTitle );
 894+ $article->setFile( $this );
894895
895896 # Add the log entry
896897 $log = new LogPage( 'upload' );
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -1053,10 +1053,13 @@
10541054
10551055 # If this is an image page, store corresponding file info
10561056 $fileData = array();
1057 - if( $title->getNamespace() == NS_FILE && ($file = wfFindFile($title)) ) {
1058 - $fileData['name'] = $title->getDBkey();
1059 - $fileData['timestamp'] = $file->getTimestamp();
1060 - $fileData['sha1'] = $file->getSha1();
 1057+ if( $title->getNamespace() == NS_FILE ) {
 1058+ $file = $article instanceof ImagePage ? $article->getFile() : wfFindFile($title);
 1059+ if( is_object($file) && $file->exists() ) {
 1060+ $fileData['name'] = $title->getDBkey();
 1061+ $fileData['timestamp'] = $file->getTimestamp();
 1062+ $fileData['sha1'] = $file->getSha1();
 1063+ }
10611064 }
10621065
10631066 # Our review entry

Status & tagging log