/** * This method is charged to read the tree of the applications root directory (apps) in order to determine which * applications is installed and which modules are installed and belong to theses applications. * This method must be called only at startup. * @param string $path_to_apps : the path (relative or absolute) to join the ApplicationsCommonInterface class. * @return an array which is meant to be stored into the static variable $installed_modules. */ public static function initialize($path_to_apps) { parent::flushErrors(); //Set the path to the root apps directory: parent::setRelativePathToApps($path_to_apps); //Require the ApplicationsCommonInterface: if (file_exists(parent::getRelativePathToApps() . 'ApplicationsCommonInterface.class.php')) { require_once parent::getRelativePathToApps() . 'ApplicationsCommonInterface.class.php'; } else { self::setError('Error while reading ' . parent::getRelativePathToApps() . 'ApplicationsCommonInterface.class.php' . ': the file probably doesn\'t exists'); parent::setInstalledModules(null); return null; } //Join the interface and instanciate it: $interface = new ApplicationsCommonInterface(parent::getRelativePathToApps()); //Get the installed applications: if (!($installed_apps = $interface->getApplications())) { parent::setInstalledModules(null); return false; } //For each installed application, get the installed modules: $apps_modules = array(); foreach ($installed_apps as $appName => $appPath) { if ($modules = $interface->getModulesByApp($appName)) { $apps_modules[$appPath] = $modules; } } parent::setInstalledModules($apps_modules); }
public static function setRelativePathToApps($path) { parent::setRelativePathToApps($path); }