english/libraries/joomla/application/cli/daemon.php
/**
	 * 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  void
	 *
	 * @since   11.1
	 */
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  void


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 void
public function loadConfiguration($data)
	{
		parent::loadConfiguration($data);
		$tmp = (string) $this->config->get('author_name', 'Joomla Platform');
		$this->config->set('author_name', (strlen($tmp) > 50) ? substr($tmp, 0, 50) : $tmp);
		$tmp = (string) $this->config->get('author_email', 'admin@joomla.org');
		$this->config->set('author_email', filter_var($tmp, FILTER_VALIDATE_EMAIL));
		$tmp = (string) $this->config->get('application_name', 'JDaemon');
		$this->config->set('application_name', (string) preg_replace('/[^A-Z0-9_-]/i', '', $tmp));
		$tmp = (string) $this->config->get('application_description', 'A generic Joomla Platform application.');
		$this->config->set('application_description', filter_var($tmp, FILTER_SANITIZE_STRING));
		$tmp = (string) $this->config->get('application_executable', basename($this->input->executable));
		$this->config->set('application_executable', $tmp);
		$tmp = (string) $this->config->get('application_directory', dirname($this->input->executable));
		$this->config->set('application_directory', $tmp);
		$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);
		$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));
		$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));
		$tmp = (bool) $this->config->get('application_require_identity', 1);
		$this->config->set('application_require_identity', $tmp);
		$tmp = $this->config->get('max_execution_time');
		if ($tmp !== null) {
			$this->config->set('max_execution_time', (int) $tmp);
		}
		$tmp = $this->config->get('max_memory_limit', '256M');
		if ($tmp !== null) {
			$this->config->set('max_memory_limit', (string) $tmp);
		}
	}
public function loadConfiguration ( $ data ) { parent :: loadConfiguration ( $ data ) ; $ tmp = ( string ) $ this -> config -> get ( 'author_name' , 'Joomla Platform' ) ; $ this -> config -> set ( 'author_name' , ( strlen ( $ tmp ) > 50 ) ? substr ( $ tmp , 0 , 50 ) : $ tmp ) ; $ tmp = ( string ) $ this -> config -> get ( 'author_email' , 'admin@joomla.org' ) ; $ this -> config -> set ( 'author_email' , filter_var ( $ tmp , FILTER_VALIDATE_EMAIL ) ) ; $ tmp = ( string ) $ this -> config -> get ( 'application_name' , 'JDaemon' ) ; $ this -> config -> set ( 'application_name' , ( string ) preg_replace ( '/[^A-Z0-9_-]/i' , '' , $ tmp ) ) ; $ tmp = ( string ) $ this -> config -> get ( 'application_description' , 'A generic Joomla Platform application.' ) ; $ this -> config -> set ( 'application_description' , filter_var ( $ tmp , FILTER_SANITIZE_STRING ) ) ; $ tmp = ( string ) $ this -> config -> get ( 'application_executable' , basename ( $ this -> input -> executable ) ) ; $ this -> config -> set ( 'application_executable' , $ tmp ) ; $ tmp = ( string ) $ this -> config -> get ( 'application_directory' , dirname ( $ this -> input -> executable ) ) ; $ this -> config -> set ( 'application_directory' , $ tmp ) ; $ 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 ) ; $ 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 ) ) ; $ 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 ) ) ; $ tmp = ( bool ) $ this -> config -> get ( 'application_require_identity' , 1 ) ; $ this -> config -> set ( 'application_require_identity' , $ tmp ) ; $ tmp = $ this -> config -> get ( 'max_execution_time' ) ; if ( $ tmp !== null ) { $ this -> config -> set ( 'max_execution_time' , ( int ) $ tmp ) ; } $ tmp = $ this -> config -> get ( 'max_memory_limit' , '256M' ) ; if ( $ tmp !== null ) { $ this -> config -> set ( 'max_memory_limit' , ( string ) $ tmp ) ; } }
Load an object or array into the application configuration object.
Load an object or array into the application configuration object .
// Execute the parent load method. /*
		 * 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. // The application author email.  This string is used in generating startup scripts. // The application name.  This string is used in generating startup scripts. // The application description.  This string is used in generating startup scripts. /*
		 * 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. // The home directory of the daemon. // The pid file location.  This defaults to a path inside the /tmp directory. /*
		 * 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. // The group id under which to run the daemon. // Option to kill the daemon if it cannot switch to the chosen identity. /*
		 * 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. // The maximum amount of memory the application can use.