Exemple #1
0
 /**
  * Load a single extension.
  *
  * @param PackageDescriptor $descriptor
  */
 private function addManagedExtension(PackageDescriptor $descriptor)
 {
     $className = $descriptor->getClass();
     if ($this->isClassLoadable($className) === false) {
         $this->flashLogger->error(Trans::__("Extension package %NAME% has an invalid class '%CLASS%' and has been skipped.", ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
         return;
     }
     /** @var ExtensionInterface $extension */
     $extension = new $className();
     if ($extension instanceof ExtensionInterface) {
         $baseDir = $this->extFs->getDir($descriptor->getPath());
         $webDir = $this->webFs->getDir($descriptor->getWebPath());
         $this->add($extension, $baseDir, $webDir, $descriptor->getName())->setDescriptor($descriptor);
     } else {
         $this->flashLogger->error(Trans::__("Extension package %NAME% base class '%CLASS%' does not implement \\Bolt\\Extension\\ExtensionInterface and has been skipped.", ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
     }
 }
Exemple #2
0
 /**
  * Load a single extension.
  *
  * @param PackageDescriptor $descriptor
  */
 private function addManagedExtension(PackageDescriptor $descriptor)
 {
     $className = $descriptor->getClass();
     if ($this->isClassLoadable($className) === false) {
         if ($descriptor->getType() === 'local' && $this->isClassLoadable('Wikimedia\\Composer\\MergePlugin') === false) {
             $this->flashLogger->error(Trans::__('general.phrase.error-local-extension-set-up-incomplete', ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
         } else {
             $this->flashLogger->error(Trans::__("Extension package %NAME% has an invalid class '%CLASS%' and has been skipped.", ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
         }
         return;
     }
     /** @var ExtensionInterface $extension */
     $extension = new $className();
     if ($extension instanceof ExtensionInterface) {
         $baseDir = $this->extFs->getDir($descriptor->getPath());
         $webDir = $this->webFs->getDir($descriptor->getWebPath());
         $this->add($extension, $baseDir, $webDir, $descriptor->getName())->setDescriptor($descriptor);
     } else {
         $this->flashLogger->error(Trans::__("Extension package %NAME% base class '%CLASS%' does not implement \\Bolt\\Extension\\ExtensionInterface and has been skipped.", ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
     }
 }
Exemple #3
0
 /**
  * Load a single extension.
  *
  * @param PackageDescriptor $descriptor
  */
 private function addManagedExtension(PackageDescriptor $descriptor)
 {
     $className = $descriptor->getClass();
     if (class_exists($className) === false) {
         if ($descriptor->getType() === 'local' && class_exists('Wikimedia\\Composer\\MergePlugin') === false) {
             $this->flashLogger->error(Trans::__("Local extension set up incomplete. Please run 'Install all packages' on the Extensions page.", ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
         } else {
             $this->flashLogger->error(Trans::__("Extension package %NAME% has an invalid class '%CLASS%' and has been skipped.", ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
         }
         return;
     }
     /** @var ExtensionInterface $extension */
     $extension = new $className();
     if ($extension instanceof ExtensionInterface) {
         $baseDir = $this->extFs->getDir($descriptor->getPath());
         $webDir = $this->webFs->getDir($descriptor->getWebPath());
         $this->add($extension, $baseDir, $webDir, $descriptor->getName())->setDescriptor($descriptor);
     } else {
         $this->flashLogger->error(Trans::__("Extension package %NAME% base class '%CLASS%' does not implement \\Bolt\\Extension\\ExtensionInterface and has been skipped.", ['%NAME%' => $descriptor->getName(), '%CLASS%' => $className]));
     }
 }