예제 #1
0
	/**
	 * Public constructor
	 */
	public function __construct()
	{
		// Call AEAbstractObject's contructor
		parent::__construct();

		// Set the filter name if it's missing (filename in lowercase, minus the .php extension)
		if(empty($this->filter_name)) $this->filter_name = strtolower(basename(__FILE__,'.php'));
	}
예제 #2
0
	/**
	 * Public constructor, creates the timer object and calculates the execution time limits
	 * @return AECoreTimer
	 */
	public function __construct()
	{
		parent::__construct();

		// Initialize start time
		$this->start_time = $this->microtime_float();

		// Get configured max time per step and bias
		$configuration =& AEFactory::getConfiguration();
		$config_max_exec_time	= $configuration->get('akeeba.tuning.max_exec_time', 14);
		$bias					= $configuration->get('akeeba.tuning.run_time_bias', 75)/100;

		// Get PHP's maximum execution time (our upper limit)
		/**
		if(@function_exists('ini_get'))
		{
			$php_max_exec_time = @ini_get("maximum_execution_time");
			if ( (!is_numeric($php_max_exec_time)) || ($php_max_exec_time == 0) ) {
				// If we have no time limit, set a hard limit of about 10 seconds
				// (safe for Apache and IIS timeouts, verbose enough for users)
				$php_max_exec_time = 14;
			}
		}
		else
		{
			// If ini_get is not available, use a rough default
			$php_max_exec_time = 14;
		}
		
		// Apply an arbitrary correction to counter CMS load time
		$php_max_exec_time--;

		// Apply bias
		$php_max_exec_time = $php_max_exec_time * $bias;
		$config_max_exec_time = $config_max_exec_time * $bias;

		// Use the most appropriate time limit value
		if( $config_max_exec_time > $php_max_exec_time )
		{
			$this->max_exec_time = $php_max_exec_time;
		}
		else
		{
			$this->max_exec_time = $config_max_exec_time;
		}		
		/**/
		
		$this->max_exec_time = $config_max_exec_time * $bias;
	}
 /**
  * Public constructor
  * @return AECoreDomainInstaller
  */
 public function __construct()
 {
     parent::__construct();
     // Fetch the installer settings
     $this->installerSettings = (object) array('installerroot' => 'installation', 'sqlroot' => 'installation/sql', 'databasesini' => 1, 'readme' => 1, 'extrainfo' => 1, 'password' => 0);
     $config = AEFactory::getConfiguration();
     $installerKey = $config->get('akeeba.advanced.embedded_installer');
     $installerDescriptors = AEUtilInihelper::getInstallerList();
     if (array_key_exists($installerKey, $installerDescriptors)) {
         // The selected installer exists, use it
         $this->installerSettings = (object) $installerDescriptors[$installerKey];
     } elseif (array_key_exists('abi', $installerDescriptors)) {
         // The selected installer doesn't exist, but ABI exists; use that instead
         $this->installerSettings = (object) $installerDescriptors['abi'];
     }
     // If no installer was found, we are using "safe defaults", which are
     // pretty much what ABI is using, and hope for the best!
 }
예제 #4
0
파일: filters.php 프로젝트: bizanto/Hooked
 /**
  * Public constructor, loads filter data and filter classes
  */
 public final function __construct()
 {
     static $initializing = false;
     parent::__construct();
     // Call parent's constructor
     // Load filter data from platform's database
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Fetching filter data from database');
     $this->filter_registry =& AEPlatform::getInstance()->load_filters();
     // Load platform, plugin and core filters
     $this->filters = array();
     $locations = array(AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'platform' . DIRECTORY_SEPARATOR . AKEEBAPLATFORM . DIRECTORY_SEPARATOR . 'filters', AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'filters', AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'filters');
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Loading filters');
     foreach ($locations as $folder) {
         $is_platform = $folder == AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'platform' . DIRECTORY_SEPARATOR . AKEEBAPLATFORM . DIRECTORY_SEPARATOR . 'filters';
         $files = AEUtilScanner::getFiles($folder);
         if ($files === false) {
             continue;
         }
         // Skip inexistent folders
         if (empty($files)) {
             continue;
         }
         // Skip no-match folders
         // Loop all files
         foreach ($files as $file) {
             if (substr($file, -4) != '.php') {
                 continue;
             }
             // Skip non-PHP files
             if (in_array(substr($file, 0, 1), array('.', '_'))) {
                 continue;
             }
             // Skip filter files starting with dot or dash
             $filter_name = ($is_platform ? 'Platform' : '') . ucfirst(basename($file, '.php'));
             // Extract filter base name
             if (array_key_exists($filter_name, $this->filters)) {
                 continue;
             }
             // Skip already loaded filters
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '-- Loading filter ' . $filter_name);
             $this->filters[$filter_name] =& AEFactory::getFilterObject($filter_name);
             // Add the filter
         }
     }
     // Load platform, plugin and core stacked filters
     $locations = array(AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'platform' . DIRECTORY_SEPARATOR . AKEEBAPLATFORM . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR . 'stack', AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR . 'stack', AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR . 'stack');
     $config =& AEFactory::getConfiguration();
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Loading optional filters');
     foreach ($locations as $folder) {
         $is_platform = $folder == AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'platform' . DIRECTORY_SEPARATOR . AKEEBAPLATFORM . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR . 'stack';
         $files = AEUtilScanner::getFiles($folder);
         if ($files === false) {
             continue;
         }
         // Skip inexistent folders
         if (empty($files)) {
             continue;
         }
         // Skip no-match folders
         // Loop all files
         foreach ($files as $file) {
             if (substr($file, -4) != '.php') {
                 continue;
             }
             // Skip non-PHP files
             $bare_name = strtolower(basename($file, '.php'));
             $filter_name = 'Stack' . ($is_platform ? 'Platform' : '') . ucfirst(basename($file, '.php'));
             // Extract filter base name
             if (array_key_exists($filter_name, $this->filters)) {
                 continue;
             }
             // Skip already loaded filters
             if (!file_exists(substr($file, 0, -4) . '.ini')) {
                 continue;
             }
             // Make sure the INI file also exists
             $key = "core.filters.{$bare_name}.enabled";
             if ($config->get($key, 0)) {
                 AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '-- Loading optional filter ' . $filter_name);
                 $this->filters[$filter_name] =& AEFactory::getFilterObject($filter_name);
                 // Add the filter
             }
         }
     }
 }
예제 #5
0
 /**
  * Public constructor, loads filter data and filter classes
  */
 public final function __construct()
 {
     static $initializing = false;
     parent::__construct();
     // Call parent's constructor
     // Load filter data from platform's database
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Fetching filter data from database');
     $this->filter_registry = AEPlatform::getInstance()->load_filters();
     // Load platform, plugin and core filters
     $this->filters = array();
     $locations = array(AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'filters', AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'filters');
     $platform_paths = AEPlatform::getInstance()->getPlatformDirectories();
     foreach ($platform_paths as $p) {
         $locations[] = $p . '/filters';
     }
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Loading filters');
     foreach ($locations as $folder) {
         $is_platform = $this->isPlatformDirectory($folder);
         $files = AEUtilScanner::getFiles($folder);
         if ($files === false) {
             continue;
         }
         // Skip inexistent folders
         if (empty($files)) {
             continue;
         }
         // Skip no-match folders
         // Loop all files
         foreach ($files as $file) {
             if (substr($file, -4) != '.php') {
                 continue;
                 // Skip non-PHP files
             }
             if (in_array(substr($file, 0, 1), array('.', '_'))) {
                 continue;
                 // Skip filter files starting with dot or dash
             }
             // Some hosts copy .ini and .php files, renaming them (ie foobar.1.php)
             // We need to exclude them, otherwise we'll get a fatal error for declaring the same class twice
             $bare_name = strtolower(basename($file, '.php'));
             if (preg_match('/[^a-z0-9]/', $bare_name)) {
                 continue;
             }
             $filter_name = ($is_platform ? 'Platform' : '') . ucfirst(basename($file, '.php'));
             // Extract filter base name
             if (array_key_exists($filter_name, $this->filters)) {
                 continue;
                 // Skip already loaded filters
             }
             AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '-- Loading filter ' . $filter_name);
             $this->filters[$filter_name] = AEFactory::getFilterObject($filter_name);
             // Add the filter
         }
     }
     // Load platform, plugin and core stacked filters
     $locations = array(AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR . 'stack', AEFactory::getAkeebaRoot() . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR . 'stack');
     $platform_paths = AEPlatform::getInstance()->getPlatformDirectories();
     $platform_stack_paths = array();
     foreach ($platform_paths as $p) {
         $locations[] = $p . '/filters';
         $locations[] = $p . '/filters/stack';
         $platform_stack_paths[] = $p . '/filters/stack';
     }
     $config = AEFactory::getConfiguration();
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Loading optional filters');
     foreach ($locations as $folder) {
         $is_platform = $this->isPlatformDirectory($folder);
         $files = AEUtilScanner::getFiles($folder);
         if ($files === false) {
             continue;
         }
         // Skip inexistent folders
         if (empty($files)) {
             continue;
         }
         // Skip no-match folders
         // Loop all files
         foreach ($files as $file) {
             if (substr($file, -4) != '.php') {
                 continue;
             }
             // Skip non-PHP files
             // Some hosts copy .ini and .php files, renaming them (ie foobar.1.php)
             // We need to exclude them, otherwise we'll get a fatal error for declaring the same class twice
             $bare_name = strtolower(basename($file, '.php'));
             if (preg_match('/[^a-z0-9]/', $bare_name)) {
                 continue;
             }
             $filter_name = 'Stack' . ($is_platform ? 'Platform' : '') . ucfirst(basename($file, '.php'));
             // Extract filter base name
             if (array_key_exists($filter_name, $this->filters)) {
                 continue;
             }
             // Skip already loaded filters
             if (!file_exists($folder . '/' . substr($file, 0, -4) . '.ini')) {
                 continue;
             }
             // Make sure the INI file also exists
             $key = "core.filters.{$bare_name}.enabled";
             if ($config->get($key, 0)) {
                 AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '-- Loading optional filter ' . $filter_name);
                 $this->filters[$filter_name] = AEFactory::getFilterObject($filter_name);
                 // Add the filter
             }
         }
     }
 }