コード例 #1
0
 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();
     }
 }
コード例 #2
0
 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();
 }