Added some StreamFile profiling
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 25 Feb 2012 00:53:56 +0000 (00:53 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 25 Feb 2012 00:53:56 +0000 (00:53 +0000)
includes/StreamFile.php

index ce13a21..1b4b6aa 100644 (file)
@@ -19,18 +19,23 @@ class StreamFile {
         * @return bool Success
         */
        public static function stream( $fname, $headers = array(), $sendErrors = true ) {
+               wfProfileIn( __METHOD__ );
+
                wfSuppressWarnings();
                $stat = stat( $fname );
                wfRestoreWarnings();
 
                $res = self::prepareForStream( $fname, $stat, $headers, $sendErrors );
                if ( $res == self::NOT_MODIFIED ) {
-                       return true; // use client cache
+                       $ok = true; // use client cache
                } elseif ( $res == self::READY_STREAM ) {
-                       return readfile( $fname );
+                       $ok = readfile( $fname );
                } else {
-                       return false; // failed
+                       $ok = false; // failed
                }
+
+               wfProfileOut( __METHOD__ );
+               return $ok;
        }
 
        /**