locateConfigFile() public static method

public static locateConfigFile ( $name ) : mixed
$name - name of configuration file. slash is allowed for subdirectories.
return mixed
Example #1
0
 /**
  * @param array $config
  */
 public function config($config = [])
 {
     $settings = null;
     // check for an initial configuration template
     // used eg. by the demo installer
     $configTemplatePath = PIMCORE_CONFIGURATION_DIRECTORY . "/system.template.php";
     if (file_exists($configTemplatePath)) {
         try {
             $configTemplate = new \Zend_Config(include $configTemplatePath);
             if ($configTemplate->general) {
                 // check if the template contains a valid configuration
                 $settings = $configTemplate->toArray();
                 // unset database configuration
                 unset($settings["database"]["params"]["host"]);
                 unset($settings["database"]["params"]["port"]);
             }
         } catch (\Exception $e) {
         }
     }
     // set default configuration if no template is present
     if (!$settings) {
         // write configuration file
         $settings = ["general" => ["timezone" => "Europe/Berlin", "language" => "en", "validLanguages" => "en", "debug" => "1", "debugloglevel" => "debug", "custom_php_logfile" => "1", "extjs6" => "1"], "database" => ["adapter" => "Mysqli", "params" => ["username" => "root", "password" => "", "dbname" => ""]], "documents" => ["versions" => ["steps" => "10"], "default_controller" => "default", "default_action" => "default", "error_pages" => ["default" => "/"], "createredirectwhenmoved" => "", "allowtrailingslash" => "no", "generatepreview" => "1"], "objects" => ["versions" => ["steps" => "10"]], "assets" => ["versions" => ["steps" => "10"]], "services" => [], "cache" => ["excludeCookie" => ""], "httpclient" => ["adapter" => "Zend_Http_Client_Adapter_Socket"]];
     }
     $settings = array_replace_recursive($settings, $config);
     // create initial /website/var folder structure
     // @TODO: should use values out of startup.php (Constants)
     $varFolders = ["areas", "assets", "backup", "cache", "classes", "config", "email", "log", "plugins", "recyclebin", "search", "system", "tmp", "versions", "webdav"];
     foreach ($varFolders as $folder) {
         \Pimcore\File::mkdir(PIMCORE_WEBSITE_VAR . "/" . $folder);
     }
     $configFile = \Pimcore\Config::locateConfigFile("system.php");
     File::putPhpFile($configFile, to_php_data_file_format($settings));
 }
 public function saveAction()
 {
     $this->checkPermission("system_settings");
     $values = \Zend_Json::decode($this->getParam("data"));
     $configFile = \Pimcore\Config::locateConfigFile("reports.php");
     File::put($configFile, to_php_data_file_format($values));
     $this->_helper->json(array("success" => true));
 }
Example #3
0
 /**
  * @return mixed|null
  * @throws \Exception
  */
 public static function getConfiguration()
 {
     $config = null;
     $configFile = \Pimcore\Config::locateConfigFile("hybridauth.php");
     if (is_file($configFile)) {
         $config = (include $configFile);
         $config["base_url"] = \Pimcore\Tool::getHostUrl() . "/hybridauth/endpoint";
     } else {
         throw new \Exception("HybridAuth configuration not found. Please place it into this file: {$configFile}");
     }
     return $config;
 }
Example #4
0
 public function init()
 {
     parent::init();
     if (is_file(\Pimcore\Config::locateConfigFile("system.php"))) {
         // session authentication, only possible if user is logged in
         $user = \Pimcore\Tool\Authentication::authenticateSession();
         if (!$user instanceof User) {
             die("Authentication failed!<br />If you don't have access to the admin interface any more, and you want to find out if the server configuration matches the requirements you have to rename the the system.php for the time of the check.");
         }
     } elseif ($this->getParam("mysql_adapter")) {
     } else {
         die("Not possible... no database settings given.<br />Parameters: mysql_adapter,mysql_host,mysql_username,mysql_password,mysql_database");
     }
 }
Example #5
0
 public function init()
 {
     parent::init();
     $maxExecutionTime = 300;
     @ini_set("max_execution_time", $maxExecutionTime);
     set_time_limit($maxExecutionTime);
     error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
     @ini_set("display_errors", "On");
     $front = \Zend_Controller_Front::getInstance();
     $front->throwExceptions(true);
     \Zend_Controller_Action_HelperBroker::addPrefix('Pimcore_Controller_Action_Helper');
     if (is_file(\Pimcore\Config::locateConfigFile("system.php"))) {
         $this->redirect("/admin");
     }
 }
 public function listenAction()
 {
     header('Content-type: application/json');
     $url = $this->getParam('url');
     if (empty($url)) {
         echo json_encode(null);
         return;
     }
     $configFile = \Pimcore\Config::locateConfigFile("shariff.php");
     if (is_file($configFile)) {
         $confArray = (include $configFile);
     } else {
         $reader = new Json();
         $confArray = $reader->fromFile(PIMCORE_PLUGINS_PATH . '/Shariff/config/shariff.json');
     }
     $shariff = new Backend($confArray);
     echo json_encode($shariff->get($url));
     exit;
 }
Example #7
0
 /**
  * @param bool $forceReload
  * @return array|null
  */
 public static function getWorkflowManagementConfig($forceReload = false)
 {
     $config = null;
     if (\Zend_Registry::isRegistered("pimcore_config_workflowmanagement") && !$forceReload) {
         $config = \Zend_Registry::get("pimcore_config_workflowmanagement");
     } else {
         try {
             $file = \Pimcore\Config::locateConfigFile("workflowmanagement.php");
             if (is_file($file)) {
                 $config = (include $file);
                 if (is_array($config)) {
                     self::setWorkflowManagementConfig($config);
                 } else {
                     \Logger::error("{$file} exists but it is not a valid PHP array configuration.");
                 }
             }
         } catch (\Exception $e) {
             $file = \Pimcore\Config::locateConfigFile("workflowmanagement.php");
             \Logger::emergency("Cannot find workflow configuration, should be located at: " . $file);
         }
     }
     return $config;
 }
Example #8
0
 public function setWeb2printAction()
 {
     $this->checkPermission("web2print_settings");
     $values = \Zend_Json::decode($this->getParam("data"));
     if ($values['wkhtml2pdfOptions']) {
         $optionArray = [];
         $lines = explode("\n", $values['wkhtml2pdfOptions']);
         foreach ($lines as $line) {
             $parts = explode(" ", substr($line, 2));
             $key = trim($parts[0]);
             if ($key) {
                 $value = trim($parts[1]);
                 $optionArray[$key] = $value;
             }
         }
         $values['wkhtml2pdfOptions'] = $optionArray;
     }
     $configFile = \Pimcore\Config::locateConfigFile("web2print.php");
     File::putPhpFile($configFile, to_php_data_file_format($values));
     $this->_helper->json(["success" => true]);
 }
Example #9
0
 /**
  * @param $name
  * @param $value
  */
 public static function setFlag($name, $value)
 {
     $settings = self::getSystemConfig()->toArray();
     if (!isset($settings["flags"])) {
         $settings["flags"] = [];
     }
     $settings["flags"][$name] = $value;
     $configFile = \Pimcore\Config::locateConfigFile("system.php");
     File::putPhpFile($configFile, to_php_data_file_format($settings));
 }
<?php

$configNames = ["document-types", "image-thumbnails", "newsletter", "predefined-asset-metadata", "custom-reports", "predefined-properties", "qrcode", "staticroutes", "tag-manager", "video-thumbnails", "cache", "classmap"];
foreach ($configNames as $configName) {
    $jsonFile = \Pimcore\Config::locateConfigFile($configName . ".json");
    if (file_exists($jsonFile)) {
        $phpFile = \Pimcore\Config::locateConfigFile($configName . ".php");
        $contents = file_get_contents($jsonFile);
        $contents = json_decode($contents, true);
        $contents = var_export_pretty($contents);
        $phpContents = "<?php \n\nreturn " . $contents . ";\n";
        \Pimcore\File::put($phpFile, $phpContents);
    }
}
<?php

\Pimcore\Cache::disable();
$customCacheFile = PIMCORE_CONFIGURATION_DIRECTORY . "/cache.xml";
// create legacy config folder
$legacyFolder = PIMCORE_CONFIGURATION_DIRECTORY . "/LEGACY";
if (!is_dir($legacyFolder)) {
    mkdir($legacyFolder, 0777, true);
}
if (file_exists($customCacheFile)) {
    try {
        $conf = new \Zend_Config_Xml($customCacheFile);
        $arrayConf = $conf->toArray();
        $content = json_encode($arrayConf);
        $content = \Zend_Json::prettyPrint($content);
        $jsonFile = \Pimcore\Config::locateConfigFile("cache.json");
        file_put_contents($jsonFile, $content);
        rename($customCacheFile, $legacyFolder . "/cache.xml");
    } catch (\Exception $e) {
    }
}
<?php

\Pimcore\Cache::disable();
// create legacy config folder
$legacyFolder = PIMCORE_CONFIGURATION_DIRECTORY . "/LEGACY";
if (!is_dir($legacyFolder)) {
    mkdir($legacyFolder, 0777, true);
}
$mappingFile = PIMCORE_CONFIGURATION_DIRECTORY . "/classmap.xml";
if (file_exists($mappingFile)) {
    try {
        $conf = new \Zend_Config_Xml($mappingFile);
        $arrayConf = $conf->toArray();
        $newConf = [];
        foreach ($arrayConf as $key => $value) {
            $newKey = str_replace("_", "\\", $key);
            $newConf[$newKey] = $value;
        }
        $content = json_encode($newConf);
        $content = \Zend_Json::prettyPrint($content);
        $jsonFile = \Pimcore\Config::locateConfigFile("classmap.json");
        file_put_contents($jsonFile, $content);
        rename($mappingFile, $legacyFolder . "/classmap.xml");
    } catch (\Exception $e) {
    }
}
 /**
  * CUSTOM VIEWS
  */
 public function saveCustomviewsAction()
 {
     $success = true;
     $settings = ["views" => []];
     for ($i = 0; $i < 1000; $i++) {
         if ($this->getParam("name_" . $i)) {
             $classes = $this->getParam("classes_" . $i);
             if (is_array($classes) || \Pimcore\Tool\Admin::isExtJS6()) {
                 $classes = implode(',', $classes);
             }
             // check for root-folder
             $rootfolder = "/";
             if ($this->getParam("rootfolder_" . $i)) {
                 $rootfolder = $this->getParam("rootfolder_" . $i);
             }
             $settings["views"][] = array("name" => $this->getParam("name_" . $i), "condition" => $this->getParam("condition_" . $i), "icon" => $this->getParam("icon_" . $i), "id" => $i + 1, "rootfolder" => $rootfolder, "showroot" => $this->getParam("showroot_" . $i) == "true" ? true : false, "classes" => $classes);
         }
     }
     $configFile = \Pimcore\Config::locateConfigFile("customviews.php");
     File::put($configFile, to_php_data_file_format($settings));
     $this->_helper->json(array("success" => $success));
 }
 public function setSystemAction()
 {
     $this->checkPermission("system_settings");
     $values = \Zend_Json::decode($this->getParam("data"));
     // email settings
     $oldConfig = Config::getSystemConfig();
     $oldValues = $oldConfig->toArray();
     // fallback languages
     $fallbackLanguages = array();
     $languages = explode(",", $values["general.validLanguages"]);
     $filteredLanguages = array();
     foreach ($languages as $language) {
         if (isset($values["general.fallbackLanguages." . $language])) {
             $fallbackLanguages[$language] = str_replace(" ", "", $values["general.fallbackLanguages." . $language]);
         }
         if (\Zend_Locale::isLocale($language)) {
             $filteredLanguages[] = $language;
         }
     }
     // delete views if fallback languages has changed or the language is no more available
     $fallbackLanguagesChanged = array_diff_assoc($oldValues['general']['fallbackLanguages'], $fallbackLanguages);
     $dbName = $oldConfig->get("database")->toArray()["params"]["dbname"];
     foreach ($fallbackLanguagesChanged as $language => $dummy) {
         $this->deleteViews($language, $dbName);
     }
     $cacheExcludePatterns = $values["cache.excludePatterns"];
     if (is_array($cacheExcludePatterns)) {
         $cacheExcludePatterns = implode(',', $cacheExcludePatterns);
     }
     $settings = array("general" => array("timezone" => $values["general.timezone"], "php_cli" => $values["general.php_cli"], "domain" => $values["general.domain"], "redirect_to_maindomain" => $values["general.redirect_to_maindomain"], "language" => $values["general.language"], "validLanguages" => implode(",", $filteredLanguages), "fallbackLanguages" => $fallbackLanguages, "defaultLanguage" => $values["general.defaultLanguage"], "theme" => $values["general.theme"], "extjs6" => $values["general.extjs6"], "loginscreencustomimage" => $values["general.loginscreencustomimage"], "disableusagestatistics" => $values["general.disableusagestatistics"], "debug" => $values["general.debug"], "debug_ip" => $values["general.debug_ip"], "http_auth" => array("username" => $values["general.http_auth.username"], "password" => $values["general.http_auth.password"]), "custom_php_logfile" => $values["general.custom_php_logfile"], "debugloglevel" => $values["general.debugloglevel"], "disable_whoops" => $values["general.disable_whoops"], "debug_admin_translations" => $values["general.debug_admin_translations"], "devmode" => $values["general.devmode"], "logrecipient" => $values["general.logrecipient"], "viewSuffix" => $values["general.viewSuffix"], "instanceIdentifier" => $values["general.instanceIdentifier"], "show_cookie_notice" => $values["general.show_cookie_notice"]), "database" => $oldValues["database"], "documents" => array("versions" => array("days" => $values["documents.versions.days"], "steps" => $values["documents.versions.steps"]), "default_controller" => $values["documents.default_controller"], "default_action" => $values["documents.default_action"], "error_pages" => array("default" => $values["documents.error_pages.default"]), "createredirectwhenmoved" => $values["documents.createredirectwhenmoved"], "allowtrailingslash" => $values["documents.allowtrailingslash"], "allowcapitals" => $values["documents.allowcapitals"], "generatepreview" => $values["documents.generatepreview"], "wkhtmltoimage" => $values["documents.wkhtmltoimage"], "wkhtmltopdf" => $values["documents.wkhtmltopdf"]), "objects" => array("versions" => array("days" => $values["objects.versions.days"], "steps" => $values["objects.versions.steps"])), "assets" => array("versions" => array("days" => $values["assets.versions.days"], "steps" => $values["assets.versions.steps"]), "ffmpeg" => $values["assets.ffmpeg"], "ghostscript" => $values["assets.ghostscript"], "libreoffice" => $values["assets.libreoffice"], "pngcrush" => $values["assets.pngcrush"], "imgmin" => $values["assets.imgmin"], "jpegoptim" => $values["assets.jpegoptim"], "pdftotext" => $values["assets.pdftotext"], "icc_rgb_profile" => $values["assets.icc_rgb_profile"], "icc_cmyk_profile" => $values["assets.icc_cmyk_profile"], "hide_edit_image" => $values["assets.hide_edit_image"]), "services" => array("translate" => array("apikey" => $values["services.translate.apikey"]), "google" => array("client_id" => $values["services.google.client_id"], "email" => $values["services.google.email"], "simpleapikey" => $values["services.google.simpleapikey"], "browserapikey" => $values["services.google.browserapikey"])), "cache" => array("enabled" => $values["cache.enabled"], "lifetime" => $values["cache.lifetime"], "excludePatterns" => $cacheExcludePatterns, "excludeCookie" => $values["cache.excludeCookie"]), "outputfilters" => array("less" => $values["outputfilters.less"], "lesscpath" => $values["outputfilters.lesscpath"]), "webservice" => array("enabled" => $values["webservice.enabled"]), "httpclient" => array("adapter" => $values["httpclient.adapter"], "proxy_host" => $values["httpclient.proxy_host"], "proxy_port" => $values["httpclient.proxy_port"], "proxy_user" => $values["httpclient.proxy_user"], "proxy_pass" => $values["httpclient.proxy_pass"]), "applicationlog" => array("mail_notification" => array("send_log_summary" => $values['applicationlog.mail_notification.send_log_summary'], "filter_priority" => $values['applicationlog.mail_notification.filter_priority'], "mail_receiver" => $values['applicationlog.mail_notification.mail_receiver']), "archive_treshold" => $values['applicationlog.archive_treshold'], "archive_alternative_database" => $values['applicationlog.archive_alternative_database']));
     // email & newsletter
     foreach (array("email", "newsletter") as $type) {
         $smtpPassword = $values[$type . ".smtp.auth.password"];
         if (empty($smtpPassword)) {
             $smtpPassword = $oldValues[$type]['smtp']['auth']['password'];
         }
         $settings[$type] = array("sender" => array("name" => $values[$type . ".sender.name"], "email" => $values[$type . ".sender.email"]), "return" => array("name" => $values[$type . ".return.name"], "email" => $values[$type . ".return.email"]), "method" => $values[$type . ".method"], "smtp" => array("host" => $values[$type . ".smtp.host"], "port" => $values[$type . ".smtp.port"], "ssl" => $values[$type . ".smtp.ssl"], "name" => $values[$type . ".smtp.name"], "auth" => array("method" => $values[$type . ".smtp.auth.method"], "username" => $values[$type . ".smtp.auth.username"], "password" => $smtpPassword)));
         if (array_key_exists($type . ".debug.emailAddresses", $values)) {
             $settings[$type]["debug"] = array("emailaddresses" => $values[$type . ".debug.emailAddresses"]);
         }
         if (array_key_exists($type . ".bounce.type", $values)) {
             $settings[$type]["bounce"] = array("type" => $values[$type . ".bounce.type"], "maildir" => $values[$type . ".bounce.maildir"], "mbox" => $values[$type . ".bounce.mbox"], "imap" => array("host" => $values[$type . ".bounce.imap.host"], "port" => $values[$type . ".bounce.imap.port"], "username" => $values[$type . ".bounce.imap.username"], "password" => $values[$type . ".bounce.imap.password"], "ssl" => $values[$type . ".bounce.imap.ssl"]));
         }
     }
     $settings["newsletter"]["usespecific"] = $values["newsletter.usespecific"];
     $configFile = \Pimcore\Config::locateConfigFile("system.php");
     File::put($configFile, to_php_data_file_format($settings));
     $this->_helper->json(array("success" => true));
 }
Example #15
0
 /**
  * @static
  * @return array|bool
  */
 public static function getCustomViewConfig()
 {
     $configFile = \Pimcore\Config::locateConfigFile("customviews.php");
     if (!is_file($configFile)) {
         $cvData = false;
     } else {
         $confArray = (include $configFile);
         $cvData = $confArray["views"];
         foreach ($cvData as &$tmp) {
             $tmp["showroot"] = (bool) $tmp["showroot"];
         }
     }
     return $cvData;
 }
 /**
  * @static
  * @param \Zend_Config $config
  * @return void
  */
 public static function setConfig(\Zend_Config $config)
 {
     self::$config = $config;
     $file = \Pimcore\Config::locateConfigFile("extensions.php");
     File::put($file, to_php_data_file_format(self::$config->toArray()));
 }
 public function removeConfig()
 {
     $configFile = \Pimcore\Config::locateConfigFile('lucenesearch_configurations');
     if (is_file($configFile . '.php')) {
         rename($configFile, $configFile . '.BACKUP');
     }
 }
Example #18
0
 /**
  * @param array $allowedUsers
  * @throws \Exception
  */
 public static function checkExecutingUser($allowedUsers = array())
 {
     $configFile = \Pimcore\Config::locateConfigFile("system.php");
     $owner = fileowner($configFile);
     if ($owner == false) {
         throw new \Exception("Couldn't get user from file " . $configFile);
     }
     $userData = posix_getpwuid($owner);
     $allowedUsers[] = $userData['name'];
     $scriptExecutingUserData = posix_getpwuid(posix_geteuid());
     $scriptExecutingUser = $scriptExecutingUserData['name'];
     if (!in_array($scriptExecutingUser, $allowedUsers)) {
         throw new \Exception("The current system user is not allowed to execute this script. Allowed users: '" . implode(',', $allowedUsers) . "' Executing user: '******'.");
     }
 }
Example #19
0
 /**
  * @static
  * @return \Zend_Config_Xml
  */
 public static function getModelClassMappingConfig()
 {
     $config = null;
     if (\Zend_Registry::isRegistered("pimcore_config_model_classmapping")) {
         $config = \Zend_Registry::get("pimcore_config_model_classmapping");
     } else {
         $mappingFile = \Pimcore\Config::locateConfigFile("classmap.php");
         if (is_file($mappingFile)) {
             $config = (include $mappingFile);
             if (is_array($config)) {
                 self::setModelClassMappingConfig($config);
             } else {
                 \Logger::error("classmap.json exists but it is not a valid JSON configuration. Maybe there is a syntax error in the JSON.");
             }
         }
     }
     return $config;
 }
Example #20
0
 /**
  *
  */
 public static function init()
 {
     if (!self::$instance instanceof \Zend_Cache_Core) {
         // check for custom cache configuration
         $customConfigFile = \Pimcore\Config::locateConfigFile("cache.php");
         if (is_file($customConfigFile)) {
             $config = self::getDefaultConfig();
             $conf = (include $customConfigFile);
             if (is_array($conf)) {
                 if (isset($conf["frontend"])) {
                     $config["frontendType"] = $conf["frontend"]["type"];
                     $config["customFrontendNaming"] = $conf["frontend"]["custom"];
                     if (isset($conf["frontend"]["options"])) {
                         $config["frontendConfig"] = $conf["frontend"]["options"];
                     }
                 }
                 if (isset($conf["backend"])) {
                     $config["backendType"] = $conf["backend"]["type"];
                     $config["customBackendNaming"] = $conf["backend"]["custom"];
                     if (isset($conf["backend"]["options"])) {
                         $config["backendConfig"] = $conf["backend"]["options"];
                     }
                 }
                 if (isset($config["frontendConfig"]["lifetime"])) {
                     self::$defaultLifetime = $config["frontendConfig"]["lifetime"];
                 }
                 $config = self::normalizeConfig($config);
                 // here you can use the cache backend you like
                 try {
                     self::$instance = self::initializeCache($config);
                 } catch (\Exception $e) {
                     Logger::crit("can't initialize cache with the given configuration " . $e->getMessage());
                 }
             } else {
                 Logger::crit("Error while reading cache configuration, using the default database backend");
             }
         }
     }
     // return default cache if cache cannot be initialized
     if (!self::$instance instanceof \Zend_Cache_Core) {
         self::$instance = self::getDefaultCache();
     }
     self::$instance->setLifetime(self::$defaultLifetime);
     self::$instance->setOption("automatic_serialization", true);
     self::$instance->setOption("automatic_cleaning_factor", 0);
     // init the write lock once (from other processes etc.)
     if (self::$writeLockTimestamp === null) {
         self::$writeLockTimestamp = 0;
         // set the write lock to 0, otherwise infinite loop (self::hasWriteLock() calls self::getInstance())
         self::hasWriteLock();
     }
     self::setZendFrameworkCaches(self::$instance);
 }
Example #21
0
 /**
  * @return string
  */
 public static function getPrivateKeyPath()
 {
     $path = \Pimcore\Config::locateConfigFile("google-api-private-key.p12");
     return $path;
 }
<?php

// create legacy config folder
$legacyFolder = PIMCORE_CONFIGURATION_DIRECTORY . "/LEGACY";
if (!is_dir($legacyFolder)) {
    mkdir($legacyFolder, 0777, true);
}
$configNames = ["document-types", "image-thumbnails", "newsletter", "predefined-asset-metadata", "custom-reports", "predefined-properties", "qrcode", "staticroutes", "tag-manager", "video-thumbnails", "cache", "classmap"];
foreach ($configNames as $configName) {
    $jsonFile = \Pimcore\Config::locateConfigFile($configName . ".json");
    if (file_exists($jsonFile)) {
        rename($jsonFile, $legacyFolder . "/" . basename($jsonFile));
    }
}
Example #23
0
 /**
  * @param $name
  */
 protected function setFile($name)
 {
     $file = Config::locateConfigFile($name . ".php");
     $this->db = PhpArrayFileTable::get($file);
 }
Example #24
0
    if (file_exists($autoloaderClassMapFile)) {
        $classMapAutoLoader = new \Pimcore\Loader\ClassMapAutoloader([$autoloaderClassMapFile]);
        $classMapAutoLoader->register();
        break;
    }
}
// generic pimcore startup
\Pimcore::setSystemRequirements();
\Pimcore::initAutoloader();
\Pimcore::initConfiguration();
\Pimcore::setupFramework();
\Pimcore::initLogger();
if (\Pimcore\Config::getSystemConfig()) {
    // we do not initialize plugins if pimcore isn't installed properly
    // reason: it can be the case that plugins use the database in isInstalled() witch isn't available at this time
    \Pimcore::initPlugins();
}
// do some general stuff
// this is just for compatibility reasons, pimcore itself doesn't use this constant anymore
if (!defined("PIMCORE_CONFIGURATION_SYSTEM")) {
    define("PIMCORE_CONFIGURATION_SYSTEM", \Pimcore\Config::locateConfigFile("system.php"));
}
$websiteStartup = \Pimcore\Config::locateConfigFile("startup.php");
if (@is_file($websiteStartup)) {
    include_once $websiteStartup;
}
// on pimcore shutdown
register_shutdown_function(function () {
    \Pimcore::getEventManager()->trigger("system.shutdown");
});
include_once "event-listeners.php";
<?php

// create legacy config folder
$legacyFolder = PIMCORE_CONFIGURATION_DIRECTORY . "/LEGACY";
if (!is_dir($legacyFolder)) {
    mkdir($legacyFolder, 0777, true);
}
$files = ["extensions", "customviews", "reports", "system"];
foreach ($files as $fileName) {
    $xmlFile = \Pimcore\Config::locateConfigFile($fileName . ".xml");
    if (file_exists($xmlFile)) {
        rename($xmlFile, $legacyFolder . "/" . basename($xmlFile));
    }
}
Example #26
0
 /**
  * @static
  * @return array|bool
  */
 public static function getCustomViewConfig()
 {
     $configFile = \Pimcore\Config::locateConfigFile("customviews.php");
     if (!is_file($configFile)) {
         $cvData = false;
     } else {
         $confArray = (include $configFile);
         $cvData = [];
         foreach ($confArray["views"] as $tmp) {
             if (isset($tmp["name"])) {
                 $tmp["showroot"] = (bool) $tmp["showroot"];
                 if ((bool) $tmp["hidden"]) {
                     continue;
                 }
                 $cvData[] = $tmp;
             }
         }
     }
     return $cvData;
 }