From ceb5abb7e053461820005f142921efdbbf4c93b5 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Sat, 5 Apr 2014 23:50:10 -0300 Subject: [PATCH] When uploading a new file, save to memcached directly after commit Previously if an exception was thrown when creating the description page, the old (negative) memcached entry would not be purged, and the file would appear not to exist until 24 hours later. This way, as soon as we have the image row committed to db, we change the memcache entry, so memcache of image row always looks like actual image row. Bug: 32551 Change-Id: I9c260e9a4a1e0d6ade1771542dd834f969904cef --- includes/filerepo/file/LocalFile.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 7a9e6171cc..267dbd526e 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1399,6 +1399,12 @@ class LocalFile extends File { # to after $wikiPage->doEdit has been called. $dbw->commit( __METHOD__ ); + # Save to memcache. + # We shall not saveToCache before the commit since otherwise + # in case of a rollback there is an usable file from memcached + # which in fact doesn't really exist (bug 24978) + $this->saveToCache(); + if ( $exists ) { # Invalidate the cache for the description page $descTitle->invalidateCache(); @@ -1431,11 +1437,6 @@ class LocalFile extends File { wfProfileOut( __METHOD__ . '-edit' ); - # Save to cache and purge the squid - # We shall not saveToCache before the commit since otherwise - # in case of a rollback there is an usable file from memcached - # which in fact doesn't really exist (bug 24978) - $this->saveToCache(); if ( $reupload ) { # Delete old thumbnails -- 2.20.1