Exemplo n.º 1
0
 public function checkAction()
 {
     $data['page'] = 'check';
     require_once __DIR__ . '/../../../../app/SymfonyRequirements.php';
     $symfonyRequirements = new \SymfonyRequirements();
     $iniPath = $symfonyRequirements->getPhpIniConfigPath();
     $data['result'] = '
     <div class="alert alert-warning"><ul>
     ' . ($iniPath ? sprintf("<li>Configuration file used by PHP: %s</li>", $iniPath) : "<li>WARNING: No configuration file (php.ini) used by PHP!</li>") . '<li>The PHP CLI can use a different php.ini file</li>
     <li>than the one used with your web server.</li>';
     if ('\\' == DIRECTORY_SEPARATOR) {
         $data['result'] .= '<li>(especially on the Windows platform)</li>';
     }
     $data['result'] .= '<li>To be on the safe side, please also launch the requirements check</li>
     <li>from your web server using the web/config.php script.</li>
     </ul></div>';
     $data['result'] .= '<div class="table-responsive"><table id="checkTable" class="table table-striped">';
     $checkPassed = true;
     foreach ($symfonyRequirements->getRequirements() as $req) {
         /** @var $req Requirement */
         $data['result'] .= $this->echo_requirement($req);
         if (!$req->isFulfilled()) {
             $checkPassed = false;
         }
     }
     foreach ($symfonyRequirements->getRecommendations() as $req) {
         $data['result'] .= $this->echo_requirement($req);
     }
     $data['result'] .= '</table></div>';
     return $this->render('OjsInstallerBundle:Default:check.html.twig', array('data' => $data));
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getRequirements()
 {
     $requirements = parent::getRequirements();
     foreach ($requirements as $key => $requirement) {
         $testMessage = $requirement->getTestMessage();
         if (preg_match_all(self::EXCLUDE_REQUIREMENTS_MASK, $testMessage, $matches)) {
             unset($requirements[$key]);
         }
     }
     return $requirements;
 }
 /**
  * Check System Requirements
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function requirementsAction()
 {
     // include symfony requirements class
     require_once dirname(__FILE__) . '/../../../../app/SymfonyRequirements.php';
     $symfonyRequirements = new \SymfonyRequirements();
     // add additional requirement for mcrypt
     $symfonyRequirements->addRequirement(extension_loaded('mcrypt'), "Check if mcrypt ist loaded for RSA encryption", "Please enable mcrypt-Extension. See <a href='http://php.net/manual/de/mcrypt.setup.php'>http://php.net/manual/de/mcrypt.setup.php</a>");
     // fetch all data
     $aRequirements = $symfonyRequirements->getRequirements();
     $aRecommendations = $symfonyRequirements->getRecommendations();
     $aFailedRequirements = $symfonyRequirements->getFailedRequirements();
     $aFailedRecommendations = $symfonyRequirements->getFailedRecommendations();
     $iniPath = $symfonyRequirements->getPhpIniConfigPath();
     // render template
     return $this->render('SlashworksBackendBundle:Install:requirements.html.twig', array("iniPath" => $iniPath, "requirements" => $aRequirements, "recommendations" => $aRecommendations, "failedrequirements" => $aFailedRequirements, "failedrecommendations" => $aFailedRecommendations));
 }
Exemplo n.º 4
0
 /**
  * Display form for license activation
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function aboutAction()
 {
     $oLicense = LicenseQuery::create()->findOne();
     // include symfony requirements class
     require_once dirname(__FILE__) . '/../../../../app/SymfonyRequirements.php';
     $symfonyRequirements = new \SymfonyRequirements();
     // add additional requirement for mcrypt
     $symfonyRequirements->addRequirement(extension_loaded('mcrypt'), "Check if mcrypt ist loaded for RSA encryption", "Please enable mcrypt-Extension. See <a href='http://php.net/manual/de/mcrypt.setup.php'>http://php.net/manual/de/mcrypt.setup.php</a>");
     // fetch all data
     $aRequirements = $symfonyRequirements->getRequirements();
     $aRecommendations = $symfonyRequirements->getRecommendations();
     $aFailedRequirements = $symfonyRequirements->getFailedRequirements();
     $aFailedRecommendations = $symfonyRequirements->getFailedRecommendations();
     $iniPath = $symfonyRequirements->getPhpIniConfigPath();
     $sVersion = file_get_contents(dirname(__FILE__) . '/../../../../version.txt');
     return $this->render('SlashworksAppBundle:About:about.html.twig', array("license" => $oLicense, "version" => $sVersion, "iniPath" => $iniPath, "requirements" => $aRequirements, "recommendations" => $aRecommendations, "failedrequirements" => $aFailedRequirements, "failedrecommendations" => $aFailedRecommendations));
 }
Exemplo n.º 5
0
require_once dirname(__FILE__) . '/SymfonyRequirements.php';
$lineSize = 70;
$symfonyRequirements = new SymfonyRequirements();
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
echo_title('Symfony2 Requirements Checker');
echo '> PHP is using the following php.ini file:' . PHP_EOL;
if ($iniPath) {
    echo_style('green', '  ' . $iniPath);
} else {
    echo_style('warning', '  WARNING: No configuration file (php.ini) used by PHP!');
}
echo PHP_EOL . PHP_EOL;
echo '> Checking Symfony requirements:' . PHP_EOL . '  ';
$messages = array();
foreach ($symfonyRequirements->getRequirements() as $req) {
    /** @var $req Requirement */
    if ($helpText = get_error_message($req, $lineSize)) {
        echo_style('red', 'E');
        $messages['error'][] = $helpText;
    } else {
        echo_style('green', '.');
    }
}
$checkPassed = empty($messages['error']);
foreach ($symfonyRequirements->getRecommendations() as $req) {
    if ($helpText = get_error_message($req, $lineSize)) {
        echo_style('yellow', 'W');
        $messages['warning'][] = $helpText;
    } else {
        echo_style('green', '.');
Exemplo n.º 6
0
 /**
  * Checks if environment meets symfony requirements.
  *
  * @return $this
  */
 protected function checkSymfonyRequirements()
 {
     if (null === ($requirementsFile = $this->getSymfonyRequirementsFilePath())) {
         return $this;
     }
     try {
         require $requirementsFile;
         $symfonyRequirements = new \SymfonyRequirements();
         $this->requirementsErrors = array();
         foreach ($symfonyRequirements->getRequirements() as $req) {
             if ($helpText = $this->getErrorMessage($req)) {
                 $this->requirementsErrors[] = $helpText;
             }
         }
     } catch (MethodArgumentValueNotImplementedException $e) {
         // workaround https://github.com/symfony/symfony-installer/issues/163
     }
     return $this;
 }
Exemplo n.º 7
0
 /**
  * Checks if environment meets symfony requirements.
  *
  * @return $this
  */
 protected function checkSymfonyRequirements()
 {
     try {
         $requirementsDir = $this->isSymfony3() ? 'var' : 'app';
         require $this->projectDir . '/' . $requirementsDir . '/SymfonyRequirements.php';
         $symfonyRequirements = new \SymfonyRequirements();
         $this->requirementsErrors = array();
         foreach ($symfonyRequirements->getRequirements() as $req) {
             if ($helpText = $this->getErrorMessage($req)) {
                 $this->requirementsErrors[] = $helpText;
             }
         }
     } catch (MethodArgumentValueNotImplementedException $e) {
         // workaround https://github.com/symfony/symfony-installer/issues/163
     }
     return $this;
 }
Exemplo n.º 8
0
 /**
  * Check if system complies
  *
  * @return Response A Response instance
  */
 public function requirementsAction()
 {
     $symfonyRequirements = new \SymfonyRequirements();
     $requirements = $symfonyRequirements->getRequirements();
     return $this->render("JumphInstallerBundle:Install:requirements.html.twig", array('requirements' => $requirements));
 }
 /**
  * @see Console\Command\Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $container = $this->getApplication()->getKernel()->getContainer();
     $output->writeln('<info>Welcome to Newscoop Installer.<info>');
     $symfonyRequirements = new \SymfonyRequirements();
     $requirements = $symfonyRequirements->getRequirements();
     $missingReq = array();
     foreach ($requirements as $req) {
         if (!$req->isFulfilled()) {
             $missingReq[] = $req->getTestMessage() . ' - ' . $req->getHelpText();
         }
     }
     $fixCommonIssues = $input->getOption('fix');
     if (count($missingReq) > 0 && !$fixCommonIssues) {
         $output->writeln('<info>Before we start we need to fix some requirements.<info>');
         $output->writeln('<info>Please read all messages and try to fix them:<info>');
         foreach ($missingReq as $value) {
             $output->writeln('<error>' . $value . '<error>');
         }
         $output->writeln('<error>Use --fix param to fix those errors<error>');
         return;
     } elseif (count($missingReq) > 0 && $fixCommonIssues) {
         $newscoopDir = realpath(__DIR__ . '/../../../../../');
         // set chmods for directories
         exec('chmod -R 777 ' . $newscoopDir . '/cache/');
         exec('chmod -R 777 ' . $newscoopDir . '/log/');
         exec('chmod -R 777 ' . $newscoopDir . '/conf/');
         exec('chmod -R 777 ' . $newscoopDir . '/library/Proxy/');
         exec('chmod -R 777 ' . $newscoopDir . '/themes/');
         exec('chmod -R 777 ' . $newscoopDir . '/plugins/');
         exec('chmod -R 777 ' . $newscoopDir . '/public/');
         exec('chmod -R 777 ' . $newscoopDir . '/images/');
     }
     $dbParams = array('driver' => 'pdo_mysql', 'charset' => 'utf8', 'host' => $input->getOption('database_server_name'), 'dbname' => $input->getOption('database_name'), 'port' => $input->getOption('database_server_port'));
     if ($input->getOption('database_user')) {
         $dbParams['user'] = $input->getOption('database_user');
     }
     if ($input->getOption('database_password')) {
         $dbParams['password'] = $input->getOption('database_password');
     }
     $databaseService = new Services\DatabaseService($container->get('logger'));
     $finishService = new Services\FinishService();
     $demositeService = new Services\DemositeService($container->get('logger'));
     $connection = DriverManager::getConnection($dbParams);
     try {
         $connection->connect();
         if ($connection->getDatabase() === null) {
             $databaseService->createNewscoopDatabase($connection);
         }
     } catch (\Exception $e) {
         if ($e->getCode() == '1049') {
             $databaseService->createNewscoopDatabase($connection);
         } elseif (strpos($e->getMessage(), 'database exists') === false) {
             throw $e;
         }
     }
     $output->writeln('<info>Successfully connected to database.<info>');
     $tables = $connection->fetchAll('SHOW TABLES', array());
     if (count($tables) == 0 || $input->getOption('database_override')) {
         $databaseService->fillNewscoopDatabase($connection);
         $databaseService->loadGeoData($connection);
         $databaseService->saveDatabaseConfiguration($connection);
     } else {
         throw new \Exception('There is already a database named ' . $connection->getDatabase() . '. If you are sure to overwrite it, use option --database_override. If not, just change the Database Name and continue.', 1);
     }
     $command = $this->getApplication()->find('cache:clear');
     $arguments = array('command' => 'cache:clear', '--no-warmup' => true);
     $inputCache = new ArrayInput($arguments);
     $command->run($inputCache, $output);
     $databaseService->installDatabaseSchema($connection, $input->getArgument('alias'), $input->getArgument('site_title'));
     $output->writeln('<info>Database schema has been processed successfully.<info>');
     $demositeService->installEmptyTheme();
     $output->writeln('<info>Empty theme has been installed successfully.<info>');
     $clearEm = \Doctrine\ORM\EntityManager::create($connection, $container->get('em')->getConfiguration(), $connection->getEventManager());
     $finishService->saveCronjobs(new \Newscoop\Services\SchedulerService($clearEm));
     $output->writeln('<info>Cronjobs have been saved successfully<info>');
     $finishService->generateProxies();
     $output->writeln('<info>Proxies have been generated successfully<info>');
     $finishService->installAssets();
     $output->writeln('<info>Assets have been installed successfully<info>');
     $finishService->saveInstanceConfig(array('site_title' => $input->getArgument('site_title'), 'user_email' => $input->getArgument('user_email'), 'recheck_user_password' => $input->getArgument('user_password')), $connection);
     $output->writeln('<info>Config have been saved successfully.<info>');
     if (!$input->getOption('no-client')) {
         $finishService->createDefaultOauthClient($input->getArgument('alias'));
         $output->writeln('<info>Default OAuth client has been created successfully.<info>');
     }
     $output->writeln('<info>Newscoop is installed.<info>');
 }
Exemplo n.º 10
0
 * @author Paweł Mikołajczuk <*****@*****.**>
 * @author Rafał Muszyński <*****@*****.**>
 * @copyright 2013 Sourcefabric o.p.s.
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
 */
if (!file_exists(__DIR__ . '/../vendor') && !file_exists(__DIR__ . '/../vendor/autoload.php')) {
    echo "Welcome to Newscoop Installer!<br/><br/>";
    echo "It doesn't look like you've installed vendors yet. Please install all dependencies using Composer.";
    echo "<pre>curl -s https://getcomposer.org/installer | php <br/>php composer.phar install --no-dev</pre>";
    echo "When it's done, please refresh this page. Thanks!";
    die;
}
require_once __DIR__ . '/../vendor/autoload.php';
require_once dirname(__FILE__) . '/SymfonyRequirements.php';
$symfonyRequirements = new SymfonyRequirements();
$requirements = $symfonyRequirements->getRequirements();
$missingReq = array();
foreach ($requirements as $req) {
    if (!$req->isFulfilled()) {
        $missingReq[] = $req->getTestMessage() . '<br />      ' . $req->getHelpText() . '<br />';
    }
}
if (count($missingReq) > 0) {
    echo "Welcome to Newscoop Installer!<br/><br/>";
    echo "Before we will show You a real installer we need to fix some requirements first.<br />Please read all messages and try to fix them:<br />";
    echo "<pre>";
    foreach ($missingReq as $value) {
        echo $value . ' <br />';
    }
    echo "</pre>";
    $phpFile = php_ini_loaded_file() ?: "File couldn't be found.";