本文整理汇总了PHP中Pimcore\Config::locateConfigFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::locateConfigFile方法的具体用法?PHP Config::locateConfigFile怎么用?PHP Config::locateConfigFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Config
的用法示例。
在下文中一共展示了Config::locateConfigFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: config
/**
* @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));
}
示例2: saveAction
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));
}
示例3: getConfiguration
/**
* @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;
}
示例4: init
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");
}
}
示例5: init
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");
}
}
示例6: listenAction
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;
}
示例7: getWorkflowManagementConfig
/**
* @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;
}
示例8: setWeb2printAction
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]);
}
示例9: setFlag
/**
* @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));
}
示例10: foreach
<?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);
}
}
示例11: mkdir
<?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) {
}
}
示例12: saveCustomviewsAction
/**
* 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));
}
示例13: setSystemAction
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));
}
示例14: getCustomViewConfig
/**
* @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;
}
示例15: setConfig
/**
* @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()));
}