Ejemplo n.º 1
0
 public function execute()
 {
     $this->operationFile = $this->operationFile ? $this->operationFile : $this->kernel->getRootDir() . '/config/operations.xml';
     $operationsHandler = new OperationHandler($this->operationFile, $this->logger);
     $bundles = $this->getBundlesByFqcn();
     $operations = $operationsHandler->getOperations();
     /** @var \Claroline\BundleRecorder\Operation[] $orderedOperations */
     $orderedOperations = [];
     foreach ($operations as $operation) {
         if ($operation->getBundleType() === Operation::BUNDLE_CORE) {
             array_unshift($orderedOperations, $operation);
         } else {
             array_push($orderedOperations, $operation);
         }
     }
     foreach ($orderedOperations as $operation) {
         $installer = $operation->getBundleType() === Operation::BUNDLE_CORE ? $this->baseInstaller : $this->pluginInstaller;
         if ($operation->getType() === Operation::INSTALL) {
             $installer->install($bundles[$operation->getBundleFqcn()]);
         } elseif ($operation->getType() === Operation::UPDATE) {
             $installer->update($bundles[$operation->getBundleFqcn()], $operation->getFromVersion(), $operation->getToVersion());
         } else {
             // remove or disable package
         }
     }
     rename($this->operationFile, $this->operationFile . '.bup');
 }