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


PHP JApplicationCli::loadConfiguration方法代码示例

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


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

示例1: loadConfiguration

 /**
  * Load an object or array into the application configuration object.
  *
  * @param   mixed  $data  Either an array or object to be loaded into the configuration object.
  *
  * @return  JCli  Instance of $this to allow chaining.
  *
  * @since   11.1
  */
 public function loadConfiguration($data)
 {
     // Execute the parent load method.
     parent::loadConfiguration($data);
     /*
      * Setup some application metadata options.  This is useful if we ever want to write out startup scripts
      * or just have some sort of information available to share about things.
      */
     // The application author name.  This string is used in generating startup scripts and has
     // a maximum of 50 characters.
     $tmp = (string) $this->config->get('author_name', 'Joomla Platform');
     $this->config->set('author_name', strlen($tmp) > 50 ? substr($tmp, 0, 50) : $tmp);
     // The application author email.  This string is used in generating startup scripts.
     $tmp = (string) $this->config->get('author_email', 'admin@joomla.org');
     $this->config->set('author_email', filter_var($tmp, FILTER_VALIDATE_EMAIL));
     // The application name.  This string is used in generating startup scripts.
     $tmp = (string) $this->config->get('application_name', 'JApplicationDaemon');
     $this->config->set('application_name', (string) preg_replace('/[^A-Z0-9_-]/i', '', $tmp));
     // The application description.  This string is used in generating startup scripts.
     $tmp = (string) $this->config->get('application_description', 'A generic Joomla Platform application.');
     $this->config->set('application_description', filter_var($tmp, FILTER_SANITIZE_STRING));
     /*
      * Setup the application path options.  This defines the default executable name, executable directory,
      * and also the path to the daemon process id file.
      */
     // The application executable daemon.  This string is used in generating startup scripts.
     $tmp = (string) $this->config->get('application_executable', basename($this->input->executable));
     $this->config->set('application_executable', $tmp);
     // The home directory of the daemon.
     $tmp = (string) $this->config->get('application_directory', dirname($this->input->executable));
     $this->config->set('application_directory', $tmp);
     // The pid file location.  This defaults to a path inside the /tmp directory.
     $name = $this->config->get('application_name');
     $tmp = (string) $this->config->get('application_pid_file', strtolower('/tmp/' . $name . '/' . $name . '.pid'));
     $this->config->set('application_pid_file', $tmp);
     /*
      * Setup the application identity options.  It is important to remember if the default of 0 is set for
      * either UID or GID then changing that setting will not be attempted as there is no real way to "change"
      * the identity of a process from some user to root.
      */
     // The user id under which to run the daemon.
     $tmp = (int) $this->config->get('application_uid', 0);
     $options = array('options' => array('min_range' => 0, 'max_range' => 65000));
     $this->config->set('application_uid', filter_var($tmp, FILTER_VALIDATE_INT, $options));
     // The group id under which to run the daemon.
     $tmp = (int) $this->config->get('application_gid', 0);
     $options = array('options' => array('min_range' => 0, 'max_range' => 65000));
     $this->config->set('application_gid', filter_var($tmp, FILTER_VALIDATE_INT, $options));
     // Option to kill the daemon if it cannot switch to the chosen identity.
     $tmp = (bool) $this->config->get('application_require_identity', 1);
     $this->config->set('application_require_identity', $tmp);
     /*
      * Setup the application runtime options.  By default our execution time limit is infinite obviously
      * because a daemon should be constantly running unless told otherwise.  The default limit for memory
      * usage is 128M, which admittedly is a little high, but remember it is a "limit" and PHP's memory
      * management leaves a bit to be desired :-)
      */
     // The maximum execution time of the application in seconds.  Zero is infinite.
     $tmp = $this->config->get('max_execution_time');
     if ($tmp !== null) {
         $this->config->set('max_execution_time', (int) $tmp);
     }
     // The maximum amount of memory the application can use.
     $tmp = $this->config->get('max_memory_limit', '256M');
     if ($tmp !== null) {
         $this->config->set('max_memory_limit', (string) $tmp);
     }
     return $this;
 }
开发者ID:raquelsa,项目名称:Joomla,代码行数:78,代码来源:daemon.php


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