本文整理汇总了PHP中Zend_Config_Writer_Ini::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Writer_Ini::setConfig方法的具体用法?PHP Zend_Config_Writer_Ini::setConfig怎么用?PHP Zend_Config_Writer_Ini::setConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Writer_Ini
的用法示例。
在下文中一共展示了Zend_Config_Writer_Ini::setConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$piwikUrl = isset($config->piwik->url) ? $config->piwik->url : STATISTICS_PIWIK_URL_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_PIWIK_URL_KEY, $piwikUrl, $this->moduleName);
$piwikId = isset($config->piwik->id) ? $config->piwik->id : STATISTICS_PIWIK_SITE_ID_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_PIWIK_SITE_ID_KEY, $piwikId, $this->moduleName);
$piwikApiKey = isset($config->piwik->apikey) ? $config->piwik->apikey : STATISTICS_PIWIK_API_KEY_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_PIWIK_API_KEY_KEY, $piwikApiKey, $this->moduleName);
$ipInfoDbApiKey = isset($config->ipinfodb->apikey) ? $config->ipinfodb->apikey : STATISTICS_IP_INFO_DB_API_KEY_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_IP_INFO_DB_API_KEY_KEY, $ipInfoDbApiKey, $this->moduleName);
$settingModel->setConfig(STATISTICS_SEND_DAILY_REPORTS_KEY, $config->get('report', STATISTICS_SEND_DAILY_REPORTS_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->piwik->url);
unset($config->global->piwik->id);
unset($config->global->piwik->pikey);
unset($config->global->ipinfodb->apikey);
unset($config->global->report);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(STATISTICS_PIWIK_URL_KEY, STATISTICS_PIWIK_URL_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_PIWIK_SITE_ID_KEY, STATISTICS_PIWIK_SITE_ID_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_PIWIK_API_KEY_KEY, STATISTICS_PIWIK_API_KEY_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_IP_INFO_DB_API_KEY_KEY, STATISTICS_IP_INFO_DB_API_KEY_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_SEND_DAILY_REPORTS_KEY, STATISTICS_SEND_DAILY_REPORTS_DEFAULT_VALUE, $this->moduleName);
}
}
示例2: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(DICOMEXTRACTOR_DCM2XML_COMMAND_KEY, $config->get('dcm2xml', DICOMEXTRACTOR_DCM2XML_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMJ2PNM_COMMAND_KEY, $config->get('dcmj2pnm', DICOMEXTRACTOR_DCMJ2PNM_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMFTEST_COMMAND_KEY, $config->get('dcmftest', DICOMEXTRACTOR_DCMFTEST_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMDICTPATH_KEY, $config->get('dcmdictpath', DICOMEXTRACTOR_DCMDICTPATH_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->dcm2xml);
unset($config->global->dcmj2pnm);
unset($config->global->dcmftest);
unset($config->global->dcmdictpath);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(DICOMEXTRACTOR_DCM2XML_COMMAND_KEY, DICOMEXTRACTOR_DCM2XML_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMJ2PNM_COMMAND_KEY, DICOMEXTRACTOR_DCMJ2PNM_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMFTEST_COMMAND_KEY, DICOMEXTRACTOR_DCMFTEST_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMDICTPATH_KEY, DICOMEXTRACTOR_DCMDICTPATH_DEFAULT_VALUE, $this->moduleName);
}
}
示例3: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var RandomComponent $randomComponent */
$randomComponent = MidasLoader::loadComponent('Random');
$securityKey = $randomComponent->generateString(32);
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SECURITY_KEY_KEY, $config->get('securitykey', $securityKey), $this->moduleName);
$showButton = $config->get('showbutton');
if ($showButton === 'true') {
$showButton = 1;
} elseif ($showButton === 'false') {
$showButton = 0;
} else {
$showButton = MIDAS_REMOTEPROCESSING_SHOW_BUTTON_DEFAULT_VALUE;
}
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SHOW_BUTTON_KEY, $showButton, $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->securitykey->securitykey);
unset($config->showbutton->showbutton);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SECURITY_KEY_KEY, $securityKey, $this->moduleName);
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SHOW_BUTTON_KEY, MIDAS_REMOTEPROCESSING_SHOW_BUTTON_DEFAULT_VALUE, $this->moduleName);
}
}
示例4: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_PHMAGICK, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_JPG, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, $config->get('imagemagick', MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, $config->get('useThumbnailer', MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, $config->get('thumbnailer', MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->imageFormats);
unset($config->global->imagemagick);
unset($config->global->thumbnailer);
unset($config->global->useThumbnailer);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
}
}
示例5: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$config = new Zend_Config_Ini(APPLICATION_CONFIG, 'global');
$settingModel->setConfig('address_verification', $config->get('verifyemail', 0), 'mail');
if ($config->get('smtpfromaddress')) {
$fromAddress = $config->get('smtpfromaddress');
} elseif (ini_get('sendmail_from')) {
$fromAddress = ini_get('sendmail_from');
} else {
$fromAddress = 'no-reply@example.org';
// RFC2606
}
$settingModel->setConfig('from_address', $fromAddress, 'mail');
if ($config->get('smtpserver')) {
$components = parse_url($config->get('smtpserver'));
if (isset($components['host'])) {
$settingModel->setConfig('smtp_host', $components['host'], 'mail');
}
if (isset($components['port'])) {
$settingModel->setConfig('smtp_port', $components['port'], 'mail');
if ($components['port'] === 587) {
$settingModel->setConfig('smtp_use_ssl', 1, 'mail');
}
}
if (isset($components['user'])) {
$settingModel->setConfig('smtp_username', $components['user'], 'mail');
}
if (isset($components['pass'])) {
$settingModel->setConfig('smtp_password', $components['pass'], 'mail');
}
}
if ($config->get('smtpuser')) {
$settingModel->setConfig('smtp_username', $config->get('smtpuser'), 'mail');
}
if ($config->get('smtppassword')) {
$settingModel->setConfig('smtp_password', $config->get('smtppassword'), 'mail');
}
if ($settingModel->getValueByName('smtp_host', 'mail')) {
$provider = 'smtp';
} else {
$provider = 'mail';
}
$settingModel->setConfig('provider', $provider, 'mail');
/** @var UtilityComponent $utilityComponent */
$utilityComponent = MidasLoader::loadComponent('Utility');
$utilityComponent->installModule('mail');
$config = new Zend_Config_Ini(APPLICATION_CONFIG, null, true);
unset($config->global->smtpfromaddress);
unset($config->global->smtpserver);
unset($config->global->smtpuser);
unset($config->global->smtppassword);
unset($config->global->verifyemail);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename(APPLICATION_CONFIG);
$writer->write();
}
示例6: setIsInstalled
public static function setIsInstalled()
{
try {
$writer = new Zend_Config_Writer_Ini();
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/app.ini', null, array('skipExtends' => true, 'allowModifications' => true));
$config->production->isInstalled = "1";
$writer->setConfig($config)->setFilename(APPLICATION_PATH . '/configs/app.ini')->write();
return true;
} catch (Exception $e) {
return false;
}
}
示例7: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(MIDAS_DICOMSERVER_DCM2XML_COMMAND_KEY, $config->get('dcm2xml', MIDAS_DICOMSERVER_DCM2XML_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_STORESCP_COMMAND_KEY, $config->get('storescp', MIDAS_DICOMSERVER_STORESCP_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_STORESCP_PORT_KEY, $config->get('storescp_port', MIDAS_DICOMSERVER_STORESCP_PORT_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_STORESCP_STUDY_TIMEOUT_KEY, $config->get('storescp_study_timeout', MIDAS_DICOMSERVER_STORESCP_STUDY_TIMEOUT_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_RECEPTION_DIRECTORY_KEY, $config->get('receptiondir', MIDAS_DICOMSERVER_RECEPTION_DIRECTORY_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DESTINATION_FOLDER_KEY, $config->get('pydas_dest_folder', MIDAS_DICOMSERVER_DESTINATION_FOLDER_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DCMQRSCP_COMMAND_KEY, $config->get('dcmqrscp', MIDAS_DICOMSERVER_DCMQRSCP_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DCMQRSCP_PORT_KEY, $config->get('dcmqrscp_port', MIDAS_DICOMSERVER_DCMQRSCP_PORT_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DCMQRIDX_COMMAND_KEY, $config->get('dcmqridx', MIDAS_DICOMSERVER_DCMQRIDX_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_SERVER_AE_TITLE_KEY, $config->get('server_ae_title', MIDAS_DICOMSERVER_SERVER_AE_TITLE_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_PEER_AES_KEY, $config->get('peer_aes', MIDAS_DICOMSERVER_PEER_AES_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->dcm2xml);
unset($config->global->storescp);
unset($config->global->storescp_port);
unset($config->global->storescp_study_timeout);
unset($config->global->receptiondir);
unset($config->global->pydas_dest_folder);
unset($config->global->dcmqrscp);
unset($config->global->dcmqrscp_port);
unset($config->global->dcmqridx);
unset($config->global->server_ae_title);
unset($config->global->peer_aes);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(MIDAS_DICOMSERVER_DCM2XML_COMMAND_KEY, MIDAS_DICOMSERVER_DCM2XML_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_STORESCP_COMMAND_KEY, MIDAS_DICOMSERVER_STORESCP_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_STORESCP_PORT_KEY, MIDAS_DICOMSERVER_STORESCP_PORT_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_STORESCP_STUDY_TIMEOUT_KEY, MIDAS_DICOMSERVER_STORESCP_STUDY_TIMEOUT_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_RECEPTION_DIRECTORY_KEY, MIDAS_DICOMSERVER_RECEPTION_DIRECTORY_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DESTINATION_FOLDER_KEY, MIDAS_DICOMSERVER_DESTINATION_FOLDER_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DCMQRSCP_COMMAND_KEY, MIDAS_DICOMSERVER_DCMQRSCP_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DCMQRSCP_PORT_KEY, MIDAS_DICOMSERVER_DCMQRSCP_PORT_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_DCMQRIDX_COMMAND_KEY, MIDAS_DICOMSERVER_DCMQRIDX_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_SERVER_AE_TITLE_KEY, MIDAS_DICOMSERVER_SERVER_AE_TITLE_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_DICOMSERVER_PEER_AES_KEY, MIDAS_DICOMSERVER_PEER_AES_DEFAULT_VALUE, $this->moduleName);
}
}
示例8: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(CLEANUP_DAYS_TO_KEEP_PARTIAL_FILES_KEY, $config->get('days', CLEANUP_DAYS_TO_KEEP_PARTIAL_FILES_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->days);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(CLEANUP_DAYS_TO_KEEP_PARTIAL_FILES_KEY, CLEANUP_DAYS_TO_KEEP_PARTIAL_FILES_DEFAULT_VALUE, $this->moduleName);
}
}
示例9: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(METADATAEXTRACTOR_HACHOIR_METADATA_COMMAND_KEY, $config->get('hachoir', METADATAEXTRACTOR_HACHOIR_METADATA_COMMAND_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->hachoir);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(METADATAEXTRACTOR_HACHOIR_METADATA_COMMAND_KEY, METADATAEXTRACTOR_HACHOIR_METADATA_COMMAND_DEFAULT_VALUE, $this->moduleName);
}
}
示例10: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(API_METHOD_PREFIX_KEY, $config->get('methodprefix', API_METHOD_PREFIX_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->methodprefix);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(API_METHOD_PREFIX_KEY, API_METHOD_PREFIX_DEFAULT_VALUE, $this->moduleName);
}
}
示例11: _createIni
protected function _createIni(array $params)
{
if ($this->_checkConnection($params)) {
try {
$writer = new Zend_Config_Writer_Ini();
if (!@copy(APPLICATION_PATH . '/configs/app.sample.ini', APPLICATION_PATH . '/configs/app.ini')) {
throw new Exception("The file /app/configs/app.ini is not writable. Please check the write permissions of the /app/configs folder and try again.");
}
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/app.ini', null, array('skipExtends' => true, 'allowModifications' => true));
$config->production->resources->db->params->host = $params['host'];
$config->production->resources->db->params->dbname = $params['dbname'];
$config->production->resources->db->params->username = $params['username'];
$config->production->resources->db->params->password = $params['password'];
$writer->setConfig($config)->setFilename(APPLICATION_PATH . '/configs/app.ini')->write();
return true;
} catch (Exception $e) {
$this->_error = $e->getMessage();
}
}
return false;
}
示例12: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(OAI_REPOSITORY_IDENTIFIER_KEY, $config->get('repositoryidentifier', OAI_REPOSITORY_IDENTIFIER_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(OAI_REPOSITORY_NAME_KEY, $config->get('repositoryname', OAI_REPOSITORY_NAME_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(OAI_ADMIN_EMAIL_KEY, $config->get('adminemail', OAI_ADMIN_EMAIL_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->repositoryidentifier);
unset($config->global->repositoryname);
unset($config->global->adminemail);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(OAI_REPOSITORY_IDENTIFIER_KEY, OAI_REPOSITORY_IDENTIFIER_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(OAI_REPOSITORY_NAME_KEY, OAI_REPOSITORY_NAME_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(OAI_ADMIN_EMAIL_KEY, OAI_ADMIN_EMAIL_DEFAULT_VALUE, $this->moduleName);
}
}
示例13: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(VISUALIZE_TEMPORARY_DIRECTORY_KEY, $config->get('customtmp', VISUALIZE_TEMPORARY_DIRECTORY_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(VISUALIZE_USE_PARAVIEW_WEB_KEY, $config->get('useparaview', VISUALIZE_USE_PARAVIEW_WEB_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(VISUALIZE_USE_WEB_GL_KEY, $config->get('userwebgl', VISUALIZE_USE_WEB_GL_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(VISUALIZE_USE_SYMLINKS_KEY, $config->get('usesymlinks', VISUALIZE_USE_SYMLINKS_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(VISUALIZE_TOMCAT_ROOT_URL_KEY, $config->get('pwapp', VISUALIZE_TOMCAT_ROOT_URL_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(VISUALIZE_PVBATCH_COMMAND_KEY, $config->get('pvbatch', VISUALIZE_PVBATCH_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, $config->get('paraviewworkdir', VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->customtmp);
unset($config->global->useparaview);
unset($config->global->userwebgl);
unset($config->global->usesymlinks);
unset($config->global->pwapp);
unset($config->global->pvbatch);
unset($config->global->paraviewworkdir);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(VISUALIZE_TEMPORARY_DIRECTORY_KEY, VISUALIZE_TEMPORARY_DIRECTORY_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(VISUALIZE_USE_PARAVIEW_WEB_KEY, VISUALIZE_USE_PARAVIEW_WEB_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(VISUALIZE_USE_WEB_GL_KEY, VISUALIZE_USE_WEB_GL_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(VISUALIZE_USE_SYMLINKS_KEY, VISUALIZE_USE_SYMLINKS_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(VISUALIZE_TOMCAT_ROOT_URL_KEY, VISUALIZE_TOMCAT_ROOT_URL_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(VISUALIZE_PVBATCH_COMMAND_KEY, VISUALIZE_PVBATCH_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_KEY, VISUALIZE_PARAVIEW_WEB_WORK_DIRECTORY_DEFAULT_VALUE, $this->moduleName);
}
}
示例14: reset
/** Reset database (only works with MySQL) */
public function reset()
{
$db = Zend_Registry::get('dbAdapter');
$dbname = Zend_Registry::get('configDatabase')->database->params->dbname;
$stmt = $db->query("SELECT * FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = '" . $dbname . "'");
while ($row = $stmt->fetch()) {
$db->query('DELETE FROM `' . $row['TABLE_NAME'] . '`');
}
$path = UtilityComponent::getDataDirectory('assetstore');
$dir = opendir($path);
while ($entry = readdir($dir)) {
if (is_dir($path . '/' . $entry) && !in_array($entry, array('.', '..'))) {
$this->_rrmdir($path . '/' . $entry);
}
}
$path = UtilityComponent::getDataDirectory('thumbnail');
$dir = opendir($path);
while ($entry = readdir($dir)) {
if (is_dir($path . '/' . $entry) && !in_array($entry, array('.', '..'))) {
$this->_rrmdir($path . '/' . $entry);
}
}
if (file_exists(LOCAL_CONFIGS_PATH . '/ldap.local.ini')) {
unlink(LOCAL_CONFIGS_PATH . '/ldap.local.ini');
}
/** @var UserModel $userModel */
$userModel = MidasLoader::loadModel('User');
$admin = $userModel->createUser(MIDAS_DEMO_ADMIN_EMAIL, MIDAS_DEMO_ADMIN_PASSWORD, 'Demo', 'Administrator', 1);
$userModel->createUser(MIDAS_DEMO_USER_EMAIL, MIDAS_DEMO_USER_PASSWORD, 'Demo', 'User', 0);
/** @var CommunityModel $communityModel */
$communityModel = MidasLoader::loadModel('Community');
$communityDao = $communityModel->createCommunity('Demo', 'This is a demo community', MIDAS_COMMUNITY_PUBLIC, $admin, MIDAS_COMMUNITY_CAN_JOIN);
/** @var AssetstoreModel $assetstoreModel */
$assetstoreModel = MidasLoader::loadModel('Assetstore');
$assetstoreDao = new AssetstoreDao();
$assetstoreDao->setName('Default');
$assetstoreDao->setPath(UtilityComponent::getDataDirectory('assetstore'));
$assetstoreDao->setType(MIDAS_ASSETSTORE_LOCAL);
$assetstoreModel->save($assetstoreDao);
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$settingModel->setConfig('default_assetstore', $assetstoreDao->getKey());
$options = array('allowModifications' => true);
$config = new Zend_Config_Ini(CORE_CONFIGS_PATH . '/application.ini', null, $options);
$config->global->dynamichelp = 1;
$config->global->environment = 'production';
$config->global->application->name = 'Midas Platform - Demo';
$description = 'Midas Platform is an open-source toolkit that enables the
rapid creation of tailored, web-enabled data storage. Designed to meet
the needs of advanced data-centric computing, Midas Platform addresses
the growing challenge of large data by providing a flexible, intelligent
data storage system. The system integrates multimedia server technology
with other open-source data analysis and visualization tools to enable
data-intensive applications that easily interface with existing
workflows.';
$config->global->application->description = $description;
$enabledModules = array('api', 'metadataextractor', 'oai', 'statistics', 'scheduler', 'thumbnailcreator', 'visualize');
foreach ($enabledModules as $module) {
if (file_exists(LOCAL_CONFIGS_PATH . '/' . $module . '.demo.local.ini')) {
copy(LOCAL_CONFIGS_PATH . '/' . $module . '.demo.local.ini', LOCAL_CONFIGS_PATH . '/' . $module . '.local.ini');
$config->module->{$module} = 1;
} else {
unlink(LOCAL_CONFIGS_PATH . '/' . $module . '.local.ini');
}
}
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename(LOCAL_CONFIGS_PATH . '/application.local.ini');
$writer->write();
$configGlobal = new Zend_Config_Ini(APPLICATION_CONFIG, 'global', true);
Zend_Registry::set('configGlobal', $configGlobal);
/** @var UploadComponent $uploadComponent */
$uploadComponent = MidasLoader::loadComponent('Upload');
$uploadComponent->createUploadedItem($admin, 'midasLogo.gif', BASE_PATH . '/core/public/images/midasLogo.gif', $communityDao->getPublicFolder(), null, '', true);
$uploadComponent->createUploadedItem($admin, 'cow.vtp', BASE_PATH . '/modules/demo/public/' . $this->moduleName . '/cow.vtp', $communityDao->getPublicFolder(), null, '', true);
}
示例15: indexAction
/** index */
public function indexAction()
{
$this->requireAdminPrivileges();
$this->view->header = 'Administration';
$options = array('allowModifications' => true);
$config = new Zend_Config_Ini(APPLICATION_CONFIG, null, $options);
$configForm = $this->Form->Admin->createConfigForm();
$formArray = $this->getFormAsArray($configForm);
$formArray['description']->setValue($config->global->application->description);
$formArray['lang']->setValue($config->global->application->lang);
$formArray['name']->setValue($config->global->application->name);
$formArray['timezone']->setValue($config->global->default->timezone);
if (isset($config->global->allow_password_reset)) {
$formArray['allow_password_reset']->setValue($config->global->allow_password_reset);
}
if (isset($config->global->closeregistration)) {
$formArray['closeregistration']->setValue($config->global->closeregistration);
}
if (isset($config->global->dynamichelp)) {
$formArray['dynamichelp']->setValue($config->global->dynamichelp);
}
if (isset($config->global->gravatar)) {
$formArray['gravatar']->setValue($config->global->gravatar);
}
if (isset($config->global->httpproxy)) {
$formArray['httpProxy']->setValue($config->global->httpproxy);
}
$this->view->configForm = $formArray;
$this->view->selectedLicense = $config->global->defaultlicense;
try {
$this->view->allLicenses = $this->License->getAll();
} catch (Exception $e) {
$this->view->allLicenses = array();
}
$allModules = $this->Component->Utility->getAllModules();
$this->view->extraTabs = Zend_Registry::get('notifier')->callback('CALLBACK_CORE_ADMIN_TABS');
if ($this->_request->isPost()) {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$submitConfig = $this->getParam('submitConfig');
$submitModule = $this->getParam('submitModule');
if (isset($submitConfig)) {
$config->global->application->name = $this->getParam('name');
$config->global->application->description = $this->getParam('description');
$config->global->application->lang = $this->getParam('lang');
$config->global->default->timezone = $this->getParam('timezone');
$config->global->defaultlicense = $this->getParam('licenseSelect');
$config->global->allow_password_reset = $this->getParam('allow_password_reset');
$config->global->closeregistration = $this->getParam('closeregistration');
$config->global->dynamichelp = $this->getParam('dynamichelp');
$config->global->gravatar = $this->getParam('gravatar');
$config->global->httpproxy = $this->getParam('httpProxy');
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename(APPLICATION_CONFIG);
$writer->write();
echo JsonComponent::encode(array(true, 'Changes saved'));
}
if (isset($submitModule)) {
$moduleName = $this->getParam('modulename');
$modulevalue = $this->getParam('modulevalue');
$moduleConfigLocalFile = LOCAL_CONFIGS_PATH . '/' . $moduleName . '.local.ini';
$moduleConfigFile = BASE_PATH . '/modules/' . $moduleName . '/configs/module.ini';
$moduleConfigPrivateFile = BASE_PATH . '/privateModules/' . $moduleName . '/configs/module.ini';
if (!file_exists($moduleConfigLocalFile) && file_exists($moduleConfigFile)) {
copy($moduleConfigFile, $moduleConfigLocalFile);
$this->Component->Utility->installModule($moduleName);
} elseif (!file_exists($moduleConfigLocalFile) && file_exists($moduleConfigPrivateFile)) {
copy($moduleConfigPrivateFile, $moduleConfigLocalFile);
$this->Component->Utility->installModule($moduleName);
} elseif (!file_exists($moduleConfigLocalFile)) {
throw new Zend_Exception('Unable to find config file');
}
$config->module->{$moduleName} = $modulevalue;
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename(APPLICATION_CONFIG);
$writer->write();
echo JsonComponent::encode(array(true, 'Changes saved'));
}
}
$defaultAssetStoreId = $this->Assetstore->getDefault()->getKey();
// get assetstore data
$assetstores = $this->Assetstore->getAll();
$defaultSet = false;
foreach ($assetstores as $key => $assetstore) {
if ($assetstore->getKey() == $defaultAssetStoreId) {
$assetstores[$key]->default = true;
$defaultSet = true;
} else {
$assetstores[$key]->default = false;
}
// Check if we can access the path
if (file_exists($assetstore->getPath())) {
$assetstores[$key]->totalSpace = UtilityComponent::diskTotalSpace($assetstore->getPath());
$assetstores[$key]->totalSpaceText = $this->Component->Utility->formatSize($assetstores[$key]->totalSpace);
$assetstores[$key]->freeSpace = UtilityComponent::diskFreeSpace($assetstore->getPath());
$assetstores[$key]->freeSpaceText = $this->Component->Utility->formatSize($assetstores[$key]->freeSpace);
} else {
//.........这里部分代码省略.........