/** * Initialises the object. * * @param array $extdirs List of directories to look for manifest files (or sub-directories thereof) * @param boolean $defaultdir If default extension directory should be included automatically * @param string|null $basedir Aimeos core path (optional, __DIR__ if null) */ public function __construct(array $extdirs = array(), $defaultdir = true, $basedir = null) { if ($basedir === null) { $basedir = __DIR__; } if ($defaultdir === true && is_dir($basedir . DIRECTORY_SEPARATOR . 'ext') === true) { $extdirs[] = $basedir . DIRECTORY_SEPARATOR . 'ext'; } $this->manifests[$basedir] = $this->getManifestFile($basedir); self::$includePaths = $this->getIncludePaths(); $this->registerAutoloader(); foreach ($this->getManifests($extdirs) as $location => $manifest) { if (isset($this->extensions[$manifest['name']])) { $location2 = $this->extensions[$manifest['name']]['location']; $msg = 'Extension "%1$s" exists twice in "%2$s" and in "%3$s"'; throw new \Exception(sprintf($msg, $manifest['name'], $location, $location2)); } if (!isset($manifest['depends']) || !is_array($manifest['depends'])) { throw new \Exception(sprintf('Incorrect dependency configuration in manifest "%1$s"', $location)); } $manifest['location'] = $location; $this->extensions[$manifest['name']] = $manifest; foreach ($manifest['depends'] as $name) { $this->dependencies[$manifest['name']][$name] = $name; } } $this->addManifests($this->dependencies); self::$includePaths = $this->getIncludePaths(); }
/** * Initialises the object. * * @param array $extdirs List of directories to look for manifest files (or sub-directories thereof) * @param boolean $defaultdir If default extension directory should be included automatically * @param string|null $basedir Aimeos core path (optional, __DIR__ if null) */ public function __construct(array $extdirs = array(), $defaultdir = true, $basedir = null) { if ($basedir === null) { $basedir = __DIR__; } if ($defaultdir === true && is_dir($basedir . DIRECTORY_SEPARATOR . 'ext') === true) { $extdirs[] = realpath($basedir . DIRECTORY_SEPARATOR . 'ext'); } $this->manifests[$basedir] = $this->getManifestFile($basedir); self::$includePaths = $this->getIncludePaths(); $this->registerAutoloader(); $this->addDependencies($extdirs); $this->addManifests($this->dependencies); self::$includePaths = $this->getIncludePaths(); }