Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgraded Symfony SE to 2.0.11 due to a security fix

  • Loading branch information...
commit 4669290c1fe090de52370779ece0c0a50144ea8d 1 parent 88e6de9
Adán Lobato adanlobato authored
Showing with 55 additions and 39 deletions.
  1. +53 −37 bin/vendors
  2. +1 −1  deps
  3. +1 −1  deps.lock
90 bin/vendors
View
@@ -24,14 +24,14 @@ Specify a command to run:
install: install vendors as specified in deps or deps.lock (recommended)
update: update vendors to their latest versions (as specified in deps)
-
+ lock: lock vendors to their current versions
EOF
);
}
-if (!in_array($command = array_shift($argv), array('install', 'update'))) {
- exit(sprintf("Command \"%s\" does not exist.\n", $command));
+if (!in_array($command = array_shift($argv), array('install', 'update', 'lock'))) {
+ exit(sprintf('Command "%s" does not exist.', $command).PHP_EOL);
}
/*
@@ -59,7 +59,7 @@ if ('install' === $command && file_exists($rootDir.'/deps.lock')) {
foreach (file($rootDir.'/deps.lock', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
$parts = array_values(array_filter(explode(' ', $line)));
if (2 !== count($parts)) {
- exit(sprintf('The deps version file is not valid (near "%s")', $line));
+ exit(sprintf('The deps version file is not valid (near "%s")', $line).PHP_EOL);
}
$versions[$parts[0]] = $parts[1];
}
@@ -68,65 +68,81 @@ if ('install' === $command && file_exists($rootDir.'/deps.lock')) {
$newversions = array();
$deps = parse_ini_file($rootDir.'/deps', true, INI_SCANNER_RAW);
if (false === $deps) {
- exit("The deps file is not valid ini syntax. Perhaps missing a trailing newline?\n");
+ exit('The deps file is not valid ini syntax. Perhaps missing a trailing newline?'.PHP_EOL);
}
foreach ($deps as $name => $dep) {
$dep = array_map('trim', $dep);
- // revision
- if (isset($versions[$name])) {
- $rev = $versions[$name];
- } else {
- $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD';
- }
-
// install dir
$installDir = isset($dep['target']) ? $vendorDir.'/'.$dep['target'] : $vendorDir.'/'.$name;
if (in_array('--reinstall', $argv)) {
- if (PHP_OS == 'WINNT') {
+ if (defined('PHP_WINDOWS_VERSION_BUILD')) {
system(sprintf('rmdir /S /Q %s', escapeshellarg(realpath($installDir))));
} else {
system(sprintf('rm -rf %s', escapeshellarg($installDir)));
}
}
- echo "> Installing/Updating $name\n";
+ if ('install' === $command || 'update' === $command) {
+ echo '> Installing/Updating '.$name.PHP_EOL;
- // url
- if (!isset($dep['git'])) {
- exit(sprintf('The "git" value for the "%s" dependency must be set.', $name));
- }
- $url = $dep['git'];
+ // url
+ if (!isset($dep['git'])) {
+ exit(sprintf('The "git" value for the "%s" dependency must be set.', $name).PHP_EOL);
+ }
+ $url = $dep['git'];
- if (!is_dir($installDir)) {
- system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
- }
+ if (!is_dir($installDir)) {
+ system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
+ }
- $status = system(sprintf('cd %s && git status --porcelain -uno', escapeshellarg($installDir)));
- if (!empty($status)) {
- exit(sprintf('"%s" has local modifications. Please revert or commit/push them before running this command again.', $name));
- }
- $current_rev = system(sprintf('cd %s && git rev-list --max-count=1 HEAD', escapeshellarg($installDir)));
- if ($current_rev === $rev) {
- continue;
- }
+ // revision
+ if (isset($versions[$name])) {
+ $rev = $versions[$name];
+ } else {
+ $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD';
+ }
- system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
+ $status = system(sprintf('cd %s && git status --porcelain', escapeshellarg($installDir)));
+ if (!empty($status)) {
+ exit(sprintf('"%s" has local modifications. Please revert or commit/push them before running this command again.', $name).PHP_EOL);
+ }
+ $current_rev = system(sprintf('cd %s && git rev-list --max-count=1 HEAD', escapeshellarg($installDir)));
+ if ($current_rev === $rev) {
+ continue;
+ }
- if ('update' === $command) {
+ system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
+ }
+
+ if ('update' === $command || 'lock' === $command) {
ob_start();
system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir)));
- $newversions[] = trim($name.' '.ob_get_clean());
+ $newversion = trim(ob_get_clean());
+
+ ob_start();
+ system(sprintf('cd %s && git name-rev --tags --name-only %s', escapeshellarg($installDir), $newversion));
+ // remove trailing ^0 from tags, those are the tags themselves
+ $niceversion = preg_replace('/\^0$/', '', trim(ob_get_clean()));
+
+ // undefined is returned in case no name-rev could be found
+ if ('undefined' !== $niceversion) {
+ $newversions[] = $name.' '.$niceversion;
+ } else {
+ $newversions[] = $name.' '.$newversion;
+ }
}
}
// update?
-if ('update' === $command) {
- file_put_contents($rootDir.'/deps.lock', implode("\n", $newversions));
+if ('update' === $command || 'lock' === $command) {
+ echo '> Updating deps.lock'.PHP_EOL;
+
+ file_put_contents($rootDir.'/deps.lock', implode("\n", $newversions)."\n");
}
// php on windows can't use the shebang line from system()
-$interpreter = PHP_OS == 'WINNT' ? 'php.exe' : '';
+$interpreter = defined('PHP_WINDOWS_VERSION_BUILD') ? 'php.exe' : '';
// Update the bootstrap files
system(sprintf('%s %s %s', $interpreter, escapeshellarg($rootDir.'/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php'), escapeshellarg($rootDir)));
@@ -135,4 +151,4 @@ system(sprintf('%s %s %s', $interpreter, escapeshellarg($rootDir.'/vendor/bundle
system(sprintf('%s %s assets:install %s', $interpreter, escapeshellarg($rootDir.'/app/console'), escapeshellarg($rootDir.'/web/')));
// Remove the cache
-system(sprintf('%s %s cache:clear --no-warmup', $interpreter, escapeshellarg($rootDir.'/app/console')));
+system(sprintf('%s %s cache:clear --no-warmup', $interpreter, escapeshellarg($rootDir.'/app/console')));
2  deps
View
@@ -1,6 +1,6 @@
[symfony]
git=http://github.com/symfony/symfony.git
- version=v2.0.10
+ version=v2.0.11
[twig]
git=http://github.com/fabpot/Twig.git
2  deps.lock
View
@@ -1,4 +1,4 @@
-symfony v2.0.10
+symfony v2.0.11
twig v1.6.0
monolog 1.0.2
doctrine-common 2.1.4
Please sign in to comment.
Something went wrong with that request. Please try again.