From e3ace87155f59f600a371385382d2c032a5d0ff1 Mon Sep 17 00:00:00 2001 From: Oldperl <44996956+oldperl@users.noreply.github.com> Date: Mon, 4 Nov 2019 14:55:28 +0000 Subject: [PATCH] modify setup for CL 2.1 --- setup/dbupdate.php | 70 ++++++++++--------------- setup/lib/defines.php | 2 +- setup/steps/forms/additionalplugins.php | 4 +- setup/steps/forms/clientmode.php | 19 +++++-- setup/steps/forms/systemtest.php | 3 ++ 5 files changed, 48 insertions(+), 50 deletions(-) diff --git a/setup/dbupdate.php b/setup/dbupdate.php index 0652ba9..91ba4e0 100644 --- a/setup/dbupdate.php +++ b/setup/dbupdate.php @@ -52,7 +52,7 @@ if (checkMySQLDatabaseCreation($db, $_SESSION['dbname'])) { $db = getSetupMySQLDBConnection(); } -$currentstep = (empty($_GET['step']))?1:filter_input(INPUT_GET, "step", FILTER_SANITIZE_NUMBER_INT); +$currentstep = (empty($_GET['step'])) ? 1 : filter_input(INPUT_GET, "step", FILTER_SANITIZE_NUMBER_INT); // Count DB Chunks $file = fopen('data/tables.txt', 'r'); @@ -81,29 +81,33 @@ while (($data = fgetcsv($file, 4000, ';')) !== false) { } // Count DB Chunks (plugins) -$file = fopen('data/tables_pi.txt', 'r'); -$step = 1; -while (($data = fgetcsv($file, 4000, ';')) !== false) { - if ($count == 50) { - $count = 1; - $step++; - } +if (cFileHandler::exists('data/tables_pi.txt')) { + $file = fopen('data/tables_pi.txt', 'r'); + if ($file) { + $step = 1; + while (($data = fgetcsv($file, 4000, ';')) !== false) { + if ($count == 50) { + $count = 1; + $step++; + } - if ($currentstep == $step) { - if ($data[7] == '1') { - $drop = true; - } else { - $drop = false; - } - dbUpgradeTable($db, $_SESSION['dbprefix'] . '_' . $data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], '', $drop); + if ($currentstep == $step) { + if ($data[7] == '1') { + $drop = true; + } else { + $drop = false; + } + dbUpgradeTable($db, $_SESSION['dbprefix'] . '_' . $data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], '', $drop); - if ($db->errno != 0) { - $_SESSION['install_failedupgradetable'] = true; + if ($db->errno != 0) { + $_SESSION['install_failedupgradetable'] = true; + } + } + + $count++; + $fullcount++; } } - - $count++; - $fullcount++; } $pluginChunks = array(); @@ -120,24 +124,6 @@ $contentChunks = txtFileToArray('data/examples.txt'); $sysadminChunk = txtFileToArray('data/sysadmin.txt'); -/* -if ($_SESSION['plugin_newsletter'] == 'true') { - $newsletter = txtFileToArray('data/plugin_newsletter.txt'); - $pluginChunks = array_merge($pluginChunks, $newsletter); -} - * - */ - -if ($_SESSION['plugin_content_allocation'] == 'true') { - $content_allocation = txtFileToArray('data/plugin_content_allocation.txt'); - $pluginChunks = array_merge($pluginChunks, $content_allocation); -} - -if ($_SESSION['plugin_mod_rewrite'] == 'true') { - $mod_rewrite = txtFileToArray('data/plugin_mod_rewrite.txt'); - $pluginChunks = array_merge($pluginChunks, $mod_rewrite); -} - if ($_SESSION['setuptype'] == 'setup') { switch ($_SESSION['clientmode']) { case 'CLIENT': @@ -259,10 +245,10 @@ if ($currentstep < $totalsteps) { $aSqlArray = $db->getProfileData(); if (is_array($aSqlArray) && count($aSqlArray) > 0) { $fp = fopen('../data/logs/setup_queries.txt', 'w'); - foreach ($aSqlArray as $failedChunk) { - fwrite($fp, print_r($aSqlArray, TRUE)); - } - fclose($fp); + foreach ($aSqlArray as $failedChunk) { + fwrite($fp, print_r($aSqlArray, TRUE)); + } + fclose($fp); } printf(''); diff --git a/setup/lib/defines.php b/setup/lib/defines.php index 0d6d649..85bb996 100644 --- a/setup/lib/defines.php +++ b/setup/lib/defines.php @@ -57,5 +57,5 @@ define('C_SETUP_STEPFILE_ACTIVE', 'images/steps/s%da.png'); define('C_SETUP_STEPWIDTH', 28); define('C_SETUP_STEPHEIGHT', 28); define('C_SETUP_MIN_PHP_VERSION', '5.6'); -define('C_SETUP_VERSION', '2.1.0'); +define('C_SETUP_VERSION', '2.1.1'); ?> \ No newline at end of file diff --git a/setup/steps/forms/additionalplugins.php b/setup/steps/forms/additionalplugins.php index 40de5a7..7c84bb3 100644 --- a/setup/steps/forms/additionalplugins.php +++ b/setup/steps/forms/additionalplugins.php @@ -59,8 +59,8 @@ class cSetupAdditionalPlugins extends cSetupMask { // add new plugins to this array and you're done. $aPlugins = array(); //$aPlugins['plugin_newsletter'] = array('label' => i18n_setup('Newsletter'), 'desc' => i18n_setup('Newsletterfunctionality for dispatching text newsletters and HTML-Newsletters, extensible with professional newsletter extensions. Definition of newsletter recipients and groups of recipients. Layout design of the HTML-Newsletters by ConLite articles.')); - $aPlugins['plugin_content_allocation'] = array('label' => i18n_setup('Content Allocation'), 'desc' => i18n_setup('For the representation and administration of content, 4fb developed the Content Allocation and content include technology. This technology dynamically allows on basis of a Template, to put the content in different places and in different formats according to several criteria.')); - $aPlugins['plugin_mod_rewrite'] = array('label' => i18n_setup('Mod Rewrite'), 'desc' => i18n_setup('Creates so called Clean URLs for a ConLite installation')); + //$aPlugins['plugin_content_allocation'] = array('label' => i18n_setup('Content Allocation'), 'desc' => i18n_setup('For the representation and administration of content, 4fb developed the Content Allocation and content include technology. This technology dynamically allows on basis of a Template, to put the content in different places and in different formats according to several criteria.')); + //$aPlugins['plugin_mod_rewrite'] = array('label' => i18n_setup('Mod Rewrite'), 'desc' => i18n_setup('Creates so called Clean URLs for a ConLite installation')); $sCheckBoxes = ''; if (sizeof($aPlugins) > 0) { diff --git a/setup/steps/forms/clientmode.php b/setup/steps/forms/clientmode.php index fa8328b..aa90d75 100644 --- a/setup/steps/forms/clientmode.php +++ b/setup/steps/forms/clientmode.php @@ -41,17 +41,26 @@ class cSetupClientMode extends cSetupMask { cInitializeArrayKey($_SESSION, "clientmode", ""); - $aChoices = array("CLIENTEXAMPLES" => i18n_setup("Client with example modules and example content"), - "CLIENTMODULES" => i18n_setup("Client with example modules, but without example content"), - "CLIENT" => i18n_setup("Client without examples"), - "NOCLIENT" => i18n_setup("Don't create client")); + $aChoices = array(); + + $aChoices["CLIENTEXAMPLES"] = "none"; //i18n_setup("Client with example modules and example content"); + $aChoices["CLIENTMODULES"] = "none"; //i18n_setup("Client with example modules, but without example content"); + $aChoices["CLIENT"] = i18n_setup("Client without examples"); + $aChoices["NOCLIENT"] = i18n_setup("Don't create client"); + + $sChoiceDefault = "CLIENTEXAMPLES"; foreach ($aChoices as $sKey => $sChoice) { + if ($sChoice == "none") { + $this->_oStepTemplate->set("s", "CONTROL_" . $sKey, ""); + $this->_oStepTemplate->set("s", "LABEL_" . $sKey, ""); + continue; + } $oRadio = new cHTMLRadiobutton("clientmode", $sKey); $oRadio->setLabelText(" "); $oRadio->setStyle('width:auto;border:0;'); - if ($_SESSION["clientmode"] == $sKey || ($_SESSION["clientmode"] == "" && $sKey == "CLIENTEXAMPLES")) { + if ($_SESSION["clientmode"] == $sKey || ($_SESSION["clientmode"] == "" && $sKey == $sChoiceDefault)) { $oRadio->setChecked("checked"); } diff --git a/setup/steps/forms/systemtest.php b/setup/steps/forms/systemtest.php index 38dfa3a..b90ff2d 100644 --- a/setup/steps/forms/systemtest.php +++ b/setup/steps/forms/systemtest.php @@ -446,6 +446,9 @@ class cSetupSystemtest extends cSetupMask { } public function doFileSystemTests() { + if(!is_readable(CON_SETUP_PATH."/data")) { + $this->runTest(false, C_SEVERITY_ERROR, i18n_setup("Setup data folder not readable!"), i18n_setup("Please check the Folder setup/data! Maybe it' s missing or not readable.")); + } // old logs if ($_SESSION["setuptype"] != "setup") { // old folders