From 2c877414c3eb16c845bf3d1d2e1c58fd25c8310c Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 21 Apr 2016 07:33:24 -0700 Subject: [PATCH] Do not call saveSettings() on anon users Also actually check wfReadOnly(). Change-Id: I83e78532c66039e9764e70246bd6597a2bf4e60f --- VisualEditor.hooks.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index 3c6fe77191..487984cdd1 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -132,9 +132,11 @@ class VisualEditorHooks { if ( isset( $params['venoscript'] ) ) { $req->response()->setCookie( 'VEE', 'wikitext', 0, [ 'prefix' => '' ] ); $user->setOption( 'visualeditor-editor', 'wikitext' ); - DeferredUpdates::addCallableUpdate( function () use ( $user ) { - $user->saveSettings(); - } ); + if ( !wfReadOnly() && !$user->isAnon() ) { + DeferredUpdates::addCallableUpdate( function () use ( $user ) { + $user->saveSettings(); + } ); + } return true; }