Beispiel #1
0
 public function updateModules()
 {
     $finder = new Finder();
     $finder->name('module.xml')->in($this->baseModuleDir . '/*/Config');
     $descriptorValidator = new ModuleDescriptorValidator();
     foreach ($finder as $file) {
         $content = $descriptorValidator->getDescriptor($file->getRealPath());
         $reflected = new \ReflectionClass((string) $content->fullnamespace);
         $code = basename(dirname($reflected->getFileName()));
         $con = Propel::getWriteConnection(ModuleTableMap::DATABASE_NAME);
         $con->beginTransaction();
         try {
             $module = ModuleQuery::create()->filterByCode($code)->findOne();
             if (null === $module) {
                 $module = new Module();
                 $module->setCode($code)->setFullNamespace((string) $content->fullnamespace)->setType($this->getModuleType($reflected))->setActivate(0)->save($con);
             }
             $this->saveDescription($module, $content, $con);
             $con->commit();
         } catch (PropelException $e) {
             $con->rollBack();
             throw $e;
         }
     }
 }
Beispiel #2
0
 protected function loadModuleDescriptor()
 {
     $path = sprintf("%s/Config/module.xml", $this->modulePath);
     $descriptorValidator = new ModuleDescriptorValidator();
     try {
         // validation with xsd
         $this->moduleDescriptor = $descriptorValidator->getDescriptor($path);
         $this->moduleVersion = $descriptorValidator->getModuleVersion();
     } catch (InvalidXmlDocumentException $ex) {
         throw $ex;
     }
 }