예제 #1
0
파일: Manager.php 프로젝트: patrova/omeka-s
 /**
  * Install and activate a module
  *
  * @param Module $module
  */
 public function install(Module $module)
 {
     $this->authorize($module, 'install');
     // Only a not installed module can be installed
     if (self::STATE_NOT_INSTALLED !== $module->getState()) {
         throw new Exception\ModuleStateInvalidException(sprintf($this->getTranslator()->translate('Module "%s" is marked as "%s" and cannot be installed'), $module->getId(), $module->getState()));
     }
     // Invoke the module's install method
     $this->getModuleObject($module)->install($this->getServiceLocator());
     // Persist the module entity
     $entity = new ModuleEntity();
     $entity->setId($module->getId());
     $entity->setIsActive(true);
     $entity->setVersion($module->getIni('version'));
     $this->getEntityManager()->persist($entity);
     $this->getEntityManager()->flush();
     $module->setState(self::STATE_ACTIVE);
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 public function getResourceId()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getResourceId', array());
     return parent::getResourceId();
 }