public function forwardAction(ProcessContextInterface $context)
 {
     $adminUser = $this->getDoctrine()->getRepository('OroUserBundle:User')->findOneBy(array('username' => LoadAdminUserData::DEFAULT_ADMIN_USERNAME));
     if (!$adminUser) {
         throw new \RuntimeException("Admin user wasn't loaded in fixtures.");
     }
     $form = $this->createForm('diamante_installer_setup');
     $form->setData($adminUser);
     $form->handleRequest($this->getRequest());
     if ($form->isValid()) {
         $context->getStorage()->set('loadFixtures', false);
         $this->get('oro_user.manager')->updateUser($adminUser);
         /** @var ConfigManager $configManager */
         $configManager = $this->get('oro_config.global');
         $defaultOrganizationName = $configManager->get('oro_ui.organization_name');
         $organizationName = $form->get('organization_name')->getData();
         if (!empty($organizationName) && $organizationName !== $defaultOrganizationName) {
             $organizationManager = $this->get('oro_organization.organization_manager');
             $organization = $organizationManager->getOrganizationByName('default');
             $organization->setName($organizationName);
             $organizationManager->updateOrganization($organization);
         }
         $defaultAppURL = $configManager->get('oro_ui.application_url');
         $applicationURL = $form->get('application_url')->getData();
         if (!empty($applicationURL) && $applicationURL !== $defaultAppURL) {
             $configManager->set('oro_ui.application_url', $applicationURL);
         }
         $configManager->flush();
         $this->runCommand('diamante:desk:data');
         $this->runCommand('oro:migration:data:load', ['--bundles' => ['DiamanteDistributionBundle']]);
         return $this->complete();
     }
     return $this->render('DiamanteDistributionBundle:Process/Step:setup.html.twig', array('form' => $form->createView()));
 }
示例#2
0
 public function displayAction(ProcessContextInterface $context)
 {
     set_time_limit(600);
     switch ($this->getRequest()->query->get('action')) {
         case 'cache':
             // suppress warning: ini_set(): A session is active. You cannot change the session
             // module's ini settings at this time
             error_reporting(E_ALL ^ E_WARNING);
             return $this->handleAjaxAction('cache:clear', array('--no-optional-warmers' => true));
             /*case 'clear-config':
               return $this->handleAjaxAction('oro:entity-config:cache:clear', array('--no-warmup' => true));*/
             /*case 'clear-extend':
               return $this->handleAjaxAction('oro:entity-extend:cache:clear', array('--no-warmup' => true));*/
         /*case 'clear-config':
           return $this->handleAjaxAction('oro:entity-config:cache:clear', array('--no-warmup' => true));*/
         /*case 'clear-extend':
           return $this->handleAjaxAction('oro:entity-extend:cache:clear', array('--no-warmup' => true));*/
         case 'schema-drop':
             return $this->handleAjaxAction('doctrine:schema:drop', array('--force' => true, '--full-database' => $context->getStorage()->get('fullDatabase', false)));
         case 'schema-update':
             // Creating identities:
             return $this->handleAjaxAction('doctrine:schema:update', array('--force' => true));
             // Run migrations
             return $this->handleAjaxAction('oro:migration:load', array('--force' => true));
         case 'fixtures':
             return $this->handleAjaxAction('oro:migration:data:load', array('--no-interaction' => true));
             /*case 'workflows':
                   return $this->handleAjaxAction('oro:workflow:definitions:load');
               case 'processes':
                   return $this->handleAjaxAction('oro:process:configuration:load');*/
     }
     return $this->render('ChamiloInstallerBundle:Process/Step:schema.html.twig', ['is_upgrade' => $this->isCommonUpgrade(), 'scenario' => $this->getScenario()]);
 }
示例#3
0
 /**
  * @param ProcessContextInterface $context
  * @return JsonResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function displayAction(ProcessContextInterface $context)
 {
     set_time_limit(900);
     $action = $this->getRequest()->query->get('action');
     switch ($action) {
         case 'pages':
             $this->handleAjaxAction('sonata:page:update-core-routes', array('--site' => array('all')));
             return $this->handleAjaxAction('sonata:page:create-snapshots', array('--site' => array('all')));
         case 'fixtures':
             return $this->handleAjaxAction('oro:migration:data:load', array('--fixtures-type' => 'demo'));
         case 'navigation':
             return $this->handleAjaxAction('oro:navigation:init');
             //            case 'js-routing':
             //                return $this->handleAjaxAction('fos:js-routing:dump', array('--target' => 'js/routes.js'));
         //            case 'js-routing':
         //                return $this->handleAjaxAction('fos:js-routing:dump', array('--target' => 'js/routes.js'));
         case 'localization':
             //return $this->handleAjaxAction('oro:localization:dump');
         //return $this->handleAjaxAction('oro:localization:dump');
         case 'assets':
             /*return $this->handleAjaxAction(
                   'oro:assets:install',
                   array('target' => './', '--exclude' => ['OroInstallerBundle'])
               );*/
             $settingsManager = $this->container->get('chamilo.settings.manager');
             $url = $this->container->get('doctrine')->getRepository('ChamiloCoreBundle:AccessUrl')->find(1);
             $settingsManager->installSchemas($url);
             return $this->handleAjaxAction('assets:install', array('target' => './', '--symlink' => true, '--relative' => true));
         case 'assetic':
             return $this->handleAjaxAction('assetic:dump');
         case 'translation':
             //return $this->handleAjaxAction('oro:translation:dump');
         //return $this->handleAjaxAction('oro:translation:dump');
         case 'requirejs':
             //return $this->handleAjaxAction('oro:requirejs:build', array('--ignore-errors' => true));
         //return $this->handleAjaxAction('oro:requirejs:build', array('--ignore-errors' => true));
         case 'finish':
             $this->get('event_dispatcher')->dispatch(InstallerEvents::FINISH);
             // everything was fine - update installed flag in parameters.yml
             $dumper = $this->get('chamilo_installer.yaml_persister');
             $params = $dumper->parse();
             $params['system']['installed'] = date('c');
             $dumper->dump($params);
             // launch 'cache:clear' to set installed flag in DI container
             // suppress warning: ini_set(): A session is active. You cannot change the session
             // module's ini settings at this time
             error_reporting(E_ALL ^ E_WARNING);
             return $this->handleAjaxAction('cache:clear', array('--env' => 'prod', '--no-debug' => true));
     }
     // check if we have package installation step
     if (strpos($action, 'installerScript-') !== false) {
         $scriptFile = $this->container->get('chamilo_installer.script_manager')->getScriptFileByKey(str_replace('installerScript-', '', $action));
         $scriptExecutor = new ScriptExecutor($this->getOutput(), $this->container, new CommandExecutor($this->container->getParameter('kernel.environment'), $this->getOutput(), $this->getApplication()));
         $scriptExecutor->runScript($scriptFile);
         return new JsonResponse(array('result' => true));
     }
     return $this->render('ChamiloInstallerBundle:Process/Step:installation.html.twig', array('loadFixtures' => $context->getStorage()->get('loadFixtures'), 'installerScripts' => $this->container->get('chamilo_installer.script_manager')->getScriptLabels()));
 }
 public function displayAction(ProcessContextInterface $context)
 {
     set_time_limit(600);
     switch ($this->getRequest()->query->get('action')) {
         case 'cache':
             // suppress warning: ini_set(): A session is active. You cannot change the session
             // module's ini settings at this time
             error_reporting(E_ALL ^ E_WARNING);
             return $this->handleAjaxAction('cache:clear', ['--no-optional-warmers' => true]);
         case 'clear-config':
             return $this->handleAjaxAction('oro:entity-config:cache:clear', ['--no-warmup' => true]);
         case 'clear-extend':
             return $this->handleAjaxAction('oro:entity-extend:cache:clear', ['--no-warmup' => true]);
         case 'schema-drop':
             return $this->handleAjaxAction('doctrine:schema:drop', ['--force' => true, '--full-database' => $context->getStorage()->get('fullDatabase', false)]);
         case 'schema-update':
             return $this->handleSchemaUpdate();
         case 'workflows':
             return $this->handleAjaxAction('oro:workflow:definitions:load');
         case 'processes':
             return $this->handleAjaxAction('oro:process:configuration:load');
         case 'fixtures':
             return $this->handleFixtures();
         case 'navigation':
             return $this->handleAjaxAction('oro:navigation:init');
         case 'js-routing':
             return $this->handleAjaxAction('fos:js-routing:dump', ['--target' => 'js/routes.js']);
         case 'localization':
             return $this->handleAjaxAction('oro:localization:dump');
         case 'assets':
             return $this->handleAjaxAction('oro:assets:install', array('target' => './', '--symlink', '--exclude' => ['OroInstallerBundle']));
         case 'assetic':
             return $this->handleAjaxAction('assetic:dump');
         case 'translation':
             return $this->handleAjaxAction('oro:translation:dump');
         case 'requirejs':
             return $this->handleAjaxAction('oro:requirejs:build', ['--ignore-errors' => true]);
         case 'finish':
             $this->get('event_dispatcher')->dispatch(InstallerEvents::FINISH);
             // everything was fine - update installed flag in parameters.yml
             $dumper = $this->get('oro_installer.yaml_persister');
             $params = $dumper->parse();
             $params['system']['installed'] = date('c');
             $dumper->dump($params);
             // launch 'cache:clear' to set installed flag in DI container
             // suppress warning: ini_set(): A session is active. You cannot change the session
             // module's ini settings at this time
             error_reporting(E_ALL ^ E_WARNING);
             return $this->handleAjaxAction('cache:clear');
     }
     return $this->render('DiamanteDistributionBundle:Process/Step:initialization.html.twig');
 }
示例#5
0
 public function forwardAction(ProcessContextInterface $context)
 {
     set_time_limit(600);
     $form = $this->createConfigurationForm();
     $form->handleRequest($this->getRequest());
     if ($form->isValid()) {
         $data = $form->getData();
         $context->getStorage()->set('fullDatabase', $form->has('database') && $form->get('database')->has('chamilo_installer_database_drop_full') && $form->get('database')->get('chamilo_installer_database_drop_full')->getData());
         $this->get('chamilo_installer.yaml_persister')->dump($data);
         return $this->complete();
     }
     return $this->render('ChamiloInstallerBundle:Process/Step:configure.html.twig', array('form' => $form->createView()));
 }
 public function forwardAction(ProcessContextInterface $context)
 {
     $form = $this->createForm('oro_installer_setup');
     $form->handleRequest($this->getRequest());
     if ($form->isValid()) {
         // pass "load demo fixtures" flag to the next step
         $context->getStorage()->set('loadFixtures', $form->has('loadFixtures') && $form->get('loadFixtures')->getData());
         $user = $form->getData();
         $role = $this->getDoctrine()->getRepository('OroUserBundle:Role')->findOneBy(array('role' => 'ROLE_ADMINISTRATOR'));
         $businessUnit = $this->getDoctrine()->getRepository('OroOrganizationBundle:BusinessUnit')->findOneBy(array('name' => 'Main'));
         $user->setEnabled(true)->setOwner($businessUnit)->addBusinessUnit($businessUnit)->addRole($role);
         $this->get('oro_user.manager')->updateUser($user);
         return $this->complete();
     }
     return $this->render('OroInstallerBundle:Process/Step:setup.html.twig', array('form' => $form->createView()));
 }
示例#7
0
 /**
  * @param ProcessContextInterface $context
  *
  * @return mixed
  */
 protected function handleDropDatabase(ProcessContextInterface $context)
 {
     $dropDatabase = $context->getStorage()->get('dropDatabase', 'none');
     if ($dropDatabase === 'app') {
         $exitCode = 0;
         $managers = $this->get('doctrine')->getManagers();
         foreach ($managers as $name => $manager) {
             if ($manager instanceof EntityManager) {
                 $exitCode = $this->runCommand('doctrine:schema:drop', array('--force' => true, '--em' => $name));
                 if ($exitCode) {
                     break;
                 }
             }
         }
         return $this->getAjaxActionResponse($exitCode);
     } elseif ($dropDatabase === 'full') {
         return $this->handleAjaxAction('doctrine:schema:drop', array('--force' => true, '--full-database' => true));
     } else {
         return true;
     }
 }
 public function displayAction(ProcessContextInterface $context)
 {
     set_time_limit(900);
     switch ($this->getRequest()->query->get('action')) {
         case 'fixtures':
             return $this->handleAjaxAction('oro:demo:fixtures:load');
         case 'search':
             return $this->handleAjaxAction('oro:search:create-index');
         case 'navigation':
             return $this->handleAjaxAction('oro:navigation:init');
         case 'js-routing':
             return $this->handleAjaxAction('fos:js-routing:dump', array('--target' => 'js/routes.js'));
         case 'localization':
             return $this->handleAjaxAction('oro:localization:dump');
         case 'assets':
             return $this->handleAjaxAction('assets:install', array('target' => './'));
         case 'assetic':
             return $this->handleAjaxAction('assetic:dump');
         case 'assetic-oro':
             return $this->handleAjaxAction('oro:assetic:dump');
         case 'translation':
             return $this->handleAjaxAction('oro:translation:dump');
         case 'requirejs':
             return $this->handleAjaxAction('oro:requirejs:build');
         case 'finish':
             $this->get('event_dispatcher')->dispatch(InstallerEvents::FINISH);
             // everything was fine - update installed flag in parameters.yml
             $dumper = $this->get('oro_installer.yaml_persister');
             $params = $dumper->parse();
             $params['system']['installed'] = date('c');
             $dumper->dump($params);
             // launch 'cache:clear' to set installed flag in DI container
             // suppress warning: ini_set(): A session is active. You cannot change the session
             // module's ini settings at this time
             error_reporting(E_ALL ^ E_WARNING);
             return $this->handleAjaxAction('cache:clear');
     }
     return $this->render('OroInstallerBundle:Process/Step:installation.html.twig', array('loadFixtures' => $context->getStorage()->get('loadFixtures')));
 }