From 4187f85473958bd6560d48c8891511e2f9bcf1d4 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 13 Jun 2019 15:06:43 +0100 Subject: [PATCH] installer: Detect APC for MainCacheType in CLI installer The web installer did this already, but with the CLI installer, the generated LocalSettings.php always contained the following hardcoded: $wgMainCacheType = CACHE_NONE; Combined with the fact that in WMF CI, the generated local settings is applied *after* the inclusion of Quibble settings and DevelopmentSettings, meant that it was not possible to enable object caching. For now, make it match the behaviour of the web installer and thus output $wgMainCacheType = CACHE_ACCELL if we detect a supported implementation in the PHP runtime. For later we should probably: * Make this an option to install.php, * or, change Quibble to append its overrides, instead of prepending. So that DevelopmentSettings actually after the generated LocalSettings. Bug: T225496 Change-Id: I3f43cd054ce71d0f1b2395302e8ef9ee2f6b01c2 (cherry picked from commit 7e0fb4fff6a247802c2209df48cf9fab8bfb8563) --- includes/installer/CliInstaller.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 162a978af0..0b024c41d3 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -126,6 +126,15 @@ class CliInstaller extends Installer { * Main entry point. */ public function execute() { + // If APC is available, use that as the MainCacheType, instead of nothing. + // This is hacky and should be consolidated with WebInstallerOptions. + // This is here instead of in __construct(), because it should run run after + // doEnvironmentChecks(), which populates '_Caches'. + if ( count( $this->getVar( '_Caches' ) ) ) { + // We detected a CACHE_ACCEL implementation, use it. + $this->setVar( '_MainCacheType', 'accel' ); + } + $vars = Installer::getExistingLocalSettings(); if ( $vars ) { $this->showStatusMessage( -- 2.20.1