本文整理汇总了PHP中SymfonyRequirements::getRequirements方法的典型用法代码示例。如果您正苦于以下问题:PHP SymfonyRequirements::getRequirements方法的具体用法?PHP SymfonyRequirements::getRequirements怎么用?PHP SymfonyRequirements::getRequirements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymfonyRequirements
的用法示例。
在下文中一共展示了SymfonyRequirements::getRequirements方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAction
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));
}
示例2: getRequirements
/**
* {@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;
}
示例3: requirementsAction
/**
* 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));
}
示例4: aboutAction
/**
* 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));
}
示例5: dirname
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', '.');
示例6: checkSymfonyRequirements
/**
* 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;
}
示例7: checkSymfonyRequirements
/**
* 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;
}
示例8: requirementsAction
/**
* 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));
}
示例9: execute
/**
* @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>');
}
示例10: dirname
* @author Paweł Mikołajczuk <pawel.mikolajczuk@sourcefabric.org>
* @author Rafał Muszyński <rafal.muszynski@sourcefabric.org>
* @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.";