Merge "Fix "UTPage" creation in tests"
[lhc/web/wiklou.git] / thumb.php
index baa00e1..bfaf9a0 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -36,6 +36,10 @@ if ( defined( 'THUMB_HANDLER' ) ) {
 }
 
 wfLogProfilingData();
+// Commit and close up!
+$factory = wfGetLBFactory();
+$factory->commitMasterChanges();
+$factory->shutdown();
 
 //--------------------------------------------------------------------------
 
@@ -159,6 +163,12 @@ function wfStreamThumb( array $params ) {
                return;
        }
 
+       // Check if the file is hidden
+       if ( $img->isDeleted( File::DELETED_FILE ) ) {
+               wfThumbError( 404, "The source file '$fileName' does not exist." );
+               return;
+       }
+
        // Check permissions if there are read restrictions
        $varyHeader = array();
        if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) {
@@ -314,8 +324,8 @@ function wfStreamThumb( array $params ) {
        } elseif ( $user->pingLimiter( 'renderfile' ) ) {
                wfThumbError( 500, wfMessage( 'actionthrottledtext' ) );
                return;
-       } elseif ( wfThumbIsAttemptThrottled( $img, $thumbName, 5 ) ) {
-               wfThumbError( 500, wfMessage( 'thumbnail_image-failure-limit', 5 ) );
+       } elseif ( wfThumbIsAttemptThrottled( $img, $thumbName, 4 ) ) {
+               wfThumbError( 500, wfMessage( 'thumbnail_image-failure-limit', 4 ) );
                return;
        }