当前位置: 首页>>代码示例>>PHP>>正文


PHP Kohana::config_clear方法代码示例

本文整理汇总了PHP中Kohana::config_clear方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::config_clear方法的具体用法?PHP Kohana::config_clear怎么用?PHP Kohana::config_clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kohana的用法示例。


在下文中一共展示了Kohana::config_clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save()
 {
     // This array maps the telephony returns to the telephony file
     $telephonyOptions = array('cfg_root' => rtrim($this->session->get('installer.ast_root'), '/'), 'AmiHost' => $this->session->get('installer.ami_host'), 'AmiPort' => $this->session->get('installer.ami_port'), 'AmiUser' => $this->session->get('installer.ami_user'), 'AmiPass' => $this->session->get('installer.ami_pass'));
     if (!is_dir($telephonyOptions['cfg_root'])) {
         message::set('Unable to access directory <pre>' . $telephonyOptions['cfg_root'] . '</pre>');
         return false;
     }
     // Write $telephonyOptions to asterisk.php
     if (!Installer_Controller::updateConfig($telephonyOptions, 'asterisk')) {
         return false;
     }
     // Set the driver name in telephony.php
     if (!Installer_Controller::updateConfig(array('driver' => 'Asterisk'), 'telephony')) {
         return false;
     }
     // Reload the new asterisk options
     Kohana::config_clear('asterisk');
     Kohana::config_load('asterisk');
     $this->session->set('installer.default_packages', kohana::config('asterisk.default_packages'));
     return true;
 }
开发者ID:swk,项目名称:bluebox,代码行数:22,代码来源:asterisk.php

示例2: save

 public function save()
 {
     if (!class_exists('DOMDocument')) {
         message::set('This driver requires ' . html::anchor('http://us3.php.net/manual/en/class.domdocument.php', 'DOMDocument', array('target' => '_new')) . ' to be installed and active');
         return false;
     }
     // This array maps the telephony returns to the telephony file
     $telephonyOptions = array('cfg_root' => rtrim($this->session->get('installer.cfg_root'), '/'), 'audio_root' => rtrim($this->session->get('installer.audio_root'), '/'), 'ESLHost' => $this->session->get('installer.esl_host'), 'ESLPort' => $this->session->get('installer.esl_port'), 'ESLAuth' => $this->session->get('installer.esl_auth'));
     if (!is_dir($telephonyOptions['cfg_root'])) {
         message::set('Unable to access directory <pre>' . $telephonyOptions['cfg_root'] . '</pre>');
         return false;
     }
     if (!is_dir($telephonyOptions['audio_root'])) {
         message::set('Unable to access directory <pre>' . $telephonyOptions['audio_root'] . '</pre>');
         return false;
     }
     // Write $telephonyOptions to freeswitch.php
     if (!Installer_Controller::updateConfig($telephonyOptions, 'freeswitch')) {
         return false;
     }
     // Set the driver name in telephony.php
     if (!Installer_Controller::updateConfig(array('driver' => 'FreeSwitch'), 'telephony')) {
         return false;
     }
     // Reload the new telephony options so we can use the filemap
     Kohana::config_clear('freeswitch');
     Kohana::config_load('freeswitch');
     $filemaps = Kohana::config('freeswitch.filemap');
     $notWritable = array();
     foreach ($filemaps as $filemap) {
         if (!filesystem::is_writable($filemap['filename'])) {
             $notWritable[] = $filemap['filename'];
         }
     }
     if (!empty($notWritable)) {
         $notWritable = array_unique($notWritable);
         if (empty($this->template->error)) {
             message::set('Ensure the web server has write permission on these files, and SELINUX allows this action.' . '<div class="write_help">Unable to write to the following file(s):</div>' . '<div>' . arr::arrayToUL($notWritable, array(), array('class' => 'error_details', 'style' => 'text-align:left;')) . '</div>');
         }
         return false;
     }
     // Make sure that if the user changed the directory and any conflicts were found that the user
     // knows these will be deleted
     $existingProfiles = glob(rtrim($telephonyOptions['cfg_root'], '/') . '/sip_profiles/*.xml', GLOB_MARK);
     $oldXmlFiles = array();
     foreach ($filemaps as $filemap) {
         if (file_exists($filemap['filename'])) {
             $oldXmlFiles[] = $filemap['filename'];
         }
     }
     $conflictXmlFiles = $this->session->get('installer.conflictXmlFiles');
     foreach (array_unique(array_merge($existingProfiles, $oldXmlFiles)) as $existingFile) {
         if (!in_array($existingFile, $conflictXmlFiles)) {
             message::set('Conflicting configuration files will be permanently erased if you continue!');
             message::set('Click continue again to proceed...', 'alert');
             // This session var lets the user continue the second time around (after the warning)
             $this->session->set('installer.confirm_delete', true);
             return false;
         }
     }
     // If there are conflictXmlFile in the session then the user has seen this list
     // so they SHOULD be aware we are about to delete them... should
     $conflictXmlFiles = $this->session->get('installer.conflictXmlFiles');
     if (!empty($conflictXmlFiles) && is_array($conflictXmlFiles)) {
         $confirmDelete = $this->session->get('installer.confirm_delete', false);
         if (empty($confirmDelete)) {
             message::set('Conflicting configuration files will be permanently erased if you continue!');
             message::set('Click continue again to proceed...', 'alert');
             // This session var lets the user continue the second time around (after the warning)
             $this->session->set('installer.confirm_delete', true);
             return false;
         }
         foreach ($conflictXmlFiles as $conflictXmlFile) {
             if (!filesystem::delete($conflictXmlFile)) {
                 Kohana::log('error', 'Unable to unlink ' . $conflictXmlFile);
                 $unlinkErrors[] = $conflictXmlFile;
             }
         }
     }
     // If there are files that could not be deleted, inform the user
     if (!empty($unlinkErrors)) {
         message::set('Manually remove these files or change the file permissions.' . '<div class="write_help">Unable to delete incompatible file(s):</div>' . '<div>' . arr::arrayToUL($unlinkErrors, array(), array('class' => 'error_details', 'style' => 'text-align:left;')) . '</div>');
         return false;
     }
     $this->session->set('installer.default_packages', kohana::config('freeswitch.default_packages'));
     return true;
 }
开发者ID:swk,项目名称:bluebox,代码行数:87,代码来源:freeswitch.php

示例3: run

 public function run()
 {
     ini_set("max_execution_time", "0");
     ini_set("max_input_time", "0");
     set_time_limit(0);
     pcntl_signal(SIGCHLD, array($this, 'sig_handler'));
     pcntl_signal(SIGTERM, array($this, 'sig_handler'));
     pcntl_signal(SIGHUP, array($this, 'sig_handler'));
     declare (ticks=1);
     $pid = pcntl_fork();
     // fork
     if ($pid == -1) {
         Kohana::log('error', 'Could not fork.');
         exit;
     } else {
         if ($pid) {
             Kohana::log('debug', 'Forked Once');
             exit;
         } else {
             // Write the log to ensure no memory issues
             Kohana::log_save();
             $pid = pcntl_fork();
             if ($pid == -1) {
                 Kohana::log('error', 'Could not fork.');
                 exit;
             } elseif ($pid) {
                 // We don't do anything
                 Kohana::log('error', 'Parent.');
             } else {
                 Kohana::log('debug', 'Starting the scanning');
                 $task_model = new Task_Model();
                 while (!$this->sigterm) {
                     // Only scan based on our config item
                     usleep(Kohana::config('queue.scan_delay'));
                     $this->connect();
                     if ($this->sighup) {
                         // We need to reload the config
                         Kohana::config_clear('queue');
                         Kohana::config_clear('database');
                         Kohana::config_clear('log');
                         Kohana::config_clear('routes');
                         Kohana::config_clear('core');
                         $this->sighup = FALSE;
                     }
                     $sql = 'SELECT * FROM `' . Kohana::config('queue.table_name') . '` ORDER BY `priority` DESC LIMIT 1';
                     $result = mysql_query($sql, $this->connection);
                     $num_rows = is_resource($result) ? mysql_num_rows($result) : 0;
                     // Scan the queue
                     if (count($this->pids) < Kohana::config('queue.parallel_operations') and $num_rows > 0) {
                         // Write the log to ensure no memory issues
                         Kohana::log_save();
                         $pid = pcntl_fork();
                         if ($pid == -1) {
                             Kohana::log('error', 'Could not spawn child task process.');
                             exit;
                         } elseif ($pid) {
                             // Add the child's PID to the running list
                             $this->pids[$pid] = time();
                         } else {
                             $queue = new Task_Model();
                             $queue->scan()->execute();
                             exit;
                         }
                         mysql_free_result($result);
                     } else {
                         // var_dump( $this->pids );
                         // var_dump( Kohana::config('queue.parallel_operations') );
                         // var_dump( $num_rows );
                         // var_dump( $result );
                         // var_dump( $sql );
                         // var_dump( $this->connection );
                         // var_dump( "mysql_connect(".Kohana::config('database.default.connection.host').", ".Kohana::config('database.default.connection.user').", ".Kohana::config('database.default.connection.pass').", TRUE);" );
                         // exit;
                     }
                     mysql_close($this->connection);
                 }
                 // Run cleanup stuffs
                 $this->cleanup();
             }
         }
     }
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:82,代码来源:application_queue.php

示例4: reset

 /**
  * Frees the current instance of the identity provider so the next call to instance will reload
  *
  * @param   string  configuration
  * @return  Identity_Core
  */
 static function reset()
 {
     self::$instance = null;
     Kohana::config_clear("identity");
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:11,代码来源:IdentityProvider.php


注:本文中的Kohana::config_clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。