Static Public Member Functions | |
| static | getConfiguration () |
| Returns the configuration. | |
| static | init (array $configurations) |
| Starts the initialization of the spunQ framework. | |
| static | requireExtension ($extension) |
| Will ensure that a given extension is installed or throw an exception. | |
| static | requireExtensions (array $extensions) |
| Will ensure that given extensions are installed or throw an exception. | |
| static | requireExternalApplication ($name, $testArgs=array()) |
| Checks if a required external application is installed. | |
| static | isInitialized () |
| Getter for $initialized. | |
| static | assureNotInitialized () |
| Throws an exception if isInitialized yields true. | |
| static | assureIsInitialized () |
| Throws an exception if isInitialized yields false. | |
| static | registerMultipleClassFiles ($mapping, $moduleName=NULL) |
| Registers multiple class files at once. | |
| static | filesManuallyRegistered ($moduleName) |
| Checks whether file declarations of the module have been done manually. | |
| static | getRegisteredModuleFiles ($moduleName, $throwException=true) |
| Retrieves class files registered for a module. | |
| static | registerClassFile ($className, $file) |
| Register a class file. | |
| static | includeClass ($className) |
| Makes sure a class is available by optionally including its file. | |
| static | requireAll (array $files, $className=NULL) |
| Includes all files provided using require_once. | |
| static | setMode ($mode) |
| Sets the current spunQ mode. | |
| static | getMode () |
| Gets the current spunQ mode. | |
| static | inMode ($mode) |
| Checks if spunQ is configured to be in given mode. | |
| static | getCache () |
| Gets a spunQ_SQLiteCache. | |
| static | getOs () |
| Gets the operating system this script is being run on. | |
| static | initBatchOperation ($time=300, $memory= '512M') |
| Adjusts environment for an upcoming batch operation. | |
| static | parseMemoryLimit ($value) |
Parses a valid value for the configuration memory_limit. | |
Public Attributes | |
| const | MODE_SPUNQ_DEVELOPMENT = 1 |
| The mode for developers working on the spunQ framework itself. | |
| const | MODE_DEVELOPMENT = 2 |
| The mode for developers using spunQ. | |
| const | MODE_DEPLOYMENT_CONSERVATIVE = 4 |
| Conservative deployment mode. | |
| const | MODE_DEPLOYMENT_AGGRESIVE = 8 |
| Deployment mode with very aggressive caching. | |
| const | MODE_DEPLOYMENT = 12 |
| Any of MODE_DEPLOYMENT_AGGRESIVE and MODE_DEPLOYMENT_CONSERVATIVE. | |
| const | OS_UNKNOWN = 0 |
| Unknown operating system. | |
| const | OS_UNIX = 1 |
| Operating System: Unix. | |
| const | OS_MAC_OS = 2 |
| Operating System: Mac OS. | |
| const | OS_WINDOWS = 4 |
| Operating System: Microsoft Windows. | |
Static Protected Member Functions | |
| static | checkPhp () |
| Will check if all required php extensions are installed. | |
| static | updateCache () |
| Clears the cache if a configuration file has changed. | |
Static Protected Attributes | |
| static | $modulesWithManualFileDeclarations = array() |
| Module names that have a manual files declaration. | |
Static Private Attributes | |
| static | $cache = NULL |
| A generic cache that can be used by sub-systems. | |
| static | $os = NULL |
| The operating system this script is being run on. | |
| static | $configuration = NULL |
| Configuration of the framework. | |
| static | $initialized = false |
| Whether the framework is fully initialized. | |
| static | $mode = self::MODE_DEVELOPMENT |
| The current spunQ mode. | |
| static | $definiteClassFiles = array() |
| Registered class files for auto inclusion. | |
| static | $possibleClassFiles = array() |
| Files that could possibly contain certain classes. | |
This class is intended to perform the boot-strapping of all classes and the initialization of the php environment (i.e., Setting string encoding, including required files, etc.)
The framework can be run in one of several modes, which are defined as class constants starting with MODE_.
Definition at line 85 of file spunQ.class.php.
| static spunQ::assureIsInitialized | ( | ) | [static] |
Throws an exception if isInitialized yields false.
Definition at line 331 of file spunQ.class.php.
| static spunQ::assureNotInitialized | ( | ) | [static] |
Throws an exception if isInitialized yields true.
The opposite of assureIsInitialized()
Definition at line 311 of file spunQ.class.php.
| static spunQ::checkPhp | ( | ) | [static, protected] |
Will check if all required php extensions are installed.
Definition at line 668 of file spunQ.class.php.
| static spunQ::filesManuallyRegistered | ( | $ | moduleName | ) | [static] |
Checks whether file declarations of the module have been done manually.
Modules can perform an inclusion optimization. If files are not registered manually, spunQ goes through all src folders of all modules and finds all files ending on [class|type|exception|...].php. One can avoid that by providing these files to spunQ with a call to registerMultipleClassFiles(), where the module name is provided. This function will return true if this has been done for the given module. Mostly used by internal type initialization system system
| $moduleName | Name of the module to make query for. |
Definition at line 399 of file spunQ.class.php.
| static spunQ::getCache | ( | ) | [static] |
Gets a spunQ_SQLiteCache.
This function will try to provide a spunQ_TimedFileCache, if able. However, this is not guaranteed. Do not forget that this cache is for potentially speeding up stuff by storing intermediate results somewhere, Usage of the cache should be as such. In other words: This cache will not guarantee you that it can cache the value you provided for the maximum amount of time!
Furthermore, this specific cache should only be used to store data that is not expected to change often, otherwise the cache file might grow, leading to long acces times, defeating its purpose, so use it wisely!
All keys of the cache should be prepended by the class name that is using the cache to avoid key collisions.
Definition at line 558 of file spunQ.class.php.
| static spunQ::getConfiguration | ( | ) | [static] |
Returns the configuration.
Definition at line 192 of file spunQ.class.php.
| static spunQ::getMode | ( | ) | [static] |
Gets the current spunQ mode.
Definition at line 530 of file spunQ.class.php.
| static spunQ::getOs | ( | ) | [static] |
Gets the operating system this script is being run on.
Definition at line 586 of file spunQ.class.php.
| static spunQ::getRegisteredModuleFiles | ( | $ | moduleName, | |
| $ | throwException = true | |||
| ) | [static] |
Retrieves class files registered for a module.
| $moduleName | Name of the module to retrieve class files for. | |
| $throwException | Whether the function shall throw an exception if no class files were registered for the module. |
Definition at line 413 of file spunQ.class.php.
| static spunQ::includeClass | ( | $ | className | ) | [static] |
Makes sure a class is available by optionally including its file.
| $className | The class to include. |
Definition at line 443 of file spunQ.class.php.
| static spunQ::init | ( | array $ | configurations | ) | [static] |
Starts the initialization of the spunQ framework.
Will do the following in order:
| spunQ_InitializationError | If the framework has already been initialized. |
Definition at line 208 of file spunQ.class.php.
| static spunQ::initBatchOperation | ( | $ | time = 300, |
|
| $ | memory = '512M' | |||
| ) | [static] |
Adjusts environment for an upcoming batch operation.
A batch operation is one that does not necessarily generate an output and is not intended to be called by normal users of the application. An example within the framework is spunQ_Cron::tick(). WARNING: Both parameters are ignored in deployment mode. Both the memory and the time limit are set to PHP_INT_MAX and -1 respectively, indicating that neither has a limit.
http://php.net/manual/en/info.configuration.php#ini.max-execution-time
| $time | Ensures that max_execution_time is equal to at least this value. A NULL value indicates that this value should not be modified. | |
| $memory | Ensures that memory_limit is at least this much. A NULL value indicates that this value should not be modified. |
Definition at line 618 of file spunQ.class.php.
| static spunQ::inMode | ( | $ | mode | ) | [static] |
Checks if spunQ is configured to be in given mode.
| $mode | The mode to check, either of the MODE_* constants. |
Definition at line 539 of file spunQ.class.php.
| static spunQ::isInitialized | ( | ) | [static] |
| static spunQ::parseMemoryLimit | ( | $ | value | ) | [static] |
Parses a valid value for the configuration memory_limit.
A valid value consists of an integer value, optionally followed by either of G, M, K (in upper or lower case). Each order of magnitude multiplies the numeric value with 1024.
| $value | The value to parse. |
Definition at line 647 of file spunQ.class.php.
| static spunQ::registerClassFile | ( | $ | className, | |
| $ | file | |||
| ) | [static] |
Register a class file.
| $className | Name of a class. | |
| $file | The file to include to obtain the class. |
| spunQ_ConfigurationError | If the class was already registered |
Definition at line 430 of file spunQ.class.php.
| static spunQ::registerMultipleClassFiles | ( | $ | mapping, | |
| $ | moduleName = NULL | |||
| ) | [static] |
Registers multiple class files at once.
Same as as calling registerClassFile() one by one, but with increased performance.
| $mapping | Mapping of class name to file path. | |
| $moduleName | Name of the module the classes belong to. If this parameter is not null, it is assumed, that $mapping contains all class files of that module and the src folder of the module will not be crawled during initialization of the type system. |
Definition at line 367 of file spunQ.class.php.
| static spunQ::requireAll | ( | array $ | files, | |
| $ | className = NULL | |||
| ) | [static] |
Includes all files provided using require_once.
The files should contain absolute paths, since a relative path could depend on the directory the currently executing script is residing. The processing of the inclusion could lead to __autoload to be called when an unknown class is referenced in the included file. The files to be included are stored in an instance variable for this reason and the function is called again with the class name passed to __autoload as second parameter, in which case the function will only try to find a suitable file to include and return. Suitable in this context means a file that is named like the class.
| $files | A list of files. | |
| $className | An optional class name that should be included, see class description. |
Definition at line 475 of file spunQ.class.php.
| static spunQ::requireExtension | ( | $ | extension | ) | [static] |
Will ensure that a given extension is installed or throw an exception.
| $extension | The name of a PHP extension. All extension names can be found on the function reference on php.net (http://www.php.net/manual/en/funcref.php) |
| spunQ_Error |
Definition at line 238 of file spunQ.class.php.
| static spunQ::requireExtensions | ( | array $ | extensions | ) | [static] |
Will ensure that given extensions are installed or throw an exception.
| $extensions | strings of php extension names. All extension names can be found on the function reference on php.net (http://www.php.net/manual/en/funcref.php) |
| spunQ_Error |
Definition at line 258 of file spunQ.class.php.
| static spunQ::requireExternalApplication | ( | $ | name, | |
| $ | testArgs = array() | |||
| ) | [static] |
Checks if a required external application is installed.
This function will not do anything if spunQ is in deployment mode. In development mode, the application is executed with specified parameters and this function will throw an exception if the system call returns a non-zero result.
| $name | The name of the executable. It is expected to be in the PATH. | |
| $testArgs | The arguments to pass to the application to check its existance. |
| spunQ_InitializationError | If the execution of the executable returns a non-zero result. |
Definition at line 290 of file spunQ.class.php.
| static spunQ::setMode | ( | $ | mode | ) | [static] |
Sets the current spunQ mode.
| $mode | One of the following constants:
|
Definition at line 511 of file spunQ.class.php.
| static spunQ::updateCache | ( | ) | [static, protected] |
Clears the cache if a configuration file has changed.
Definition at line 678 of file spunQ.class.php.
spunQ::$cache = NULL [static, private] |
A generic cache that can be used by sub-systems.
Definition at line 141 of file spunQ.class.php.
spunQ::$configuration = NULL [static, private] |
Configuration of the framework.
Definition at line 154 of file spunQ.class.php.
spunQ::$definiteClassFiles = array() [static, private] |
Registered class files for auto inclusion.
Definition at line 178 of file spunQ.class.php.
spunQ::$initialized = false [static, private] |
Whether the framework is fully initialized.
Some functions should not be called until the initialization is complete.
Definition at line 161 of file spunQ.class.php.
spunQ::$mode = self::MODE_DEVELOPMENT [static, private] |
The current spunQ mode.
Either of the MODE_* constants.
Definition at line 170 of file spunQ.class.php.
spunQ::$modulesWithManualFileDeclarations = array() [static, protected] |
Module names that have a manual files declaration.
The manual file list registration is done through a call to registerMultipleClassFiles with the second parameter set.
Definition at line 354 of file spunQ.class.php.
spunQ::$os = NULL [static, private] |
The operating system this script is being run on.
Definition at line 148 of file spunQ.class.php.
spunQ::$possibleClassFiles = array() [static, private] |
Files that could possibly contain certain classes.
Definition at line 186 of file spunQ.class.php.
| const spunQ::MODE_DEPLOYMENT_AGGRESIVE = 8 |
Deployment mode with very aggressive caching.
The framework will run with highly aggressive caching mechanisms that will not double-check the cached values. The framework will fail to notice any changes to source and configuration files or the database and will die horribly if something goes wrong. Use at your own risk!
Definition at line 109 of file spunQ.class.php.
1.5.9