Class: I2CE Configurator (Development)
This article describes the class I2CE_Configurator .
- Extends the class: I2CE_Fuzzy.
- Location: Part of the module I2CE in the package I2CE 4.0-dev
- Source: Defined in the file lib/I2CE_Configurator.php on line 40
Variables
$mod_path
Hack to store the paths to each config
- Defined in i2ce/lib/I2CE_Configurator.php on line 53
- Type: private array $mod_path
$top_module
An associative array linking directory to top-level module
- Defined in i2ce/lib/I2CE_Configurator.php on line 59
- Type: private array $top_module
$checked_paths
A list of the paths checked
- Defined in i2ce/lib/I2CE_Configurator.php on line 65
- Type: private array $checked_paths
$found_modules
Holds a list of found modules @var private array $found_module
- Defined in i2ce/lib/I2CE_Configurator.php on line 71
- Type: private $found_modules
$errors
Errors encountered
- Defined in i2ce/lib/I2CE_Configurator.php on line 76
- Type: private string $errors
$file_list
list of files for each module
- Defined in i2ce/lib/I2CE_Configurator.php on line 81
- Type: private array $file_list
$storage
Where we are saving all configuration data
- Defined in i2ce/lib/I2CE_Configurator.php on line 87
- Type: protected I2CE_MagicData $storage
$template
the current template we are working with ;
- Defined in i2ce/lib/I2CE_Configurator.php on line 93
- Type: protected I2CE_MagicDataTemplate $template
$merges
$var protected array $merges. Keys are magic data paths, values are merge type
- Defined in i2ce/lib/I2CE_Configurator.php on line 99
- Type: protected $merges
$locales
The locales for which we check for config files.
- Defined in i2ce/lib/I2CE_Configurator.php on line 104
- Type: protected $locales
$hash
. The hash of the last config file processed. It is a string, the hash, if the last config file loaded successully. false if the last config file did not load succesully. null if there was never a config file processed.
- Defined in i2ce/lib/I2CE_Configurator.php on line 113
- Type: protected mixed $hash
$moved
- Defined in i2ce/lib/I2CE_Configurator.php on line 671
- Type: protected $moved
Methods
__construct()
Constructor
- Defined in i2ce/lib/I2CE_Configurator.php on line 124
- Signature: public function __construct($storage,$set_last_access)
- Parameters:
- I2CE_MagicData $storage
if none is passed in, then a simple MagicData and config storage object using MagicDataStorageMem will be set up.- Default Value: null
- boolean $set_last_access
- Default Value: true
- I2CE_MagicData $storage
__destruct()
- Defined in i2ce/lib/I2CE_Configurator.php on line 141
- Signature: public function __destruct()
checkForConflicts()
- Defined in i2ce/lib/I2CE_Configurator.php on line 926
- Signature: protected function checkForConflicts($requirements,$enabled_modules)
- Parameters:
- $requirements
- $enabled_modules
checkRequirements()
Checks the requirements. if all requirements are met and there are no conflicts, it returns a list of those that need to be installed, an empty array() if none are needed. On failure returns null. @param array $shortnames an array of shortnames @param array $remove an array of potential shortnames to remove -- if we did not find them somplace else. (it may have just been moved) defaults to an empty array.
- Defined in i2ce/lib/I2CE_Configurator.php on line 706
- Signature: public function checkRequirements($updates,$disables,$removals,$enabled_modules,$required_modules,$reset_moved)
- Parameters:
- $updates
- mixed $disables
a shortname or an array of shortnames of modules to disable. Defaults to empty array- Default Value: array()
- $removals
- Default Value: array()
- array $enabled_modules
An array of shortnames of enabled modules -- we check for conflicts against this array- Default Value: array()
- mixed $required_modules
A shortname or an array of shortnames of required modules -- if a module is set to be updated and it is not required by on of the modules in this array, it will be set as an optional modules. Defaults to the empty array- Default Value: array()
- $reset_moved
- Default Value: true
- Returns: array.
Keys are: 'failure' - string with the reason for failture 'requirements' - array which has as keys shortnames and values files for the requirements. 'removals' - array of shortnames that need to be removed. 'optional' - array with key shortnames and value true 'moved' - array with key shortnames and value true
extRequirements()
Get a list of External dependencies for the module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1322
- Signature: public function extRequirements($module)
- Parameters:
- string $module
Module to check.
- string $module
- Returns: array
List of requirement objects
findAvailableConfigs()
Searches the system for available configuration files (if not done already) and stores them in the given I2CE_MagicData @param I2CE_FileSearch A file search to use for modules. If null(default) uses I2CE::getFileSearch()
- Defined in i2ce/lib/I2CE_Configurator.php on line 585
- Signature: public function findAvailableConfigs($file_search,$deep,$limit_to_subdir,$verbose_errors)
- Parameters:
- $file_search
- Default Value: null
- boolean $deep
Defaults to false. If false, only checks the module paths of the currently enabled modules. If true, checks the module paths of all modules which are either enabled or disabled.- Default Value: false
- string $limit_to_subdir
If $file_search is given and this is set, we only add in the directories which are subdirectorues of $limit_to_subdir (check is by string comparision)- Default Value:
- $verbose_errors
- Default Value: false
- $file_search
- Returns: array
of string the list of shortnames found
findPotentialConfigs()
Return a list of potential configuration files. "Potential config files" are those whose extension matches the regular expression. @param array @returns
- Defined in i2ce/lib/I2CE_Configurator.php on line 560
- Signature: private function findPotentialConfigs($file_search)
- Parameters:
- $file_search
flattenRequirements()
- Defined in i2ce/lib/I2CE_Configurator.php on line 641
- Signature: protected function flattenRequirements($requirementDOM)
- Parameters:
- $requirementDOM
getAvailableModules()
Scan a directory for available modules.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1684
- Signature: public function getAvailableModules($search_dirs,$limit_search,$rescan,$verbose)
- Parameters:
- Returns: array
List of modules found
getConflicts()
For a given module, find a list of conflicting modules.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1381
- Signature: private function getConflicts($module)
- Parameters:
- string $module
Module to check
- string $module
- Returns: array
List of conflicts
getDependencyList()
Gets information about the dependecies for a module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1195
- Signature: public function getDependencyList($module)
- Parameters:
- string $module
- Returns: array
indexed by 'requirements', 'conflicts' 'enable', 'path', and 'badness' where 'badness' is an array of strings of error messages and the other are arrays of shortnames
getDependsList()
Gets the list of modules depending on the specified module.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1157
- Signature: public function getDependsList($shortname)
- Parameters:
- string $shortname
The shortname of a module
- string $shortname
getDescription()
Returns a brief one-line description of the module.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1503
- Signature: public function getDescription($module)
- Parameters:
- string $module
name
- string $module
- Returns: string
getEnabled()
Get enabled sub-modules
- Defined in i2ce/lib/I2CE_Configurator.php on line 1290
- Signature: private function getEnabled($module)
- Parameters:
- string $module
Module to check.
- string $module
- Returns: array
List of enabled submodules
getHash()
Get the hash of the contents of the last processConfifFile.
- Defined in i2ce/lib/I2CE_Configurator.php on line 190
- Signature: public function getHash()
- Returns: mixed.
String, the hash, if the last config file loaded successfully. false if the last config file did not load succesully. null if there was never a config file processed.
getI2CERoot()
- Defined in i2ce/lib/I2CE_Configurator.php on line 1260
- Signature: public function getI2CERoot()
getLongDescription()
Returns a longer description of the module.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1512
- Signature: public function getLongDescription($module)
- Parameters:
- string $module
name
- string $module
- Returns: string
getMaxChildOrder()
- Defined in i2ce/lib/I2CE_Configurator.php on line 1138
- Signature: protected function getMaxChildOrder($node,$xpath)
- Parameters:
- $node
- $xpath
getMerges()
Get the magic data paths whose status we are tracking. $retrurns array. Keys are magic data paths, values are the merge type
- Defined in i2ce/lib/I2CE_Configurator.php on line 527
- Signature: public function getMerges()
getModuleDir()
Return the directory of the module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1271
- Signature: public function getModuleDir($module)
- Parameters:
- string $module
Module to check.- Default Value: null
- string $module
- Returns: string
Path to config file.
getModuleFileList()
Get a list of files for a given module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1660
- Signature: public function getModuleFileList($module)
- Parameters:
- string $module
The module name
- string $module
- Returns: array
List of files in the module. Paths are relative to the directory where the module's configuration file is.
getModuleFileMap()
Get a list of each files under each path.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1589
- Signature: public function getModuleFileMap($module)
- Parameters:
- string $module
The module name
- string $module
- Returns: array
List of file maps in the module. Paths are relative to the directory where the module's configuration file is. @todo Contains a hack for the special case where CLASSES directory is ./
getModulePath()
Return the path to the module configuration file
- Defined in i2ce/lib/I2CE_Configurator.php on line 1252
- Signature: public function getModulePath($module)
- Parameters:
- string $module
Module to check.
- string $module
- Returns: string
Path to config file.
getModulePathList()
- Defined in i2ce/lib/I2CE_Configurator.php on line 1571
- Signature: public function getModulePathList($module)
- Parameters:
- $module
getNextUnchecked()
- Defined in i2ce/lib/I2CE_Configurator.php on line 970
- Signature: protected function getNextUnchecked($requirementDOM)
- Parameters:
- $requirementDOM
getPackageAuthors()
Returns a longer description of the module.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1530
- Signature: public function getPackageAuthors($module)
- Parameters:
- string $module
name
- string $module
- Returns: string
getRequirements()
Get a list of requirements for the module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1338
- Signature: private function getRequirements($module)
- Parameters:
- string $module
Module to check.
- string $module
- Returns: array
List of required modules.
getRoot()
Get the root of where this I2CE instance started.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1225
- Signature: public function getRoot()
- Returns: the
fully resolved path to the starting directory
getStorage()
Get the magic data node storage for the configurator
- Defined in i2ce/lib/I2CE_Configurator.php on line 46
- Signature: public function getStorage()
- Returns: I2CE_MagicDataNode
getTopModule()
Find the top-level module in a directory. (e.g. I2CE, ihris-common, ihris-manage)
- Defined in i2ce/lib/I2CE_Configurator.php on line 1552
- Signature: public function getTopModule($d,$verbose)
- Parameters:
getVersion()
Return the version for a given module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1491
- Signature: public function getVersion($module)
- Parameters:
- string $module
name
- string $module
- Returns: string
importLocalizedTemplates()
- Defined in i2ce/lib/I2CE_Configurator.php on line 352
- Signature: public function importLocalizedTemplates($localized)
- Parameters:
- $localized
- Default Value: array()
- $localized
isReq()
Determine if this object is a I2CE_MagicDataNode that can be used as a requirement. @param mixed $string
- Defined in i2ce/lib/I2CE_Configurator.php on line 1180
- Signature: private function isReq($req)
- Parameters:
- $req
- Returns: boolean
loadConfigFile()
Load a config file with various extensions.
- Defined in i2ce/lib/I2CE_Configurator.php on line 169
- Signature: protected function loadConfigFile($file,$verbose_errors)
- Parameters:
- Returns: booolean
true on success
moduleConflicts()
Checks to see if a module conflicts with by another module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1480
- Signature: public function moduleConflicts($module,$version,$conflicts,$deep)
- Parameters:
- Returns: boolean
moduleRequires()
Checks to see if a module is required by another module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1419
- Signature: public function moduleRequires($module,$version,$requirements,$deep,$cat)
- Parameters:
- Returns: boolean
processConfig()
- Defined in i2ce/lib/I2CE_Configurator.php on line 441
- Signature: public function processConfig($process_configuration,$verbose_errors,$process_meta,$localized)
- Parameters:
- $process_configuration
- Default Value: false
- $verbose_errors
- Default Value: true
- $process_meta
- Default Value: true
- $localized
- Default Value: array()
- $process_configuration
processConfigFile()
Loads in a config file and validates it against its referenced DTD. Sets the access time and the shortname (provided in the metadata) for the file. If there is already a config file with the same shortname, it will remove that fro the list of the config files. Save all the configuration metadata under $storage->$shortname where $shortname is the shortname provided for by the config file.
- Defined in i2ce/lib/I2CE_Configurator.php on line 223
- Signature: public function processConfigFile($file,$process_configuration,$verbose_errors,$process_meta,$localized)
- Parameters:
- string $file
The full path to the config file. If this is less than the time the file was last accessed, it does not load the file/set the access time. - mixed $process_configuration
Boolean -- true if you want to save the configuration data into (defaults to false). If true process all config data. If it is a string, then we assume that it is a version number, in which case we process all configuration data that is versioned after the specified version- Default Value: false
- boolean $verbose_errors
defaults to true.- Default Value: true
- $process_meta
- Default Value: true
- array $localized
Data on localized versions of the file already loaded.- Default Value: array()
- string $file
- Returns: string
the shortname provided for by this config file or null on failure.
processRequirementsDOM()
@param boolean $options. Defaults to false. Set to true if the new requests are optional i.e. don't cause a fatal error/add to the DOM if there a conflict
- Defined in i2ce/lib/I2CE_Configurator.php on line 1012
- Signature: public function processRequirementsDOM($new_requests,$requests,$optional)
- Parameters:
- mixed $new_requests
a shortname or an array of shortnames of module we wish to be loaded. - DOMDocument $requests
The existing requests. Each node should have an order attribute. Optionally hey may have the attribute 'checked' meaning that we consider this node to be checked. - $optional
- Default Value: false
- mixed $new_requests
- Returns: an
array of the new modules that were installed on sucess. A string on failure describing the failure reason.
recursiveScan()
- Defined in i2ce/lib/I2CE_Configurator.php on line 605
- Signature: private function recursiveScan($shortnames,$limit_to_subdir,$verbose)
- Parameters:
- &$shortnames
- $limit_to_subdir
- $verbose
requirements()
Get a list of requirement objects for the module
- Defined in i2ce/lib/I2CE_Configurator.php on line 1306
- Signature: public function requirements($module)
- Parameters:
- string $module
Module to check.
- string $module
- Returns: array
List of requirement objects
resetCheckedPaths()
- Defined in i2ce/lib/I2CE_Configurator.php on line 667
- Signature: public function resetCheckedPaths()
resetMerges()
Reset the tracked data.
- Defined in i2ce/lib/I2CE_Configurator.php on line 533
- Signature: public function resetMerges()
setLocales()
Set the locales used when handingling the processing of config data.
- Defined in i2ce/lib/I2CE_Configurator.php on line 151
- Signature: public function setLocales($locales)
- Parameters:
- mixed $locales
Either a string ( a locale) or an array of strings
- mixed $locales
setModulePath()
Set the module's path, usually used for testing.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1235
- Signature: public function setModulePath($module,$path)
- Parameters:
setRoot()
Set the root of where this I2CE instance started.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1212
- Signature: public function setRoot($dir)
- Parameters:
- string $dir
Directory (defaults to getcwd()) where this instance of Configurator was created.- Default Value: null
- string $dir
- Returns: the
fully resolved path to $dir
setTopModule()
Set the top level module for a directory.
- Defined in i2ce/lib/I2CE_Configurator.php on line 1538
- Signature: public function setTopModule($dir,$module)
- Parameters:
- $dir
- $module
setupFileSearch()
- Defined in i2ce/lib/I2CE_Configurator.php on line 537
- Signature: private function setupFileSearch($mod,$path)
- Parameters:
- $mod
- Default Value: null
- $path
- Default Value: "MODULES"
- $mod
shallowScan()
- Defined in i2ce/lib/I2CE_Configurator.php on line 623
- Signature: private function shallowScan($potential_configs,$verbose)
- Parameters:
- $potential_configs
- $verbose
- Default Value: false
Inherited Methods
_hasMethod()
This public method is inherited from I2CE_Fuzzy->_hasMethod()
Inherited Fuzzy Methods
userMessage()
This method is inherited from I2CE_Fuzzy->userMessage()
Fuzzy Methods
loadConfigFile_YAML()
This method is implemented by I2CE_Module_YAML->loadConfigFile_YAML()