Skip to content

Commit 068fac3

Browse files
committed
Fix symfony bin script
1 parent 0ffde4c commit 068fac3

File tree

3 files changed

+31
-48
lines changed

3 files changed

+31
-48
lines changed

data/bin/symfony

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env php
22
<?php
33

4-
/*
5-
* This file is part of the symfony package.
6-
* (c) 2004-2006 Fabien Potencier <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
// Require composer autoloader
5+
if (file_exists(__DIR__ . '/../../../../autoload.php')) {
6+
require(__DIR__ . '/../../../../autoload.php');
7+
} else {
8+
throw new \RuntimeException('Unable to find composer autoload file, try running composer install first.');
9+
}
10+
1111

1212
// project exists?
1313
if (file_exists('config/config.php'))
@@ -25,21 +25,6 @@ if (!isset($sf_symfony_data_dir))
2525
throw new \RuntimeException('Unable to find symfony libraries due to missing config $sf_symfony_data_dir');
2626
}
2727

28-
if (isset($GLOBALS['_composer_autoload_path'])) {
29-
define('PHPUNIT_COMPOSER_INSTALL', $GLOBALS['_composer_autoload_path']);
30-
31-
unset($GLOBALS['_composer_autoload_path']);
32-
} else {
33-
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
34-
if (file_exists($file)) {
35-
define('PHPUNIT_COMPOSER_INSTALL', $file);
36-
37-
break;
38-
}
39-
}
40-
41-
unset($file);
42-
}
4328

4429
// set magic_quotes_runtime to off
4530
ini_set('magic_quotes_runtime', 'Off');
@@ -62,8 +47,6 @@ if (count($argv) <= 1)
6247
$argv[] = '-T';
6348
}
6449

65-
require_once($sf_symfony_lib_dir.'/config/sfConfig.class.php');
66-
6750
sfConfig::add(array(
6851
'sf_root_dir' => getcwd(),
6952
'sf_symfony_lib_dir' => $sf_symfony_lib_dir,

lib/vendor/phing/tasks/ext/UnzipTask.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
require_once 'phing/tasks/ext/ExtractBaseTask.php';
2222
require_once 'phing/system/io/FileSystem.php';
23-
require_once 'phing/lib/Zip.php';
23+
require_once 'phing/lib/Zip_Archive.php';
2424

2525
/**
2626
* Extracts one or several zip archive using PEAR Archive_Zip (which is presently unreleased
@@ -32,20 +32,20 @@
3232
* @since 2.2.0
3333
*/
3434
class UnzipTask extends ExtractBaseTask {
35-
35+
3636
protected function extractArchive(PhingFile $zipfile)
3737
{
3838
$extractParams = array('add_path' => $this->todir->getAbsolutePath());
3939
if(!empty($this->removepath))
4040
{
4141
$extractParams['remove_path'] = $this->removepath;
4242
}
43-
43+
4444
$this->log("Extracting zip: " . $zipfile->__toString() . ' to ' . $this->todir->__toString(), PROJECT_MSG_INFO);
45-
45+
4646
try {
4747
$zip = new Archive_Zip($zipfile->getAbsolutePath());
48-
48+
4949
$extractResponse = $zip->extract($extractParams);
5050
if(is_array($extractResponse)) {
5151
foreach ($extractResponse as $extractedPath) {
@@ -59,10 +59,10 @@ protected function extractArchive(PhingFile $zipfile)
5959
throw new BuildException($msg, $ioe, $this->getLocation());
6060
}
6161
}
62-
62+
6363
protected function listArchiveContent(PhingFile $zipfile)
6464
{
6565
$zip = new Archive_Zip($zipfile->getAbsolutePath());
6666
return $zip->listContent();
6767
}
68-
}
68+
}

lib/vendor/phing/tasks/ext/ZipTask.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
include_once 'phing/util/SourceFileScanner.php';
2424
include_once 'phing/mappers/MergeMapper.php';
2525
include_once 'phing/util/StringHelper.php';
26-
include_once 'phing/lib/Zip.php';
26+
include_once 'phing/lib/Zip_Archive.php';
2727

2828
/**
2929
* Creates a zip archive using PEAR Archive_Zip (which is presently unreleased
@@ -35,7 +35,7 @@
3535
* @since 2.1.0
3636
*/
3737
class ZipTask extends MatchingTask {
38-
38+
3939
private $zipFile;
4040
private $baseDir;
4141

@@ -73,7 +73,7 @@ public function setBasedir(PhingFile $baseDir) {
7373
* @throws BuildException
7474
*/
7575
public function main() {
76-
76+
7777
if ($this->zipFile === null) {
7878
throw new BuildException("zipfile attribute must be set!", $this->getLocation());
7979
}
@@ -89,7 +89,7 @@ public function main() {
8989
// shouldn't need to clone, since the entries in filesets
9090
// themselves won't be modified -- only elements will be added
9191
$savedFileSets = $this->filesets;
92-
92+
9393
try {
9494
if ($this->baseDir !== null) {
9595
if (!$this->baseDir->exists()) {
@@ -106,8 +106,8 @@ public function main() {
106106
throw new BuildException("You must supply either a basedir "
107107
. "attribute or some nested filesets.",
108108
$this->getLocation());
109-
}
110-
109+
}
110+
111111
// check if zip is out of date with respect to each
112112
// fileset
113113
$upToDate = true;
@@ -123,21 +123,21 @@ public function main() {
123123
}
124124
}
125125
}
126-
126+
127127
if ($upToDate) {
128128
$this->log("Nothing to do: " . $this->zipFile->__toString() . " is up to date.", PROJECT_MSG_INFO);
129129
return;
130130
}
131131

132132
$this->log("Building zip: " . $this->zipFile->__toString(), PROJECT_MSG_INFO);
133-
133+
134134
$zip = new Archive_Zip($this->zipFile->getAbsolutePath());
135-
136-
foreach($this->filesets as $fs) {
135+
136+
foreach($this->filesets as $fs) {
137137
$ds = $fs->getDirectoryScanner($this->project);
138138
$files = $ds->getIncludedFiles();
139139

140-
// FIXME
140+
// FIXME
141141
// Current model is only adding directories implicitly. This
142142
// won't add any empty directories. Perhaps modify FileSet::getFiles()
143143
// to also include empty directories. Not high priority, since non-inclusion
@@ -146,21 +146,21 @@ public function main() {
146146
$filesToZip = array();
147147
for ($i=0, $fcount=count($files); $i < $fcount; $i++) {
148148
$f = new PhingFile($fsBasedir, $files[$i]);
149-
$filesToZip[] = $f->getAbsolutePath();
149+
$filesToZip[] = $f->getAbsolutePath();
150150
}
151151
$zip->add($filesToZip, array('remove_path' => $fsBasedir->getCanonicalPath()));
152152
}
153-
154-
153+
154+
155155
} catch (IOException $ioe) {
156156
$msg = "Problem creating ZIP: " . $ioe->getMessage();
157157
$this->filesets = $savedFileSets;
158158
throw new BuildException($msg, $ioe, $this->getLocation());
159159
}
160-
160+
161161
$this->filesets = $savedFileSets;
162162
}
163-
163+
164164
/**
165165
* @param array $files array of filenames
166166
* @param PhingFile $dir
@@ -172,5 +172,5 @@ protected function archiveIsUpToDate($files, $dir) {
172172
$mm->setTo($this->zipFile->getAbsolutePath());
173173
return count($sfs->restrict($files, $dir, null, $mm)) == 0;
174174
}
175-
175+
176176
}

0 commit comments

Comments
 (0)