From 653fd90be005a9b012509608442da4b11a09f70e Mon Sep 17 00:00:00 2001 From: Alessandro Marotta Date: Fri, 5 Jun 2020 08:10:29 +0200 Subject: [PATCH 1/2] Make LeftAndMain independent of the presence of Versioned module LeftAndMain's init() method calls two Versioned methods and this makes it impossible to have the Silverstripe-admin module installed without the Versioned module. In other parts of the Silverstripe-admin code we have the verification of the presence or absence of the Versioned class, instead in the init() method it is missing. Please, could you also introduce in the init() method the verification of the presence of the Versioned module in order to install the administrative panel without the Versioned module? Like in the file commit, for example. --- code/LeftAndMain.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 48ff55c70..4d05f7e64 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -752,12 +752,15 @@ protected function init() // Assign default cms theme and replace user-specified themes SSViewer::set_themes(LeftAndMain::config()->uninherited('admin_themes')); + + // Check the presence of Silverstripe-Versioned module + if(class_exists(Versioned::class)) { + // Set the current reading mode + Versioned::set_stage(Versioned::DRAFT); - // Set the current reading mode - Versioned::set_stage(Versioned::DRAFT); - - // Set default reading mode to suppress ?stage=Stage querystring params in CMS - Versioned::set_default_reading_mode(Versioned::get_reading_mode()); + // Set default reading mode to suppress ?stage=Stage querystring params in CMS + Versioned::set_default_reading_mode(Versioned::get_reading_mode()); + } } public function handleRequest(HTTPRequest $request) From 876bfd597251fe42766ad8a7cf7c47b0ca18d1ce Mon Sep 17 00:00:00 2001 From: Alessandro Marotta Date: Sat, 6 Jun 2020 11:43:13 +0200 Subject: [PATCH 2/2] Update LeftAndMain.php indentation correction for travis --- code/LeftAndMain.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 4d05f7e64..b3114d0b4 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -754,12 +754,12 @@ protected function init() SSViewer::set_themes(LeftAndMain::config()->uninherited('admin_themes')); // Check the presence of Silverstripe-Versioned module - if(class_exists(Versioned::class)) { - // Set the current reading mode - Versioned::set_stage(Versioned::DRAFT); - - // Set default reading mode to suppress ?stage=Stage querystring params in CMS - Versioned::set_default_reading_mode(Versioned::get_reading_mode()); + if (class_exists(Versioned::class)) { + // Set the current reading mode + Versioned::set_stage(Versioned::DRAFT); + + // Set default reading mode to suppress ?stage=Stage querystring params in CMS + Versioned::set_default_reading_mode(Versioned::get_reading_mode()); } }