Beispiel #1
0
 /**
  * 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 Arcavias core path (optional, dirname(__FILE__) if null)
  */
 public function __construct(array $extdirs = array(), $defaultdir = true, $basedir = null)
 {
     if ($basedir === null) {
         $basedir = dirname(__FILE__);
     }
     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();
 }
Beispiel #2
0
 /**
  * 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 Arcavias core path (optional, dirname(__FILE__) if null)
  */
 public function __construct(array $extdirs = array(), $defaultdir = true, $basedir = null)
 {
     if ($basedir === null) {
         $basedir = dirname(__FILE__);
     }
     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) {
         $this->_checkManifestIsValid($location, $manifest);
         $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();
 }