芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/system/Installer.php
0) { echo $YELLOW . "The following modules have syntax problems in the config file (" . count($aModulesHasError) . "):" . $NC . "\r\n"; echo $RED . implode("\r\n", $aModulesHasError) . $NC; echo "\r\n\r\n"; } if (count($aModulesNoConfig) > 0) { echo $YELLOW . "The following modules have no config files (" . count($aModulesNoConfig) . "):" . $NC . "\r\n"; echo $RED . implode("\r\n", $aModulesNoConfig) . $NC; echo "\r\n\r\n"; } if (count($aModulesOk) > 0) { echo $GREEN . count($aModulesOk) . " modules have no problem with config files" . $NC; echo "\r\n"; } } /** * NOTE! This method should be run from composer. */ public static function updateConfigs() { $sBaseDir = dirname(__File__); include_once $sBaseDir . '/autoload.php'; $sMessage = "Configuration was updated successfully"; if (!\Aurora\System\Api::UpdateSettings()) { $sMessage = "An error occurred while updating the configuration"; } echo $sMessage . "\r\n"; } /** * NOTE! This method should be run from composer. */ public static function preConfigForce($event) { self::preConfig($event); } /** * NOTE! This method should be run from composer. */ public static function preConfigSafe($event) { $sBaseDir = dirname(__File__); //Checking that configuration files already exist if (count(glob(dirname($sBaseDir) . "/data/settings/modules/*")) !== 0) { echo "The config files are already exist \r\n"; return; } else { self::preConfig($event); } } /** * NOTE! This method should be run from composer. */ private static function preConfig($event) { $sConfigFilename = 'pre-config.json'; $sBaseDir = dirname(__File__); $sMessage = "Configuration was updated successfully"; $oExtra = $event->getComposer()->getPackage()->getExtra(); if ($oExtra && isset($oExtra['aurora-installer-pre-config'])) { $sConfigFilename = $oExtra['aurora-installer-pre-config']; } $sConfigPath = dirname($sBaseDir) . '/' . $sConfigFilename; if (file_exists($sConfigPath)) { $sPreConfig = file_get_contents($sConfigPath); $oPreConfig = json_decode($sPreConfig, true); if ($oPreConfig) { include_once $sBaseDir . '/autoload.php'; \Aurora\System\Api::Init(); if ($oPreConfig['modules']) { $oModuleManager = \Aurora\System\Api::GetModuleManager(); foreach ($oPreConfig['modules'] as $sModuleName => $oModuleConfig) { if (!empty($sModuleName)) { $oSettings = $oModuleManager->getModuleSettings($sModuleName); if ($oSettings instanceof Settings) { $oSettings->Load(); foreach ($oModuleConfig as $sConfigName => $mConfigValue) { //overriding modules default configuration with pre-configuration data $oProp = $oSettings->GetSettingsProperty($sConfigName); if ($oProp) { if (!empty($oProp->SpecType)) { $mConfigValue = \Aurora\System\Enums\EnumConvert::FromXml($mConfigValue, $oProp->SpecType); } $oSettings->SetValue($sConfigName, $mConfigValue); } } $oSettings->Save(); } } } } if ($oPreConfig['system']) { $oSettings = &\Aurora\System\Api::GetSettings(); foreach ($oPreConfig['system'] as $mKey => $mSett) { $oSettings->{$mKey} = $mSett; } $oSettings->Save(); } } else { $sMessage = "Invalid config file"; } } else { $sMessage = "Config file didn't found"; } echo $sMessage . "\r\n"; } }