Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
lib/plugins/sfDoctrinePlugin/test/functional/fixtures/log/
/vendor
/composer.lock
.php-cs-fixer.cache
29 changes: 29 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

$finder = PhpCsFixer\Finder::create()
->ignoreVCSIgnored(true)
->in(__DIR__.'/lib')
->in(__DIR__.'/data/bin')
->in(__DIR__.'/test')
->append(array(__FILE__))
// Exclude PHP classes templates/generators, which are not valid PHP files
->exclude('task/generator/skeleton/')
->exclude('plugins/sfDoctrinePlugin/data/generator/')
// Exclude generated files (single files)
->notPath('unit/config/fixtures/sfDefineEnvironmentConfigHandler/prefix_result.php')
->notPath('unit/config/fixtures/sfFilterConfigHandler/result.php')
;

$config = new PhpCsFixer\Config();
$config->setRules(array(
'@PhpCsFixer' => true,
'@Symfony' => true,
'array_syntax' => array(
'syntax' => 'long',
),
))
->setCacheFile('.php-cs-fixer.cache')
->setFinder($finder)
;

return $config;
29 changes: 13 additions & 16 deletions data/bin/changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand All @@ -13,22 +13,20 @@
*
* Usage: php data/bin/changelog.php -r12345:67890 /branches/1.3
*
* @package symfony
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*
* @version SVN: $Id$
*/
require_once __DIR__.'/../../lib/task/sfFilesystem.class.php';

if (!isset($argv[1]))
{
echo "You must provide a revision range (-r123:456)\n";
exit(1);
if (!isset($argv[1])) {
echo "You must provide a revision range (-r123:456)\n";
exit(1);
}

if (!isset($argv[2]))
{
echo "You must provide a repository path (/branches/1.4)\n";
exit(1);
if (!isset($argv[2])) {
echo "You must provide a repository path (/branches/1.4)\n";
exit(1);
}

$filesystem = new sfFilesystem();
Expand All @@ -37,13 +35,12 @@
$info = new SimpleXMLElement($out);

list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', array(
$argv[1],
(string) $info->entry->repository->root.$argv[2],
$argv[1],
(string) $info->entry->repository->root.$argv[2],
))));
$log = new SimpleXMLElement($out);

foreach ($log->logentry as $logentry)
{
echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\s*\[[\d\., ]+\]\s*/', '', (string) $logentry->msg)));
echo PHP_EOL;
foreach ($log->logentry as $logentry) {
echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\s*\[[\d\., ]+\]\s*/', '', (string) $logentry->msg)));
echo PHP_EOL;
}
73 changes: 31 additions & 42 deletions data/bin/check_configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@

function is_cli()
{
return !isset($_SERVER['HTTP_HOST']);
return !isset($_SERVER['HTTP_HOST']);
}

/**
* Checks a configuration.
*/
function check($boolean, $message, $help = '', $fatal = false)
{
echo $boolean ? " OK " : sprintf("[[%s]] ", $fatal ? ' ERROR ' : 'WARNING');
echo sprintf("$message%s\n", $boolean ? '' : ': FAILED');
echo $boolean ? ' OK ' : sprintf('[[%s]] ', $fatal ? ' ERROR ' : 'WARNING');
echo sprintf("{$message}%s\n", $boolean ? '' : ': FAILED');

if (!$boolean)
{
echo " *** $help ***\n";
if ($fatal)
{
die("You must fix this problem before resuming the check.\n");
if (!$boolean) {
echo " *** {$help} ***\n";
if ($fatal) {
exit("You must fix this problem before resuming the check.\n");
}
}
}
}

/**
Expand All @@ -30,17 +28,15 @@ function check($boolean, $message, $help = '', $fatal = false)
*/
function get_ini_path()
{
if ($path = get_cfg_var('cfg_file_path'))
{
return $path;
}
if ($path = get_cfg_var('cfg_file_path')) {
return $path;
}

return 'WARNING: not using a php.ini file';
return 'WARNING: not using a php.ini file';
}

if (!is_cli())
{
echo '<html><body><pre>';
if (!is_cli()) {
echo '<html><body><pre>';
}

echo "********************************\n";
Expand All @@ -51,18 +47,16 @@ function get_ini_path()

echo sprintf("php.ini used by PHP: %s\n\n", get_ini_path());

if (is_cli())
{
echo "** WARNING **\n";
echo "* The PHP CLI can use a different php.ini file\n";
echo "* than the one used with your web server.\n";
if ('\\' == DIRECTORY_SEPARATOR)
{
echo "* (especially on the Windows platform)\n";
}
echo "* If this is the case, please launch this\n";
echo "* utility from your web server.\n";
echo "** WARNING **\n";
if (is_cli()) {
echo "** WARNING **\n";
echo "* The PHP CLI can use a different php.ini file\n";
echo "* than the one used with your web server.\n";
if ('\\' == DIRECTORY_SEPARATOR) {
echo "* (especially on the Windows platform)\n";
}
echo "* If this is the case, please launch this\n";
echo "* utility from your web server.\n";
echo "** WARNING **\n";
}

// mandatory
Expand All @@ -72,10 +66,9 @@ function get_ini_path()
// warnings
echo "\n** Optional checks **\n\n";
check(class_exists('PDO'), 'PDO is installed', 'Install PDO (mandatory for Doctrine)', false);
if (class_exists('PDO'))
{
$drivers = PDO::getAvailableDrivers();
check(count($drivers), 'PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
if (class_exists('PDO')) {
$drivers = PDO::getAvailableDrivers();
check(count($drivers), 'PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
}
check(function_exists('token_get_all'), 'The token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false);
check(function_exists('mb_strlen'), 'The mb_strlen() function is available', 'Install and enable the mbstring extension', false);
Expand All @@ -85,11 +78,8 @@ function get_ini_path()

$accelerator =
(function_exists('apc_store') && ini_get('apc.enabled'))
||
function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
||
function_exists('xcache_set')
;
|| function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
|| function_exists('xcache_set');
check($accelerator, 'A PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false);

check(!ini_get('short_open_tag'), 'php.ini has short_open_tag set to off', 'Set it to off in php.ini', false);
Expand All @@ -99,7 +89,6 @@ function_exists('xcache_set')

check(class_exists('Memcache'), 'Memcache is available', 'You must have memcache installed and enabled to use sfMemcacheCache class.', false);

if (!is_cli())
{
echo '</pre></body></html>';
if (!is_cli()) {
echo '</pre></body></html>';
}
87 changes: 38 additions & 49 deletions data/bin/release.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of the symfony package.
* (c) 2004-2007 Fabien Potencier <fabien.potencier@symfony-project.com>
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand All @@ -13,65 +13,56 @@
*
* Usage: php data/bin/release.php 1.3.0 stable
*
* @package symfony
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*
* @version SVN: $Id$
*/
require_once(__DIR__.'/../../lib/exception/sfException.class.php');
require_once(__DIR__.'/../../lib/task/sfFilesystem.class.php');
require_once(__DIR__.'/../../lib/util/sfFinder.class.php');
require_once(__DIR__.'/../../lib/vendor/lime/lime.php');

if (!isset($argv[1]))
{
throw new Exception('You must provide version prefix.');
require_once __DIR__.'/../../lib/exception/sfException.class.php';
require_once __DIR__.'/../../lib/task/sfFilesystem.class.php';
require_once __DIR__.'/../../lib/util/sfFinder.class.php';
require_once __DIR__.'/../../lib/vendor/lime/lime.php';

if (!isset($argv[1])) {
throw new Exception('You must provide version prefix.');
}

if (!isset($argv[2]))
{
throw new Exception('You must provide stability status (alpha/beta/stable).');
if (!isset($argv[2])) {
throw new Exception('You must provide stability status (alpha/beta/stable).');
}

$stability = $argv[2];

$filesystem = new sfFilesystem();

if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $argv[1])) < 2)
{
$version_prefix = $argv[1];
if (('beta' == $stability || 'alpha' == $stability) && count(explode('.', $argv[1])) < 2) {
$version_prefix = $argv[1];

list($result) = $filesystem->execute('svn status -u '.getcwd());
if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match))
{
$version = $match[1];
}
list($result) = $filesystem->execute('svn status -u '.getcwd());
if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match)) {
$version = $match[1];
}

if (!isset($version))
{
throw new Exception('Unable to find last SVN revision.');
}
if (!isset($version)) {
throw new Exception('Unable to find last SVN revision.');
}

// make a PEAR compatible version
$version = $version_prefix.'.'.$version;
}
else
{
$version = $argv[1];
// make a PEAR compatible version
$version = $version_prefix.'.'.$version;
} else {
$version = $argv[1];
}

print sprintf("Releasing symfony version \"%s\".\n", $version);
echo sprintf("Releasing symfony version \"%s\".\n", $version);

// tests
list($result) = $filesystem->execute('php data/bin/symfony symfony:test');

if (0 != $result)
{
throw new Exception('Some tests failed. Release process aborted!');
if (0 != $result) {
throw new Exception('Some tests failed. Release process aborted!');
}

if (is_file('package.xml'))
{
$filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
if (is_file('package.xml')) {
$filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
}

$filesystem->copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
Expand All @@ -80,21 +71,19 @@
$finder = sfFinder::type('file')->relative();
$xml_classes = '';
$dirs = array('lib' => 'php', 'data' => 'data');
foreach ($dirs as $dir => $role)
{
$class_files = $finder->in($dir);
foreach ($class_files as $file)
{
$xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
}
foreach ($dirs as $dir => $role) {
$class_files = $finder->in($dir);
foreach ($class_files as $file) {
$xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
}
}

// replace tokens
$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', array(
'SYMFONY_VERSION' => $version,
'CURRENT_DATE' => date('Y-m-d'),
'CLASS_FILES' => $xml_classes,
'STABILITY' => $stability,
'SYMFONY_VERSION' => $version,
'CURRENT_DATE' => date('Y-m-d'),
'CLASS_FILES' => $xml_classes,
'STABILITY' => $stability,
));

list($results) = $filesystem->execute('pear package');
Expand Down
14 changes: 6 additions & 8 deletions data/bin/sandbox_installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@

$this->logSection('install', 'add an empty file in empty directories');
$seen = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')), RecursiveIteratorIterator::CHILD_FIRST) as $path => $item)
{
if (!isset($seen[$path]) && $item->isDir() && !$item->isLink())
{
touch($item->getRealPath().'/.sf');
}

$seen[$item->getPath()] = true;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')), RecursiveIteratorIterator::CHILD_FIRST) as $path => $item) {
if (!isset($seen[$path]) && $item->isDir() && !$item->isLink()) {
touch($item->getRealPath().'/.sf');
}

$seen[$item->getPath()] = true;
}
Loading