public function perform(Installer $installer) { $migrator = $installer->getServiceLocator()->get('Omeka\\MigrationManager'); $conn = $installer->getServiceLocator()->get('Omeka\\Connection'); $migrations = $migrator->getAvailableMigrations(); $conn->beginTransaction(); foreach ($migrations as $version => $data) { $migrator->recordMigration($version); } $conn->commit(); }
public function perform(Installer $installer) { $rdfImporter = $installer->getServiceLocator()->get('Omeka\\RdfImporter'); $entityManager = $installer->getServiceLocator()->get('Omeka\\EntityManager'); foreach ($this->vocabularies as $vocabulary) { $response = $rdfImporter->import($vocabulary['strategy'], $vocabulary['vocabulary'], ['file' => OMEKA_PATH . "/data/vocabularies/{$vocabulary['file']}", 'format' => $vocabulary['format']]); if ($response->isError()) { $installer->addErrorStore($response->getErrorStore()); return; } $entityManager->clear(); } }
public function perform(Installer $installer) { $this->setServiceLocator($installer->getServiceLocator()); foreach (array_keys($this->templates) as $label) { $this->installTemplate($label); } }
public function perform(Installer $installer) { $apiManager = $installer->getServiceLocator()->get('Omeka\\ApiManager'); $entityManager = $installer->getServiceLocator()->get('Omeka\\EntityManager'); $vars = $installer->getVars('Omeka\\Installation\\Task\\CreateFirstUserTask'); $response = $apiManager->create('users', ['o:is_active' => true, 'o:role' => 'global_admin', 'o:name' => $vars['name'], 'o:email' => $vars['email']]); if ($response->isError()) { $installer->addErrorStore($response->getErrorStore()); return; } // Set the password. $user = $response->getContent()->jsonSerialize(); $userEntity = $entityManager->find('Omeka\\Entity\\User', $user['o:id']); $userEntity->setPassword($vars['password']); $entityManager->flush(); }
public function perform(Installer $installer) { $em = $installer->getServiceLocator()->get('Omeka\\EntityManager'); $cache = $em->getConfiguration()->getMetadataCacheImpl(); if (!$cache) { return; } $cache->deleteAll(); }
public function perform(Installer $installer) { $vars = $installer->getVars('Omeka\\Installation\\Task\\AddDefaultSettingsTask'); $this->defaultSettings['administrator_email'] = $vars['administrator_email']; $this->defaultSettings['installation_title'] = $vars['installation_title']; $this->defaultSettings['time_zone'] = $vars['time_zone']; $settings = $installer->getServiceLocator()->get('Omeka\\Settings'); foreach ($this->defaultSettings as $id => $value) { $settings->set($id, $value); } }
public function perform(Installer $installer) { try { $connection = $installer->getServiceLocator()->get('Omeka\\Connection'); $connection->connect(); } catch (\Exception $e) { $installer->addError($e->getMessage()); return; } $version = $connection->getWrappedConnection()->getServerVersion(); if (version_compare($version, self::MYSQL_MINIMUM_VERSION, '<')) { $installer->addError(sprintf('Omeka requires at least MySQL version %s, but this server is running version %s.', self::MYSQL_MINIMUM_VERSION, $version)); } }
public function perform(Installer $installer) { $schemaPath = OMEKA_PATH . '/data/install/schema.sql'; if (!is_readable($schemaPath)) { $installer->addError('Could not read the schema installation file.'); return; } $schema = file_get_contents($schemaPath); $statements = explode(';', $schema); $connection = $installer->getServiceLocator()->get('Omeka\\Connection'); try { foreach ($statements as $statement) { $statement = trim($statement); if ('' === $statement) { continue; } $connection->exec($statement); } } catch (DBALException $e) { $installer->addError($e->getMessage()); return; } }