From 4d1ed12a9e0a09574b283f3ac0da57a6380a3872 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 18 Jul 2017 08:49:35 -0700 Subject: [PATCH] Skip Conduit call log writes in read-only mode, allowing "conduit.ping" to run Summary: Ref T10769. See PHI8. We have an unconditional logging write which we can skip in read-only mode. Test Plan: - Put Phabricator in read-only mode with `cluster.read-only`. - Called `conduit.ping` via web UI. - Before: write-on-read-only exception. - After: good result. Reviewers: chad, amckinley Reviewed By: chad Maniphest Tasks: T10769 Differential Revision: https://secure.phabricator.com/D18233 --- .../controller/PhabricatorConduitAPIController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php index 991865b564..12127a1e27 100644 --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -119,9 +119,11 @@ final class PhabricatorConduitAPIController ->setError((string)$error_code) ->setDuration(1000000 * ($time_end - $time_start)); - $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); - $log->save(); - unset($unguarded); + if (!PhabricatorEnv::isReadOnly()) { + $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); + $log->save(); + unset($unguarded); + } $response = id(new ConduitAPIResponse()) ->setResult($result)