@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -define('PACKAGE_ROOT' , dirname(__DIR__).'/'); |
|
| 4 | -require_once(PACKAGE_ROOT . 'src/SSPak.php'); |
|
| 3 | +define('PACKAGE_ROOT', dirname(__DIR__).'/'); |
|
| 4 | +require_once(PACKAGE_ROOT.'src/SSPak.php'); |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * Confirm that the compile binary executes |
@@ -8,16 +8,16 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | function __construct($path, $executor, $pharAlias = 'sspak.phar') { |
| 10 | 10 | parent::__construct($path, $executor); |
| 11 | - if(!$this->isLocal()) throw new LogicException("Can't manipulate remote .sspak.phar files, only remote webroots."); |
|
| 11 | + if (!$this->isLocal()) throw new LogicException("Can't manipulate remote .sspak.phar files, only remote webroots."); |
|
| 12 | 12 | |
| 13 | 13 | $this->pharAlias = $pharAlias; |
| 14 | 14 | $this->pharPath = $path; |
| 15 | 15 | |
| 16 | 16 | // Executable Phar version |
| 17 | - if(substr($path,-5) === '.phar') { |
|
| 17 | + if (substr($path, -5) === '.phar') { |
|
| 18 | 18 | $this->phar = new Phar($path, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, |
| 19 | 19 | $this->pharAlias); |
| 20 | - if(!file_exists($this->path)) $this->makeExecutable(); |
|
| 20 | + if (!file_exists($this->path)) $this->makeExecutable(); |
|
| 21 | 21 | |
| 22 | 22 | // Non-executable Tar version |
| 23 | 23 | } else { |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | * Add the SSPak executable information into this SSPak file |
| 35 | 35 | */ |
| 36 | 36 | function makeExecutable() { |
| 37 | - if(ini_get('phar.readonly')) { |
|
| 37 | + if (ini_get('phar.readonly')) { |
|
| 38 | 38 | throw new Exception("Please set phar.readonly to false in your php.ini."); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - passthru("composer install -d " . escapeshellarg(PACKAGE_ROOT) . " --no-dev"); |
|
| 41 | + passthru("composer install -d ".escapeshellarg(PACKAGE_ROOT)." --no-dev"); |
|
| 42 | 42 | |
| 43 | 43 | $root = PACKAGE_ROOT; |
| 44 | 44 | $srcRoots = [ |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | ]; |
| 48 | 48 | |
| 49 | 49 | // Add the bin file, but strip of the #! exec header. |
| 50 | - $this->phar['bin/sspak'] = preg_replace("/^#!\/usr\/bin\/env php\n/", '', file_get_contents($root . "bin/sspak")); |
|
| 50 | + $this->phar['bin/sspak'] = preg_replace("/^#!\/usr\/bin\/env php\n/", '', file_get_contents($root."bin/sspak")); |
|
| 51 | 51 | |
| 52 | - foreach($srcRoots as $srcRoot) { |
|
| 53 | - foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root . $srcRoot)) as $fileObj) { |
|
| 54 | - if($fileObj->isFile()) { |
|
| 52 | + foreach ($srcRoots as $srcRoot) { |
|
| 53 | + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root.$srcRoot)) as $fileObj) { |
|
| 54 | + if ($fileObj->isFile()) { |
|
| 55 | 55 | $file = $fileObj->getRealPath(); |
| 56 | 56 | |
| 57 | 57 | $relativeFile = str_replace($root, '', $file); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $this->phar->setStub($stub); |
| 75 | 75 | chmod($this->path, 0775); |
| 76 | 76 | |
| 77 | - passthru("composer install -d " . escapeshellarg(PACKAGE_ROOT)); |
|
| 77 | + passthru("composer install -d ".escapeshellarg(PACKAGE_ROOT)); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | // Non-executable Phars can't have content streamed into them |
| 104 | 104 | // This means that we need to create a temp file, which is a pain, if that file happens to be a 3GB |
| 105 | 105 | // asset dump. :-/ |
| 106 | - if($this->phar instanceof PharData) { |
|
| 107 | - $tmpFile = '/tmp/sspak-content-' .rand(100000,999999); |
|
| 106 | + if ($this->phar instanceof PharData) { |
|
| 107 | + $tmpFile = '/tmp/sspak-content-'.rand(100000, 999999); |
|
| 108 | 108 | $process->exec(array('outputFile' => $tmpFile)); |
| 109 | 109 | $this->phar->addFile($tmpFile, $filename); |
| 110 | 110 | unlink($tmpFile); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @return Stream context |
| 124 | 124 | */ |
| 125 | 125 | function writeStreamForFile($filename) { |
| 126 | - return fopen('phar://' . $this->pharAlias . '/' . $filename, 'w'); |
|
| 126 | + return fopen('phar://'.$this->pharAlias.'/'.$filename, 'w'); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | function readStreamForFile($filename) { |
| 135 | 135 | // Note: using pharAlias here doesn't work on Debian Wheezy (nor on Windows for that matter). |
| 136 | 136 | //return fopen('phar://' . $this->pharAlias . '/' . $filename, 'r'); |
| 137 | - return fopen('phar://' . $this->pharPath . '/' . $filename, 'r'); |
|
| 137 | + return fopen('phar://'.$this->pharPath.'/'.$filename, 'r'); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | function gitRemoteDetails() { |
| 154 | 154 | $content = $this->content('git-remote'); |
| 155 | 155 | $details = array(); |
| 156 | - foreach(explode("\n", trim($content)) as $line) { |
|
| 157 | - if(!$line) continue; |
|
| 156 | + foreach (explode("\n", trim($content)) as $line) { |
|
| 157 | + if (!$line) continue; |
|
| 158 | 158 | |
| 159 | - if(preg_match('/^([^ ]+) *= *(.*)$/', $line, $matches)) { |
|
| 159 | + if (preg_match('/^([^ ]+) *= *(.*)$/', $line, $matches)) { |
|
| 160 | 160 | $details[$matches[1]] = $matches[2]; |
| 161 | 161 | } else { |
| 162 | 162 | throw new Exception("Bad line '$line'"); |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Argument parsing |
| 10 | -if(empty($_SERVER['argv'][1])) { |
|
| 10 | +if (empty($_SERVER['argv'][1])) { |
|
| 11 | 11 | echo "Usage: {$_SERVER['argv'][0]} (site-docroot)\n"; |
| 12 | 12 | exit(1); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $basePath = $_SERVER['argv'][1]; |
| 16 | -if($basePath[0] != '/') $basePath = getcwd() . '/' . $basePath; |
|
| 16 | +if ($basePath[0] != '/') $basePath = getcwd().'/'.$basePath; |
|
| 17 | 17 | |
| 18 | 18 | // SilverStripe bootstrap |
| 19 | 19 | define('BASE_PATH', $basePath); |
@@ -23,24 +23,24 @@ discard block |
||
| 23 | 23 | $_SERVER['HTTP_HOST'] = 'localhost'; |
| 24 | 24 | chdir(BASE_PATH); |
| 25 | 25 | |
| 26 | -if(file_exists(BASE_PATH.'/sapphire/core/Core.php')) { |
|
| 26 | +if (file_exists(BASE_PATH.'/sapphire/core/Core.php')) { |
|
| 27 | 27 | //SS 2.x |
| 28 | - require_once(BASE_PATH . '/sapphire/core/Core.php'); |
|
| 29 | -} else if(file_exists(BASE_PATH.'/framework/core/Core.php')) { |
|
| 28 | + require_once(BASE_PATH.'/sapphire/core/Core.php'); |
|
| 29 | +} else if (file_exists(BASE_PATH.'/framework/core/Core.php')) { |
|
| 30 | 30 | //SS 3.x |
| 31 | - require_once(BASE_PATH. '/framework/core/Core.php'); |
|
| 32 | -} else if(file_exists(BASE_PATH.'/framework/src/Core/Core.php')) { |
|
| 31 | + require_once(BASE_PATH.'/framework/core/Core.php'); |
|
| 32 | +} else if (file_exists(BASE_PATH.'/framework/src/Core/Core.php')) { |
|
| 33 | 33 | //SS 4.x |
| 34 | - require_once(BASE_PATH. '/vendor/autoload.php'); |
|
| 35 | - require_once(BASE_PATH. '/framework/src/Core/Core.php'); |
|
| 34 | + require_once(BASE_PATH.'/vendor/autoload.php'); |
|
| 35 | + require_once(BASE_PATH.'/framework/src/Core/Core.php'); |
|
| 36 | 36 | } else { |
| 37 | - echo "Couldn't locate framework's Core.php. Perhaps " . BASE_PATH . " is not a SilverStripe project?\n"; |
|
| 37 | + echo "Couldn't locate framework's Core.php. Perhaps ".BASE_PATH." is not a SilverStripe project?\n"; |
|
| 38 | 38 | exit(2); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $output = array(); |
| 42 | -foreach($databaseConfig as $k => $v) { |
|
| 43 | - $output['db_' . $k] = $v; |
|
| 42 | +foreach ($databaseConfig as $k => $v) { |
|
| 43 | + $output['db_'.$k] = $v; |
|
| 44 | 44 | } |
| 45 | 45 | $output['assets_path'] = ASSETS_PATH; |
| 46 | 46 | |