From 6a269d4d8df38746830b012cda5d9120f501f7d6 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 10 Feb 2016 21:04:28 +1100 Subject: [PATCH] Suppress SessionManager sessions in the installer SessionManager cannot work in the installer since it depends on ObjectCache which is just an EmptyBagOStuff and so doesn't store anything. So, introduce a custom SessionProvider which pretends to persist sessions but actually doesn't. Bug: T126177 Change-Id: I13d8aa1453c519df7c19ca2f1fb052c99ade043c --- autoload.php | 1 + includes/installer/Installer.php | 9 +++ .../installer/InstallerSessionProvider.php | 60 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 includes/installer/InstallerSessionProvider.php diff --git a/autoload.php b/autoload.php index 0a9d80c6f1..d6e40777ff 100644 --- a/autoload.php +++ b/autoload.php @@ -593,6 +593,7 @@ $wgAutoloadLocalClasses = array( 'InstallDocFormatter' => __DIR__ . '/includes/installer/InstallDocFormatter.php', 'Installer' => __DIR__ . '/includes/installer/Installer.php', 'InstallerOverrides' => __DIR__ . '/mw-config/overrides.php', + 'InstallerSessionProvider' => __DIR__ . '/includes/installer/InstallerSessionProvider.php', 'Interwiki' => __DIR__ . '/includes/interwiki/Interwiki.php', 'InvalidPassword' => __DIR__ . '/includes/password/InvalidPassword.php', 'IteratorDecorator' => __DIR__ . '/includes/utils/iterators/IteratorDecorator.php', diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 40e51f0b41..0e8633ded7 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -1785,6 +1785,15 @@ abstract class Installer { // Some of the environment checks make shell requests, remove limits $GLOBALS['wgMaxShellMemory'] = 0; + + $GLOBALS['wgSessionProviders'] = array( + array( + 'class' => 'InstallerSessionProvider', + 'args' => array( array( + 'priority' => 1, + ) ) + ) + ); } /** diff --git a/includes/installer/InstallerSessionProvider.php b/includes/installer/InstallerSessionProvider.php new file mode 100644 index 0000000000..2b9f418590 --- /dev/null +++ b/includes/installer/InstallerSessionProvider.php @@ -0,0 +1,60 @@ + $this, + 'id' => str_repeat( 'x', 32 ), + ) ); + } + + /** + * Yes we will treat your data with great care! + */ + public function persistsSessionId() { + return true; + } + + /** + * Sure, you can be whoever you want, as long as you have ID 0 + */ + public function canChangeUser() { + return true; + } + + public function persistSession( SessionBackend $session, WebRequest $request ) { + } + + public function unpersistSession( WebRequest $request ) { + } +} -- 2.20.1