public function handleLoad() { if ($this->backup && $this->connectionCheckerFactory->invoke() && count($this->getEntityManager()->getConnection()->getSchemaManager()->listTables()) == 0) { $this->deploymentManager->loadBackup($this->backup); } $this->redirect('this', array('backup' => NULL)); }
protected function getBackups() { $ret = array(); foreach ($this->deploymentManager->getBackups() as $name => $backup) { $ret[$name] = $name . ' (' . $backup['date']->format('Y-m-d H:i:s') . ')'; } return $ret; }
public function getBackupName() { $max = 0; foreach ($this->deploymentManager->getBackups() as $name => $values) { if (substr($name, 0, 7) == 'backup-') { $name = explode('-', $name, 2); $v = intval($name[1]); if ($v > $max) { $max = $v; } } } return 'backup-' . ($max + 1); }
public function handleInstall() { if ($this->connectionCheckerFactory->invoke() && count($this->getEntityManager()->getConnection()->getSchemaManager()->listTables()) == 0) { if ($this->backup) { $this->deploymentManager->loadBackup($this->backup); } else { /** @var $em \Doctrine\ORM\EntityManager */ $em = $this->getEntityManager(); $tool = new SchemaTool($em); $robotLoader = new RobotLoader(); $robotLoader->setCacheStorage(new MemoryStorage()); $robotLoader->addDirectory($this->context->parameters['modules']['cms']['path'] . '/CmsModule'); $robotLoader->register(); $classes = array(); foreach ($robotLoader->getIndexedClasses() as $item => $a) { $ref = ClassType::from($item); if ($ref->hasAnnotation('ORM\\Entity')) { $classes[] = $em->getClassMetadata('\\' . $item); } } $tool->createSchema($classes); /** @var $installer CmsInstaller */ $installer = $this->context->createInstance('CmsModule\\Module\\Installers\\CmsInstaller'); $installer->install($this->context->venne->moduleManager->modules['cms']); } } $this->redirect('Installation:', array('backup' => NULL)); }