Wikia code/includes/filerepo/LocalFile.php

--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\filerepo\LocalFile.php	2011-07-18 22:30:59.459961000 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\filerepo\LocalFile.php	2011-08-17 15:28:13.662109400 +0100
@@ -603,7 +604,8 @@
 		$this->purgeThumbnails();
 
 		// Purge squid cache for this file
-		SquidUpdate::purge( array( $this->getURL() ) );
+		// Wikia purge the base thumbnail url
+		SquidUpdate::purge( array( $this->getURL(), $this->getThumbUrl() ) );
 	}
 
 	/**
@@ -614,7 +616,8 @@
 		// Delete thumbnails
 		$files = $this->getThumbnails();
 		$dir = $this->getThumbPath();
-		$urls = array();
+		// get rid of the top one
+		$urls = array($this->getThumbUrl());
 		foreach ( $files as $file ) {
 			# Check that the base file name is part of the thumb name
 			# This is a basic sanity check to avoid erasing unrelated directories
@@ -808,6 +811,12 @@
 		$this->purgeThumbnails();
 		$this->saveToCache();
 		SquidUpdate::purge( array( $this->getURL() ) );
+		/* Wikia change begin - @author: Marooned, see RT#44185 */
+		global $wgLogo;
+		if ($this->url == $wgLogo) {
+			SquidUpdate::purge( array( $this->url ) );
+		}
+		/* Wikia change end */
 
 		// Fail now if the file isn't there
 		if ( !$this->fileExists ) {
@@ -899,6 +908,8 @@
 		$descTitle = $this->getTitle();
 		$article = new ImagePage( $descTitle );
 		$article->setFile( $this );
+		#--- wikia code
+		wfRunHooks( 'Image::RecordUpload:article', array( &$article, $descTitle ) ) ;
 
 		# Add the log entry
 		$log = new LogPage( 'upload' );
@@ -910,10 +921,12 @@
 			$latest = $descTitle->getLatestRevID();
 			$nullRevision = Revision::newNullRevision( $dbw, $descTitle->getArticleID(),
 				$log->getRcComment(), false );
+			if (!is_null($nullRevision)) {
 			$nullRevision->insertOn( $dbw );
 			
-			wfRunHooks( 'NewRevisionFromEditComplete', array( $article, $nullRevision, $latest, $user ) );
 			$article->updateRevisionOn( $dbw, $nullRevision );
+				wfRunHooks( 'NewRevisionFromEditComplete', array( $article, $nullRevision, $latest, $user ) );
+			} 
 
 			# Invalidate the cache for the description page
 			$descTitle->invalidateCache();