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);
     }
 }
Example #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();
 }