本文整理汇总了PHP中ConfService::setTmpStorageImplementations方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::setTmpStorageImplementations方法的具体用法?PHP ConfService::setTmpStorageImplementations怎么用?PHP ConfService::setTmpStorageImplementations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::setTmpStorageImplementations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyInstallerForm
//.........这里部分代码省略.........
}
$oldBoot = $this->getPluginWorkDir(true) . "/bootstrap.json";
if (is_file($oldBoot)) {
copy($oldBoot, $oldBoot . ".bak");
unlink($oldBoot);
}
$newBootstrap = array("core.conf" => $coreConf, "core.auth" => $coreAuth);
AJXP_Utils::saveSerialFile($oldBoot, $newBootstrap, true, false, "json", true);
// Write new bootstrap and reload conf plugin!
if ($storageType == "db") {
$coreConf["UNIQUE_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
$coreAuth["MASTER_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
}
$newConfigPlugin = ConfService::instanciatePluginFromGlobalParams($coreConf["UNIQUE_INSTANCE_CONFIG"], "AbstractConfDriver");
$newAuthPlugin = ConfService::instanciatePluginFromGlobalParams($coreAuth["MASTER_INSTANCE_CONFIG"], "AbstractAuthDriver");
if ($data["ENCODING"] != (defined('AJXP_LOCALE') ? AJXP_LOCALE : SystemTextEncoding::getEncoding())) {
file_put_contents($this->getPluginWorkDir() . "/encoding.php", "<?php \$ROOT_ENCODING='" . $data["ENCODING"] . "';");
}
$tpl = file_get_contents($this->getBaseDir() . "/htaccess.tpl");
if (!empty($data["SERVER_URI"]) && $data["SERVER_URI"] != "/") {
$htContent = str_replace('${APPLICATION_ROOT}', $data["SERVER_URI"], $tpl);
} else {
$htContent = str_replace('${APPLICATION_ROOT}/', "/", $tpl);
$htContent = str_replace('${APPLICATION_ROOT}', "/", $htContent);
}
if (is_writeable(AJXP_INSTALL_PATH . "/.htaccess")) {
file_put_contents(AJXP_INSTALL_PATH . "/.htaccess", $htContent);
} else {
$htAccessToUpdate = AJXP_INSTALL_PATH . "/.htaccess";
}
if ($storageType == "db") {
$sqlPlugs = array("core.notifications/UNIQUE_FEED_INSTANCE" => "feed.sql", "core.log/UNIQUE_PLUGIN_INSTANCE" => "log.sql", "core.mq/UNIQUE_MS_INSTANCE" => "mq.sql");
$data["ENABLE_NOTIF"] = $data["STORAGE_TYPE"]["notifications"];
}
// Prepare plugins configs
$direct = array("APPLICATION_TITLE" => "core.ajaxplorer/APPLICATION_TITLE", "APPLICATION_LANGUAGE" => "core.ajaxplorer/DEFAULT_LANGUAGE", "ENABLE_NOTIF" => "core.notifications/USER_EVENTS", "APPLICATION_WELCOME" => "gui.ajax/CUSTOM_WELCOME_MESSAGE");
$mailerEnabled = $data["MAILER_ENABLE"]["status"];
if ($mailerEnabled == "yes") {
// Enable core.mailer
$data["MAILER_SYSTEM"] = $data["MAILER_ENABLE"]["MAILER_SYSTEM"];
$data["MAILER_ADMIN"] = $data["MAILER_ENABLE"]["MAILER_ADMIN"];
$direct = array_merge($direct, array("MAILER_SYSTEM" => "mailer.phpmailer-lite/MAILER", "MAILER_ADMIN" => "core.mailer/FROM"));
}
foreach ($direct as $key => $value) {
list($pluginId, $param) = explode("/", $value);
$options = array();
$newConfigPlugin->_loadPluginConfig($pluginId, $options);
$options[$param] = $data[$key];
$newConfigPlugin->_savePluginConfig($pluginId, $options);
}
if (isset($sqlPlugs)) {
foreach ($sqlPlugs as $core => $value) {
list($pluginId, $param) = explode("/", $core);
$options = array();
$newConfigPlugin->_loadPluginConfig($pluginId, $options);
$options[$param] = array("instance_name" => $value, "group_switch_value" => $value, "SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core"));
$newConfigPlugin->_savePluginConfig($pluginId, $options);
}
}
ConfService::setTmpStorageImplementations($newConfigPlugin, $newAuthPlugin);
require_once $newConfigPlugin->getUserClassFileName();
$adminLogin = AJXP_Utils::sanitize($data["ADMIN_USER_LOGIN"], AJXP_SANITIZE_EMAILCHARS);
$adminName = $data["ADMIN_USER_NAME"];
$adminPass = $data["ADMIN_USER_PASS"];
$adminPass2 = $data["ADMIN_USER_PASS2"];
AuthService::createUser($adminLogin, $adminPass, true);
$uObj = $newConfigPlugin->createUserObject($adminLogin);
if (isset($data["MAILER_ADMIN"])) {
$uObj->personalRole->setParameterValue("core.conf", "email", $data["MAILER_ADMIN"]);
}
$uObj->personalRole->setParameterValue("core.conf", "USER_DISPLAY_NAME", $adminName);
$uObj->personalRole->setAcl('ajxp_conf', 'rw');
AuthService::updateRole($uObj->personalRole);
$loginP = "USER_LOGIN";
$i = 0;
while (isset($data[$loginP]) && !empty($data[$loginP])) {
$pass = $data[str_replace("_LOGIN", "_PASS", $loginP)];
$pass2 = $data[str_replace("_LOGIN", "_PASS2", $loginP)];
$name = $data[str_replace("_LOGIN", "_NAME", $loginP)];
$mail = $data[str_replace("_LOGIN", "_MAIL", $loginP)];
$saniLogin = AJXP_Utils::sanitize($data[$loginP], AJXP_SANITIZE_EMAILCHARS);
AuthService::createUser($saniLogin, $pass);
$uObj = $newConfigPlugin->createUserObject($saniLogin);
$uObj->personalRole->setParameterValue("core.conf", "email", $mail);
$uObj->personalRole->setParameterValue("core.conf", "USER_DISPLAY_NAME", $name);
AuthService::updateRole($uObj->personalRole);
$i++;
$loginP = "USER_LOGIN_" . $i;
}
AJXP_PluginsService::clearPluginsCache();
AJXP_Utils::setApplicationFirstRunPassed();
if (isset($htAccessToUpdate)) {
HTMLWriter::charsetHeader("application/json");
echo json_encode(array('file' => $htAccessToUpdate, 'content' => $htContent));
} else {
session_destroy();
HTMLWriter::charsetHeader("text/plain");
echo 'OK';
}
}
示例2: applyInstallerForm
/**
* Transmit to the ajxp_conf load_plugin_manifest action
* @param $action
* @param $httpVars
* @param $fileVars
*/
public function applyInstallerForm($action, $httpVars, $fileVars)
{
$data = array();
AJXP_Utils::parseStandardFormParameters($httpVars, $data, null, "");
list($newConfigPlugin, $newAuthPlugin) = $this->createBootstrapConf($data);
$this->feedPluginsOptions($newConfigPlugin, $data);
ConfService::setTmpStorageImplementations($newConfigPlugin, $newAuthPlugin);
$this->createUsers($data);
$this->setAdditionalData($data);
$htContent = null;
$htAccessToUpdate = $this->updateHtAccess($data, $htContent);
$this->sendInstallResult($htAccessToUpdate, $htContent);
}
示例3: applyInstallerForm
/**
* Transmit to the ajxp_conf load_plugin_manifest action
* @param $action
* @param $httpVars
* @param $fileVars
*/
public function applyInstallerForm($action, $httpVars, $fileVars)
{
$data = array();
AJXP_Utils::parseStandardFormParameters($httpVars, $data, null, "");
// Create a custom bootstrap.json file
$coreConf = array();
$coreAuth = array();
$this->_loadPluginConfig("core.conf", $coreConf);
$this->_loadPluginConfig("core.auth", $coreAuth);
if (!isset($coreConf["UNIQUE_INSTANCE_CONFIG"])) {
$coreConf["UNIQUE_INSTANCE_CONFIG"] = array();
}
if (!isset($coreAuth["MASTER_INSTANCE_CONFIG"])) {
$coreAuth["MASTER_INSTANCE_CONFIG"] = array();
}
$storageType = $data["STORAGE_TYPE"]["type"];
$coreConfLIVECONFIG = array();
if ($storageType == "db") {
// REWRITE BOOTSTRAP.JSON
$coreConf["DIBI_PRECONFIGURATION"] = $data["STORAGE_TYPE"]["db_type"];
if (isset($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_driver"])) {
$dbFile = AJXP_VarsFilter::filter($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_database"]);
if (!file_exists(dirname($dbFile))) {
mkdir(dirname($dbFile), 0755, true);
}
}
$coreConf["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreConf["UNIQUE_INSTANCE_CONFIG"], array("instance_name" => "conf.sql", "group_switch_value" => "conf.sql", "SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")));
$coreAuth["MASTER_INSTANCE_CONFIG"] = array_merge($coreAuth["MASTER_INSTANCE_CONFIG"], array("instance_name" => "auth.sql", "group_switch_value" => "auth.sql", "SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")));
// INSTALL ALL SQL TABLES
$sqlPlugs = array("conf.sql", "auth.sql", "feed.sql", "log.sql", "mq.sql");
foreach ($sqlPlugs as $plugId) {
$plug = AJXP_PluginsService::findPluginById($plugId);
$plug->installSQLTables(array("SQL_DRIVER" => $data["STORAGE_TYPE"]["db_type"]));
}
} else {
$coreConf["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreConf["UNIQUE_INSTANCE_CONFIG"], array("instance_name" => "conf.serial", "group_switch_value" => "conf.serial"));
$coreAuth["MASTER_INSTANCE_CONFIG"] = array_merge($coreAuth["MASTER_INSTANCE_CONFIG"], array("instance_name" => "auth.serial", "group_switch_value" => "auth.serial"));
}
$oldBoot = $this->getPluginWorkDir(true) . "/bootstrap.json";
if (is_file($oldBoot)) {
copy($oldBoot, $oldBoot . ".bak");
unlink($oldBoot);
}
$newBootstrap = array("core.conf" => $coreConf, "core.auth" => $coreAuth);
AJXP_Utils::saveSerialFile($oldBoot, $newBootstrap, true, false, "json", true);
// Write new bootstrap and reload conf plugin!
if ($storageType == "db") {
$coreConf["UNIQUE_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
$coreAuth["MASTER_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
}
$newConfigPlugin = ConfService::instanciatePluginFromGlobalParams($coreConf["UNIQUE_INSTANCE_CONFIG"], "AbstractConfDriver");
$newAuthPlugin = ConfService::instanciatePluginFromGlobalParams($coreAuth["MASTER_INSTANCE_CONFIG"], "AbstractAuthDriver");
if ($storageType == "db") {
$sqlPlugs = array("core.notifications/UNIQUE_FEED_INSTANCE" => "feed.sql", "core.log/UNIQUE_PLUGIN_INSTANCE" => "log.sql", "core.mq/UNIQUE_MS_INSTANCE" => "mq.sql");
$data["ENABLE_NOTIF"] = $data["STORAGE_TYPE"]["notifications"];
}
// Prepare plugins configs
$direct = array("APPLICATION_TITLE" => "core.ajaxplorer/APPLICATION_TITLE", "APPLICATION_LANGUAGE" => "core.ajaxplorer/DEFAULT_LANGUAGE", "ENABLE_NOTIF" => "core.notifications/USER_EVENTS", "APPLICATION_WELCOME" => "gui.ajax/CUSTOM_WELCOME_MESSAGE");
$mailerEnabled = $data["MAILER_ENABLE"]["status"];
if ($mailerEnabled == "yes") {
// Enable core.mailer
$data["MAILER_SYSTEM"] = $data["MAILER_ENABLE"]["MAILER_SYSTEM"];
$data["MAILER_ADMIN"] = $data["MAILER_ENABLE"]["MAILER_ADMIN"];
$direct = array_merge($direct, array("MAILER_SYSTEM" => "mailer.phpmailer-lite/MAILER", "MAILER_ADMIN" => "core.mailer/FROM"));
}
foreach ($direct as $key => $value) {
list($pluginId, $param) = explode("/", $value);
$options = array();
$newConfigPlugin->_loadPluginConfig($pluginId, $options);
$options[$param] = $data[$key];
$newConfigPlugin->_savePluginConfig($pluginId, $options);
}
if (isset($sqlPlugs)) {
foreach ($sqlPlugs as $core => $value) {
list($pluginId, $param) = explode("/", $core);
$options = array();
$newConfigPlugin->_loadPluginConfig($pluginId, $options);
$options[$param] = array("instance_name" => $value, "group_switch_value" => $value, "SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core"));
$newConfigPlugin->_savePluginConfig($pluginId, $options);
}
}
ConfService::setTmpStorageImplementations($newConfigPlugin, $newAuthPlugin);
require_once $newConfigPlugin->getUserClassFileName();
$adminLogin = AJXP_Utils::sanitize($data["ADMIN_USER_LOGIN"], AJXP_SANITIZE_EMAILCHARS);
$adminName = $data["ADMIN_USER_NAME"];
$adminPass = $data["ADMIN_USER_PASS"];
$adminPass2 = $data["ADMIN_USER_PASS2"];
AuthService::createUser($adminLogin, $adminPass, true);
$uObj = $newConfigPlugin->createUserObject($adminLogin);
if (isset($data["MAILER_ADMIN"])) {
$uObj->personalRole->setParameterValue("core.conf", "email", $data["MAILER_ADMIN"]);
}
$uObj->personalRole->setParameterValue("core.conf", "USER_DISPLAY_NAME", $adminName);
AuthService::updateRole($uObj->personalRole);
//.........这里部分代码省略.........