Merge "Avoid full RC table scans in ChangeTags::updateTags()"
[lhc/web/wiklou.git] / includes / filerepo / file / File.php
index 7ea658d..3677a14 100644 (file)
@@ -423,7 +423,10 @@ abstract class File implements IDBAccessObject {
                if ( !isset( $this->fsFile ) ) {
                        $starttime = microtime( true );
                        $this->fsFile = $this->repo->getLocalReference( $this->getPath() );
-                       RequestContext::getMain()->getStats()->timing( 'media.thumbnail.generate.fetchoriginal', microtime( true ) - $starttime );
+
+                       $statTiming = microtime( true ) - $starttime;
+                       RequestContext::getMain()->getStats()->timing(
+                               'media.thumbnail.generate.fetchoriginal', 1000 * $statTiming );
 
                        if ( !$this->fsFile ) {
                                $this->fsFile = false; // null => false; cache negative hits
@@ -1095,7 +1098,7 @@ abstract class File implements IDBAccessObject {
         * @return bool|MediaTransformOutput
         */
        public function generateAndSaveThumb( $tmpFile, $transformParams, $flags ) {
-               global $wgUseSquid, $wgIgnoreImageErrors;
+               global $wgIgnoreImageErrors;
 
                $stats = RequestContext::getMain()->getStats();
 
@@ -1120,7 +1123,8 @@ abstract class File implements IDBAccessObject {
                $thumb = $handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $transformParams );
                $tmpFile->bind( $thumb ); // keep alive with $thumb
 
-               $stats->timing( 'media.thumbnail.generate.transform', microtime( true ) - $starttime );
+               $statTiming = microtime( true ) - $starttime;
+               $stats->timing( 'media.thumbnail.generate.transform', 1000 * $statTiming );
 
                if ( !$thumb ) { // bad params?
                        $thumb = false;
@@ -1143,27 +1147,13 @@ abstract class File implements IDBAccessObject {
                                $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $transformParams, $flags );
                        }
 
-                       $stats->timing( 'media.thumbnail.generate.store', microtime( true ) - $starttime );
+                       $statTiming = microtime( true ) - $starttime;
+                       $stats->timing( 'media.thumbnail.generate.store', 1000 * $statTiming );
 
                        // Give extensions a chance to do something with this thumbnail...
                        Hooks::run( 'FileTransformed', array( $this, $thumb, $tmpThumbPath, $thumbPath ) );
                }
 
-               // Purge. Useful in the event of Core -> Squid connection failure or squid
-               // purge collisions from elsewhere during failure. Don't keep triggering for
-               // "thumbs" which have the main image URL though (bug 13776)
-               if ( $wgUseSquid ) {
-                       if ( !$thumb || $thumb->isError() || $thumb->getUrl() != $this->getURL() ) {
-                               $starttime = microtime( true );
-
-                               SquidUpdate::purge( array( $thumbUrl ) );
-
-                               $stats->timing( 'media.thumbnail.generate.purge', microtime( true ) - $starttime );
-                       }
-               }
-
-
-
                return $thumb;
        }
 
@@ -1195,8 +1185,6 @@ abstract class File implements IDBAccessObject {
 
                $params = $this->getHandler()->sanitizeParamsForBucketing( $params );
 
-               $bucketName = $this->getBucketThumbName( $bucket );
-
                $tmpFile = $this->makeTransformTmpFile( $bucketPath );
 
                if ( !$tmpFile ) {
@@ -1216,7 +1204,8 @@ abstract class File implements IDBAccessObject {
                // this object exists
                $tmpFile->bind( $this );
 
-               RequestContext::getMain()->getStats()->timing( 'media.thumbnail.generate.bucket', $buckettime );
+               RequestContext::getMain()->getStats()->timing(
+                       'media.thumbnail.generate.bucket', 1000 * $buckettime );
 
                return true;
        }