From 92ea4fb098cb44b78fd601894fbbac67772f55b5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 30 May 2016 08:44:17 -0700 Subject: [PATCH] Stop two special cache writes in read-only mode Summary: Ref T10769. The user availability cache write shouldn't happen in read-only mode, nor should the Differential parse cache write. (We might want to turn off the availbility feature completely since it's potentially expensive if we can't cache it, but I think we're OK for now.) Test Plan: In read-only mode: - Browsed as a user with an out-of-date availability cache. - Loaded an older revision without cached parse data. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10769 Differential Revision: https://secure.phabricator.com/D15988 --- .../differential/parser/DifferentialChangesetParser.php | 4 ++++ src/applications/people/storage/PhabricatorUser.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php index 9fc0adf537..e49538fd91 100644 --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -458,6 +458,10 @@ final class DifferentialChangesetParser extends Phobject { } public function saveCache() { + if (PhabricatorEnv::isReadOnly()) { + return false; + } + if ($this->highlightErrors) { return false; } diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index 464c14492f..85b2590d33 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -968,6 +968,10 @@ final class PhabricatorUser * @task availability */ public function writeAvailabilityCache(array $availability, $ttl) { + if (PhabricatorEnv::isReadOnly()) { + return $this; + } + $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); queryfx( $this->establishConnection('w'),