예제 #1
0
 /** 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);
     }
 }
예제 #2
0
 /** 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);
     }
 }
예제 #3
0
 /** 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
0
 /** 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
0
 /** 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 = '*****@*****.**';
         // 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
0
 /** 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);
     }
 }
예제 #7
0
 /** 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);
     }
 }
예제 #8
0
 /** 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);
     }
 }
예제 #9
0
 /** 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);
     }
 }
예제 #10
0
 /** 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);
     }
 }
예제 #11
0
 /** 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);
     }
 }
예제 #12
0
 /** 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 {
             $assetstores[$key]->totalSpaceText = false;
         }
     }
     if (!$defaultSet) {
         foreach ($assetstores as $key => $assetstore) {
             $assetstores[$key]->default = true;
             $this->Setting->setConfig('default_assetstore', $assetstores[$key]->getKey());
             $writer = new Zend_Config_Writer_Ini();
             $writer->setConfig($config);
             $writer->setFilename(APPLICATION_CONFIG);
             $writer->write();
             break;
         }
     }
     $this->view->assetstores = $assetstores;
     $this->view->assetstoreForm = $this->Form->Assetstore->createAssetstoreForm();
     // get modules
     $enabledModules = Zend_Registry::get('modulesEnable');
     $adapter = Zend_Registry::get('configDatabase')->database->adapter;
     foreach ($allModules as $key => $module) {
         if (file_exists(BASE_PATH . '/modules/' . $key . '/controllers/ConfigController.php')) {
             $allModules[$key]->configPage = 'config';
         } elseif (file_exists(BASE_PATH . '/privateModules/' . $key . '/controllers/ConfigController.php')) {
             $allModules[$key]->configPage = 'config';
         } elseif (file_exists(BASE_PATH . '/modules/' . $key . '/controllers/AdminController.php')) {
             $allModules[$key]->configPage = 'admin';
         } elseif (file_exists(BASE_PATH . '/privateModules/' . $key . '/controllers/AdminController.php')) {
             $allModules[$key]->configPage = 'admin';
         } else {
             $allModules[$key]->configPage = false;
         }
         if (isset($module->db->{$adapter})) {
             $allModules[$key]->dbOk = true;
         } else {
             $allModules[$key]->dbOk = false;
         }
         $allModules[$key]->dependenciesArray = array();
         $allModules[$key]->dependenciesExist = true;
         // check if dependencies exit
         if (isset($allModules[$key]->dependencies) && !empty($allModules[$key]->dependencies)) {
             $allModules[$key]->dependenciesArray = explode(',', trim($allModules[$key]->dependencies));
             foreach ($allModules[$key]->dependenciesArray as $dependency) {
                 if (!isset($allModules[$dependency])) {
                     $allModules[$key]->dependenciesExist = false;
                 }
             }
         }
     }
     $modulesList = array();
     $countModules = array();
     foreach ($allModules as $k => $module) {
         if (!isset($module->category) || empty($module->category)) {
             $category = 'Misc';
         } else {
             $category = ucfirst($module->category);
         }
         if (!isset($modulesList[$category])) {
             $modulesList[$category] = array();
             $countModules[$category] = array('visible' => 0, 'hidden' => 0);
         }
         $modulesList[$category][$k] = $module;
         if ($module->dbOk && $module->dependenciesExist) {
             ++$countModules[$category]['visible'];
         } else {
             ++$countModules[$category]['hidden'];
         }
     }
     foreach ($modulesList as $k => $l) {
         ksort($modulesList[$k]);
     }
     ksort($modulesList);
     $this->view->countModules = $countModules;
     $this->view->modulesList = $modulesList;
     $this->view->modulesEnable = $enabledModules;
     $this->view->databaseType = Zend_Registry::get('configDatabase')->database->adapter;
 }
예제 #13
0
 /** 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);
 }
예제 #14
0
 /**
  */
 public function step3Action()
 {
     $this->requireAdminPrivileges();
     if (!file_exists(LOCAL_CONFIGS_PATH . '/database.local.ini')) {
         $this->redirect('/install/index');
     }
     $this->view->header = 'Step 3: Midas Server Configuration';
     $userDao = $this->userSession->Dao;
     if (!isset($userDao) || !$userDao->isAdmin()) {
         unlink(LOCAL_CONFIGS_PATH . '/database.local.ini');
         $this->redirect('/install/index');
     }
     $options = array('allowModifications' => true);
     $config = new Zend_Config_Ini(APPLICATION_CONFIG, null, $options);
     $form = $this->Form->Install->createConfigForm();
     $formArray = $this->getFormAsArray($form);
     $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);
     $this->view->form = $formArray;
     $this->view->databaseType = Zend_Registry::get('configDatabase')->database->adapter;
     $assetstores = $this->Assetstore->getAll();
     if ($this->_request->isPost() && $form->isValid($this->getRequest()->getPost())) {
         $allModules = $this->Component->Utility->getAllModules();
         foreach ($allModules as $key => $module) {
             $configLocal = LOCAL_CONFIGS_PATH . '/' . $key . '.local.ini';
             if (file_exists($configLocal)) {
                 unlink($configLocal);
             }
         }
         $config->global->application->description = $form->getValue('description');
         $config->global->application->lang = $form->getValue('lang');
         $config->global->application->name = $form->getValue('name');
         $config->global->default->timezone = $form->getValue('timezone');
         $config->global->environment = 'production';
         $writer = new Zend_Config_Writer_Ini();
         $writer->setConfig($config);
         $writer->setFilename(APPLICATION_CONFIG);
         $writer->write();
         $this->Setting->setConfig('default_assetstore', $assetstores[0]->getKey());
         $this->redirect('/admin#tabs-modules');
     }
 }
예제 #15
0
 /**
  * Upgrade.
  *
  * @param null|int|string $currentVersion
  * @param bool $testing
  * @return bool
  * @throws Zend_Exception
  */
 public function upgrade($currentVersion = null, $testing = false)
 {
     if ($currentVersion == null) {
         $currentVersion = Zend_Registry::get('configDatabase')->version;
     }
     if ($currentVersion == null) {
         throw new Zend_Exception('Version undefined');
     }
     if (!is_numeric($currentVersion)) {
         $currentVersion = $this->transformVersionToNumeric($currentVersion);
     }
     $version = $this->getNewestVersion($text = false);
     if ($currentVersion >= $version || $version == 0) {
         return false;
     }
     $migrations = $this->getMigrationFiles();
     foreach ($migrations as $migration) {
         if ($migration['version'] > $currentVersion) {
             $this->_processFile($migration);
         }
     }
     if ($this->module == 'core') {
         if (isset($migration)) {
             $path = LOCAL_CONFIGS_PATH . '/database.local.ini';
             if ($testing || Zend_Registry::get('configGlobal')->environment == 'testing') {
                 $path = getenv('MIDAS_DATABASE_INI');
                 if (!file_exists($path)) {
                     if (file_exists(BASE_PATH . '/tests/configs/lock.mysql.ini')) {
                         $path = BASE_PATH . '/tests/configs/lock.mysql.ini';
                     }
                     if (file_exists(BASE_PATH . '/tests/configs/lock.pgsql.ini')) {
                         $path = BASE_PATH . '/tests/configs/lock.pgsql.ini';
                     }
                     if (file_exists(BASE_PATH . '/tests/configs/lock.sqlite.ini')) {
                         $path = BASE_PATH . '/tests/configs/lock.sqlite.ini';
                     }
                 }
             }
             $options = array('allowModifications' => true);
             if ($testing || Zend_Registry::get('configGlobal')->environment == 'testing') {
                 $path = getenv('MIDAS_DATABASE_INI');
                 if (!file_exists($path)) {
                     if (file_exists(BASE_PATH . '/tests/configs/lock.mysql.ini')) {
                         $path = BASE_PATH . '/tests/configs/lock.mysql.ini';
                     }
                     if (file_exists(BASE_PATH . '/tests/configs/lock.pgsql.ini')) {
                         $path = BASE_PATH . '/tests/configs/lock.pgsql.ini';
                     }
                     if (file_exists(BASE_PATH . '/tests/configs/lock.sqlite.ini')) {
                         $path = BASE_PATH . '/tests/configs/lock.sqlite.ini';
                     }
                 }
                 $config = new Zend_Config_Ini($path, null, $options);
                 $config->testing->version = $migration['versionText'];
             } else {
                 $config = new Zend_Config_Ini($path, null, $options);
                 $config->development->version = $migration['versionText'];
                 $config->production->version = $migration['versionText'];
             }
             $writer = new Zend_Config_Writer_Ini();
             $writer->setConfig($config);
             $writer->setFilename($path);
             $writer->write();
         }
     } else {
         $path = LOCAL_CONFIGS_PATH . '/' . $this->module . '.local.ini';
         if (file_exists($path)) {
             $options = array('allowModifications' => true);
             $config = new Zend_Config_Ini($path, null, $options);
             $config->global->version = $migration['versionText'];
             $writer = new Zend_Config_Writer_Ini();
             $writer->setConfig($config);
             $writer->setFilename($path);
             $writer->write();
         }
     }
     return true;
 }
예제 #16
0
 /** 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');
         $hostName = isset($config->ldap->hostname) ? $config->ldap->hostname : LDAP_HOST_NAME_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_HOST_NAME_KEY, $hostName, $this->moduleName);
         $port = isset($config->ldap->port) ? $config->ldap->port : LDAP_PORT_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_PORT_KEY, $port, $this->moduleName);
         $backupServer = isset($config->ldap->backup) ? $config->ldap->backup : LDAP_BACKUP_SERVER_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_BACKUP_SERVER_KEY, $backupServer, $this->moduleName);
         $bindRdn = isset($config->ldap->bindn) ? $config->ldap->bindn : LDAP_BIND_RDN_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_BIND_RDN_KEY, $bindRdn, $this->moduleName);
         $bindPassword = isset($config->ldap->bindpw) ? $config->ldap->bindpw : LDAP_BIND_PASSWORD_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_BIND_PASSWORD_KEY, $bindPassword, $this->moduleName);
         $baseDn = isset($config->ldap->basedn) ? $config->ldap->basedn : LDAP_BASE_DN_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_BASE_DN_KEY, $baseDn, $this->moduleName);
         $protocolVersion = isset($config->ldap->protocolVersion) ? $config->ldap->protocolVersion : LDAP_PROTOCOL_VERSION_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_PROTOCOL_VERSION_KEY, $protocolVersion, $this->moduleName);
         $searchTerm = isset($config->ldap->search) ? $config->ldap->search : LDAP_SEARCH_TERM_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_SEARCH_TERM_KEY, $searchTerm, $this->moduleName);
         $proxyBaseDn = isset($config->ldap->proxyBasedn) ? $config->ldap->proxyBasedn : LDAP_PROXY_BASE_DN_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_PROXY_BASE_DN_KEY, $proxyBaseDn, $this->moduleName);
         $proxyPassword = isset($config->ldap->proxyPassword) ? $config->ldap->proxyPassword : LDAP_PROXY_PASSWORD_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_PROXY_PASSWORD_KEY, $proxyPassword, $this->moduleName);
         $useActiveDirectory = isset($config->ldap->useActiveDirectory) ? $config->ldap->useActiveDirectory : LDAP_USE_ACTIVE_DIRECTORY_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_USE_ACTIVE_DIRECTORY_KEY, $useActiveDirectory, $this->moduleName);
         $autoAddUnknownUser = isset($config->ldap->autoAddUnknownUser) ? $config->ldap->autoAddUnknownUser : LDAP_AUTO_ADD_UNKNOWN_USER_DEFAULT_VALUE;
         $settingModel->setConfig(LDAP_AUTO_ADD_UNKNOWN_USER_KEY, $autoAddUnknownUser, $this->moduleName);
         $config = new Zend_Config_Ini($configPath, null, true);
         unset($config->global->ldap->hostname);
         unset($config->global->ldap->port);
         unset($config->global->ldap->backup);
         unset($config->global->ldap->bindn);
         unset($config->global->ldap->bindpw);
         unset($config->global->ldap->basedn);
         unset($config->global->ldap->protocolVersion);
         unset($config->global->ldap->search);
         unset($config->global->ldap->proxyBasedn);
         unset($config->global->ldap->proxyPassword);
         unset($config->global->ldap->useActiveDirectory);
         unset($config->global->ldap->autoAddUnknownUser);
         $writer = new Zend_Config_Writer_Ini();
         $writer->setConfig($config);
         $writer->setFilename($configPath);
         $writer->write();
     } else {
         $settingModel->setConfig(LDAP_HOST_NAME_KEY, LDAP_HOST_NAME_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_PORT_KEY, LDAP_PORT_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_BACKUP_SERVER_KEY, LDAP_BACKUP_SERVER_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_BIND_RDN_KEY, LDAP_BIND_RDN_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_BIND_PASSWORD_KEY, LDAP_BIND_PASSWORD_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_BASE_DN_KEY, LDAP_BASE_DN_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_PROTOCOL_VERSION_KEY, LDAP_PROTOCOL_VERSION_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_SEARCH_TERM_KEY, LDAP_SEARCH_TERM_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_PROXY_BASE_DN_KEY, LDAP_PROXY_BASE_DN_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_PROXY_PASSWORD_KEY, LDAP_PROXY_PASSWORD_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_USE_ACTIVE_DIRECTORY_KEY, LDAP_USE_ACTIVE_DIRECTORY_DEFAULT_VALUE, $this->moduleName);
         $settingModel->setConfig(LDAP_AUTO_ADD_UNKNOWN_USER_KEY, LDAP_AUTO_ADD_UNKNOWN_USER_DEFAULT_VALUE, $this->moduleName);
     }
 }
예제 #17
0
/**
 * Install and upgrade core.
 *
 * @param Zend_Db_Adapter_Abstract $db
 * @param string $dbType
 * @param UtilityComponent $utilityComponent
 * @throws Zend_Exception
 */
function installCore($db, $dbType, $utilityComponent)
{
    require_once BASE_PATH . '/core/controllers/components/UpgradeComponent.php';
    $upgradeComponent = new UpgradeComponent();
    $upgradeComponent->dir = BASE_PATH . '/core/database/' . $dbType;
    $upgradeComponent->init = true;
    $newestVersion = $upgradeComponent->getNewestVersion(true);
    $sqlFile = BASE_PATH . '/core/database/' . $dbType . '/' . $newestVersion . '.sql';
    if (!isset($sqlFile) || !file_exists($sqlFile)) {
        throw new Zend_Exception('Unable to find SQL file: ' . $sqlFile);
    }
    switch ($dbType) {
        case 'mysql':
            $utilityComponent->run_sql_from_file($db, $sqlFile);
            $upgradeDbType = 'PDO_MYSQL';
            break;
        case 'pgsql':
            $utilityComponent->run_sql_from_file($db, $sqlFile);
            $upgradeDbType = 'PDO_PGSQL';
            break;
        case 'sqlite':
            $utilityComponent->run_sql_from_file($db, $sqlFile);
            $upgradeDbType = 'PDO_SQLITE';
            break;
        default:
            throw new Zend_Exception('Unknown database type: ' . $dbType);
            break;
    }
    $options = array('allowModifications' => true);
    $databaseConfig = new Zend_Config_Ini(BASE_PATH . '/tests/configs/lock.' . $dbType . '.ini', null, $options);
    $databaseConfig->testing->version = $newestVersion;
    $writer = new Zend_Config_Writer_Ini();
    $writer->setConfig($databaseConfig);
    $writer->setFilename(BASE_PATH . '/tests/configs/lock.' . $dbType . '.ini');
    $writer->write();
    $upgradeComponent->initUpgrade('core', $db, $upgradeDbType);
    $upgradeComponent->upgrade(str_replace('.sql', '', basename($sqlFile)), true);
}