@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | function createLocal($command, $options) { |
| 37 | 37 | $options = array_merge($this->defaultOptions, $options); |
| 38 | - if(is_array($command)) $command = $this->commandArrayToString($command); |
|
| 38 | + if (is_array($command)) $command = $this->commandArrayToString($command); |
|
| 39 | 39 | |
| 40 | 40 | return new Process($command, $options); |
| 41 | 41 | } |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function commandArrayToString($command) { |
| 55 | 55 | $string = escapeshellcmd(array_shift($command)); |
| 56 | - foreach($command as $arg) { |
|
| 57 | - $string .= ' ' . escapeshellarg($arg); |
|
| 56 | + foreach ($command as $arg) { |
|
| 57 | + $string .= ' '.escapeshellarg($arg); |
|
| 58 | 58 | } |
| 59 | 59 | return $string; |
| 60 | 60 | } |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | $options = array_merge($this->options, $options); |
| 81 | 81 | |
| 82 | 82 | // Modify command for remote execution, if necessary. |
| 83 | - if($this->remoteServer) { |
|
| 84 | - if(!empty($options['outputFile']) || !empty($options['outputStream'])) $ssh = "ssh -T "; |
|
| 83 | + if ($this->remoteServer) { |
|
| 84 | + if (!empty($options['outputFile']) || !empty($options['outputStream'])) $ssh = "ssh -T "; |
|
| 85 | 85 | else $ssh = "ssh -t "; |
| 86 | 86 | if (!empty($options['identity'])) { |
| 87 | - $ssh .= '-i ' . escapeshellarg($options['identity']) . ' '; |
|
| 87 | + $ssh .= '-i '.escapeshellarg($options['identity']).' '; |
|
| 88 | 88 | } |
| 89 | - $command = $ssh . escapeshellarg($this->remoteServer) . ' ' . escapeshellarg($this->command); |
|
| 89 | + $command = $ssh.escapeshellarg($this->remoteServer).' '.escapeshellarg($this->command); |
|
| 90 | 90 | } else { |
| 91 | 91 | $command = $this->command; |
| 92 | 92 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | // Alternatives |
| 102 | - if($options['inputContent'] || $options['inputStream']) $pipeSpec[0] = array('pipe', 'r'); |
|
| 102 | + if ($options['inputContent'] || $options['inputStream']) $pipeSpec[0] = array('pipe', 'r'); |
|
| 103 | 103 | |
| 104 | - if($options['outputFile']) { |
|
| 104 | + if ($options['outputFile']) { |
|
| 105 | 105 | $pipeSpec[1] = array('file', |
| 106 | 106 | $options['outputFile'], |
| 107 | 107 | $options['outputFileAppend'] ? 'a' : 'w'); |
@@ -109,24 +109,24 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $process = proc_open($command, $pipeSpec, $pipes); |
| 111 | 111 | |
| 112 | - if($options['inputContent']) { |
|
| 112 | + if ($options['inputContent']) { |
|
| 113 | 113 | fwrite($pipes[0], $options['inputContent']); |
| 114 | 114 | |
| 115 | - } else if($options['inputStream']) { |
|
| 116 | - while($content = fread($options['inputStream'], 8192)) { |
|
| 115 | + } else if ($options['inputStream']) { |
|
| 116 | + while ($content = fread($options['inputStream'], 8192)) { |
|
| 117 | 117 | fwrite($pipes[0], $content); |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | - if(isset($pipes[0])) fclose($pipes[0]); |
|
| 120 | + if (isset($pipes[0])) fclose($pipes[0]); |
|
| 121 | 121 | |
| 122 | 122 | $result = array(); |
| 123 | 123 | |
| 124 | - if(isset($pipes[1])) { |
|
| 124 | + if (isset($pipes[1])) { |
|
| 125 | 125 | // If a stream was provided, then pipe all the content |
| 126 | 126 | // Doing it this way rather than passing outputStream to $pipeSpec |
| 127 | 127 | // Means that streams as well as simple FDs can be used |
| 128 | - if($options['outputStream']) { |
|
| 129 | - while($content = fread($pipes[1], 8192)) { |
|
| 128 | + if ($options['outputStream']) { |
|
| 129 | + while ($content = fread($pipes[1], 8192)) { |
|
| 130 | 130 | fwrite($options['outputStream'], $content); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -136,14 +136,14 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | fclose($pipes[1]); |
| 138 | 138 | } |
| 139 | - if(isset($pipes[2])) { |
|
| 139 | + if (isset($pipes[2])) { |
|
| 140 | 140 | $result['error'] = stream_get_contents($pipes[2]); |
| 141 | 141 | fclose($pipes[2]); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $result['return'] = proc_close($process); |
| 145 | 145 | |
| 146 | - if($options['throwException'] && $result['return'] != 0) { |
|
| 146 | + if ($options['throwException'] && $result['return'] != 0) { |
|
| 147 | 147 | throw new Exception("Command: $command\nExecution failed: returned {$result['return']}.\n" |
| 148 | 148 | . (empty($result['output']) ? "" : "Output:\n{$result['output']}")); |
| 149 | 149 | } |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | function __construct($path, $executor) { |
| 13 | 13 | $this->executor = $executor; |
| 14 | 14 | |
| 15 | - if(strpos($path,':') !== false) { |
|
| 16 | - list($this->server,$this->path) = explode(':', $path, 2); |
|
| 15 | + if (strpos($path, ':') !== false) { |
|
| 16 | + list($this->server, $this->path) = explode(':', $path, 2); |
|
| 17 | 17 | } else { |
| 18 | 18 | $this->server = null; |
| 19 | 19 | $this->path = $path; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @return Process |
| 48 | 48 | */ |
| 49 | 49 | function createProcess($command, $options = array()) { |
| 50 | - if($this->server) { |
|
| 50 | + if ($this->server) { |
|
| 51 | 51 | if ($this->identity && !isset($options['identity'])) { |
| 52 | 52 | $options['identity'] = $this->identity; |
| 53 | 53 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param string $dest The remote filename/dir to upload to |
| 64 | 64 | */ |
| 65 | 65 | function upload($source, $dest) { |
| 66 | - if($this->server) { |
|
| 66 | + if ($this->server) { |
|
| 67 | 67 | $this->executor->execLocal(array("scp", $source, "$this->server:$dest")); |
| 68 | 68 | } else { |
| 69 | 69 | $this->executor->execLocal(array("cp", $source, $dest)); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param string $dest The remote filename/dir to upload to |
| 77 | 77 | */ |
| 78 | 78 | function uploadContent($content, $dest) { |
| 79 | - $this->exec("echo " . escapeshellarg($content) . " > " . escapeshellarg($dest)); |
|
| 79 | + $this->exec("echo ".escapeshellarg($content)." > ".escapeshellarg($dest)); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param string $dest The local filename/dir to download to |
| 86 | 86 | */ |
| 87 | 87 | function download($source, $dest) { |
| 88 | - if($this->server) { |
|
| 88 | + if ($this->server) { |
|
| 89 | 89 | $this->executor->execLocal(array("scp", "$this->server:$source", $dest)); |
| 90 | 90 | } else { |
| 91 | 91 | $this->executor->execLocal(array("cp", $file, $dest)); |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * @return boolean |
| 99 | 99 | */ |
| 100 | 100 | function exists($file = null) { |
| 101 | - if(!$file) $file = $this->path; |
|
| 102 | - if($file == '@self') return true; |
|
| 101 | + if (!$file) $file = $this->path; |
|
| 102 | + if ($file == '@self') return true; |
|
| 103 | 103 | |
| 104 | - if($this->server) { |
|
| 105 | - $result = $this->exec("if [ -e " . escapeshellarg($file) . " ]; then echo yes; fi"); |
|
| 104 | + if ($this->server) { |
|
| 105 | + $result = $this->exec("if [ -e ".escapeshellarg($file)." ]; then echo yes; fi"); |
|
| 106 | 106 | return (trim($result['output']) == 'yes'); |
| 107 | 107 | |
| 108 | 108 | } else { |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * Create the given file with the given content |
| 115 | 115 | */ |
| 116 | 116 | function writeFile($file, $content) { |
| 117 | - if($this->server) { |
|
| 118 | - $this->exec("echo " . escapeshellarg($content) . " > " . escapeshellarg($file)); |
|
| 117 | + if ($this->server) { |
|
| 118 | + $this->exec("echo ".escapeshellarg($content)." > ".escapeshellarg($file)); |
|
| 119 | 119 | |
| 120 | 120 | } else { |
| 121 | 121 | file_put_contents($file, $content); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param string $file The file to remove |
| 129 | 129 | */ |
| 130 | 130 | function unlink($file) { |
| 131 | - if(!$file || $file == '/' || $file == '.') throw new Exception("Can't unlink file '$file'"); |
|
| 131 | + if (!$file || $file == '/' || $file == '.') throw new Exception("Can't unlink file '$file'"); |
|
| 132 | 132 | $this->exec(array('rm', '-rf', $file)); |
| 133 | 133 | return true; |
| 134 | 134 | } |
@@ -98,8 +98,12 @@ discard block |
||
| 98 | 98 | * @return boolean |
| 99 | 99 | */ |
| 100 | 100 | function exists($file = null) { |
| 101 | - if(!$file) $file = $this->path; |
|
| 102 | - if($file == '@self') return true; |
|
| 101 | + if(!$file) { |
|
| 102 | + $file = $this->path; |
|
| 103 | + } |
|
| 104 | + if($file == '@self') { |
|
| 105 | + return true; |
|
| 106 | + } |
|
| 103 | 107 | |
| 104 | 108 | if($this->server) { |
| 105 | 109 | $result = $this->exec("if [ -e " . escapeshellarg($file) . " ]; then echo yes; fi"); |
@@ -128,7 +132,9 @@ discard block |
||
| 128 | 132 | * @param string $file The file to remove |
| 129 | 133 | */ |
| 130 | 134 | function unlink($file) { |
| 131 | - if(!$file || $file == '/' || $file == '.') throw new Exception("Can't unlink file '$file'"); |
|
| 135 | + if(!$file || $file == '/' || $file == '.') { |
|
| 136 | + throw new Exception("Can't unlink file '$file'"); |
|
| 137 | + } |
|
| 132 | 138 | $this->exec(array('rm', '-rf', $file)); |
| 133 | 139 | return true; |
| 134 | 140 | } |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | function help($args) { |
| 68 | 68 | echo "SSPak: manage SilverStripe .sspak archives.\n\nUsage:\n"; |
| 69 | - foreach($this->getActions() as $action => $info) { |
|
| 69 | + foreach ($this->getActions() as $action => $info) { |
|
| 70 | 70 | echo "sspak $action"; |
| 71 | - if(!empty($info['unnamedArgs'])) { |
|
| 72 | - foreach($info['unnamedArgs'] as $arg) echo " ($arg)"; |
|
| 71 | + if (!empty($info['unnamedArgs'])) { |
|
| 72 | + foreach ($info['unnamedArgs'] as $arg) echo " ($arg)"; |
|
| 73 | 73 | } |
| 74 | - if(!empty($info['namedFlags'])) { |
|
| 75 | - foreach($info['namedFlags'] as $arg) echo " (--$arg)"; |
|
| 74 | + if (!empty($info['namedFlags'])) { |
|
| 75 | + foreach ($info['namedFlags'] as $arg) echo " (--$arg)"; |
|
| 76 | 76 | } |
| 77 | - if(!empty($info['namedArgs'])) { |
|
| 78 | - foreach($info['namedArgs'] as $arg) echo " --$arg=\"$arg value\""; |
|
| 77 | + if (!empty($info['namedArgs'])) { |
|
| 78 | + foreach ($info['namedArgs'] as $arg) echo " --$arg=\"$arg value\""; |
|
| 79 | 79 | } |
| 80 | 80 | echo "\n {$info['description']}\n\n"; |
| 81 | 81 | } |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $filesystem = new FilesystemEntity(null, $executor); |
| 101 | 101 | |
| 102 | - if($pakParts['db']) { |
|
| 102 | + if ($pakParts['db']) { |
|
| 103 | 103 | $dbPath = escapeshellarg($namedArgs['db']); |
| 104 | 104 | $process = $filesystem->createProcess("cat $dbPath | gzip -c"); |
| 105 | 105 | $sspak->writeFileFromProcess('database.sql.gz', $process); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if($pakParts['assets']) { |
|
| 108 | + if ($pakParts['assets']) { |
|
| 109 | 109 | $assetsParentArg = escapeshellarg(dirname($namedArgs['assets'])); |
| 110 | 110 | $assetsBaseArg = escapeshellarg(basename($namedArgs['assets'])); |
| 111 | 111 | $process = $filesystem->createProcess("cd $assetsParentArg && tar cfh - $assetsBaseArg | gzip -c"); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $sspak = new SSPakFile($file, $executor); |
| 129 | 129 | |
| 130 | 130 | // Validation |
| 131 | - if(!$sspak->exists()) throw new Exception("File '$file' doesn't exist."); |
|
| 131 | + if (!$sspak->exists()) throw new Exception("File '$file' doesn't exist."); |
|
| 132 | 132 | |
| 133 | 133 | $phar = $sspak->getPhar(); |
| 134 | 134 | $phar->extractTo($dest); |
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $webroot = new Webroot($unnamedArgs[0], $executor); |
| 149 | 149 | $file = $unnamedArgs[1]; |
| 150 | - if(file_exists($file)) throw new Exception( "File '$file' already exists."); |
|
| 150 | + if (file_exists($file)) throw new Exception("File '$file' already exists."); |
|
| 151 | 151 | |
| 152 | 152 | $sspak = new SSPakFile($file, $executor); |
| 153 | 153 | |
| 154 | - if(!empty($namedArgs['identity'])) { |
|
| 154 | + if (!empty($namedArgs['identity'])) { |
|
| 155 | 155 | // SSH private key |
| 156 | 156 | $webroot->setSSHItentityFile($namedArgs['identity']); |
| 157 | 157 | } |
| 158 | - if(!empty($namedArgs['from-sudo'])) $webroot->setSudo($namedArgs['from-sudo']); |
|
| 159 | - else if(!empty($namedArgs['sudo'])) $webroot->setSudo($namedArgs['sudo']); |
|
| 158 | + if (!empty($namedArgs['from-sudo'])) $webroot->setSudo($namedArgs['from-sudo']); |
|
| 159 | + else if (!empty($namedArgs['sudo'])) $webroot->setSudo($namedArgs['sudo']); |
|
| 160 | 160 | |
| 161 | 161 | // Look up which parts of the sspak are going to be saved |
| 162 | 162 | $pakParts = $args->pakParts(); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $details = $webroot->sniff(); |
| 166 | 166 | |
| 167 | 167 | // Create a build folder for the sspak file |
| 168 | - $buildFolder = "/tmp/sspak-" . rand(100000,999999); |
|
| 168 | + $buildFolder = "/tmp/sspak-".rand(100000, 999999); |
|
| 169 | 169 | $webroot->exec(array('mkdir', $buildFolder)); |
| 170 | 170 | |
| 171 | 171 | $dbFile = "$buildFolder/database.sql.gz"; |
@@ -176,22 +176,22 @@ discard block |
||
| 176 | 176 | $fileList = array(); |
| 177 | 177 | |
| 178 | 178 | // Save DB |
| 179 | - if($pakParts['db']) { |
|
| 179 | + if ($pakParts['db']) { |
|
| 180 | 180 | // Check the database type |
| 181 | 181 | $dbFunction = 'getdb_'.$details['db_type']; |
| 182 | - if(!method_exists($this,$dbFunction)) { |
|
| 183 | - throw new Exception("Can't process database type '" . $details['db_type'] . "'"); |
|
| 182 | + if (!method_exists($this, $dbFunction)) { |
|
| 183 | + throw new Exception("Can't process database type '".$details['db_type']."'"); |
|
| 184 | 184 | } |
| 185 | 185 | $this->$dbFunction($webroot, $details, $sspak, basename($dbFile)); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // Save Assets |
| 189 | - if($pakParts['assets']) { |
|
| 189 | + if ($pakParts['assets']) { |
|
| 190 | 190 | $this->getassets($webroot, $details['assets_path'], $sspak, basename($assetsFile)); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Save git-remote |
| 194 | - if($pakParts['git-remote']) { |
|
| 194 | + if ($pakParts['git-remote']) { |
|
| 195 | 195 | $this->getgitremote($webroot, $sspak, basename($gitRemoteFile)); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $hostArg = ''; |
| 212 | 212 | $portArg = ''; |
| 213 | 213 | if (!empty($conf['db_server']) && $conf['db_server'] != 'localhost') { |
| 214 | - if (strpos($conf['db_server'], ':')!==false) { |
|
| 214 | + if (strpos($conf['db_server'], ':') !== false) { |
|
| 215 | 215 | // Handle "server:port" format. |
| 216 | 216 | $server = explode(':', $conf['db_server'], 2); |
| 217 | 217 | $hostArg = escapeshellarg("--host=".$server[0]); |
@@ -250,16 +250,16 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | function getgitremote($webroot, $sspak, $gitRemoteFile) { |
| 252 | 252 | // Only do anything if we're copying from a git checkout |
| 253 | - $gitRepo = $webroot->getPath() .'/.git'; |
|
| 254 | - if($webroot->exists($gitRepo)) { |
|
| 253 | + $gitRepo = $webroot->getPath().'/.git'; |
|
| 254 | + if ($webroot->exists($gitRepo)) { |
|
| 255 | 255 | // Identify current branch |
| 256 | 256 | $output = $webroot->exec(array('git', '--git-dir='.$gitRepo, 'branch')); |
| 257 | - if(preg_match("/\* ([^ \n]*)/", $output['output'], $matches) && strpos("(no branch)", $matches[1])===false) { |
|
| 257 | + if (preg_match("/\* ([^ \n]*)/", $output['output'], $matches) && strpos("(no branch)", $matches[1]) === false) { |
|
| 258 | 258 | // If there is a current branch, use that branch's remove |
| 259 | 259 | $currentBranch = trim($matches[1]); |
| 260 | - $output = $webroot->exec(array('git', '--git-dir='.$gitRepo, 'config','--get',"branch.$currentBranch.remote")); |
|
| 260 | + $output = $webroot->exec(array('git', '--git-dir='.$gitRepo, 'config', '--get', "branch.$currentBranch.remote")); |
|
| 261 | 261 | $remoteName = trim($output['output']); |
| 262 | - if(!$remoteName) $remoteName = 'origin'; |
|
| 262 | + if (!$remoteName) $remoteName = 'origin'; |
|
| 263 | 263 | |
| 264 | 264 | // Default to origin |
| 265 | 265 | } else { |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // Determine the URL of that remote |
| 271 | - $output = $webroot->exec(array('git', '--git-dir='.$gitRepo, 'config','--get',"remote.$remoteName.url")); |
|
| 271 | + $output = $webroot->exec(array('git', '--git-dir='.$gitRepo, 'config', '--get', "remote.$remoteName.url")); |
|
| 272 | 272 | $remoteURL = trim($output['output']); |
| 273 | 273 | |
| 274 | 274 | // Determine the current SHA |
| 275 | - $output = $webroot->exec(array('git', '--git-dir='.$gitRepo, 'log','-1','--format=%H')); |
|
| 275 | + $output = $webroot->exec(array('git', '--git-dir='.$gitRepo, 'log', '-1', '--format=%H')); |
|
| 276 | 276 | $sha = trim($output['output']); |
| 277 | 277 | |
| 278 | 278 | $content = "remote = $remoteURL\nbranch = $currentBranch\nsha = $sha\n"; |
@@ -300,22 +300,22 @@ discard block |
||
| 300 | 300 | $pakParts = $args->pakParts(); |
| 301 | 301 | |
| 302 | 302 | $namedArgs = $args->getNamedArgs(); |
| 303 | - if(!empty($namedArgs['identity'])) { |
|
| 303 | + if (!empty($namedArgs['identity'])) { |
|
| 304 | 304 | // SSH private key |
| 305 | 305 | $webroot->setSSHItentityFile($namedArgs['identity']); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | // Validation |
| 309 | - if(!$sspak->exists()) throw new Exception( "File '$file' doesn't exist."); |
|
| 309 | + if (!$sspak->exists()) throw new Exception("File '$file' doesn't exist."); |
|
| 310 | 310 | |
| 311 | 311 | // Push database, if necessary |
| 312 | 312 | $namedArgs = $args->getNamedArgs(); |
| 313 | - if($pakParts['db'] && $sspak->contains('database.sql.gz')) { |
|
| 313 | + if ($pakParts['db'] && $sspak->contains('database.sql.gz')) { |
|
| 314 | 314 | $webroot->putdb($sspak, isset($namedArgs['drop-db'])); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | // Push assets, if neccessary |
| 318 | - if($pakParts['assets'] && $sspak->contains('assets.tar.gz')) { |
|
| 318 | + if ($pakParts['assets'] && $sspak->contains('assets.tar.gz')) { |
|
| 319 | 319 | $webroot->putassets($sspak); |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | $pakParts = $args->pakParts(); |
| 338 | 338 | |
| 339 | 339 | // Validation |
| 340 | - if($webroot->exists($webroot->getPath())) throw new Exception( "Webroot '$webrootDir' already exists."); |
|
| 341 | - if(!$sspak->exists()) throw new Exception( "File '$file' doesn't exist."); |
|
| 340 | + if ($webroot->exists($webroot->getPath())) throw new Exception("Webroot '$webrootDir' already exists."); |
|
| 341 | + if (!$sspak->exists()) throw new Exception("File '$file' doesn't exist."); |
|
| 342 | 342 | |
| 343 | 343 | // Create new dir |
| 344 | 344 | $webroot->exec(array('mkdir', $webroot->getPath())); |
| 345 | 345 | |
| 346 | - if($sspak->contains('git-remote')) { |
|
| 346 | + if ($sspak->contains('git-remote')) { |
|
| 347 | 347 | $details = $sspak->gitRemoteDetails(); |
| 348 | 348 | $webroot->putgit($details); |
| 349 | 349 | } |
@@ -352,12 +352,12 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | // Push database, if necessary |
| 354 | 354 | $namedArgs = $args->getNamedArgs(); |
| 355 | - if($pakParts['db'] && $sspak->contains('database.sql.gz')) { |
|
| 355 | + if ($pakParts['db'] && $sspak->contains('database.sql.gz')) { |
|
| 356 | 356 | $webroot->putdb($sspak, isset($namedArgs['drop-db'])); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | // Push assets, if neccessary |
| 360 | - if($pakParts['assets'] && $sspak->contains('assets.tar.gz')) { |
|
| 360 | + if ($pakParts['assets'] && $sspak->contains('assets.tar.gz')) { |
|
| 361 | 361 | $webroot->putassets($sspak); |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | $sspakScript = str_replace('$isSelfExtracting = false;', '$isSelfExtracting = true;', $sspakScript); |
| 385 | 385 | |
| 386 | 386 | // Load the sniffer file |
| 387 | - $snifferFile = dirname(__FILE__) . '/sspak-sniffer.php'; |
|
| 387 | + $snifferFile = dirname(__FILE__).'/sspak-sniffer.php'; |
|
| 388 | 388 | $sspakScript = str_replace("\$snifferFileContent = '';\n", |
| 389 | 389 | "\$snifferFileContent = '" |
| 390 | - . str_replace(array("\\","'"),array("\\\\", "\\'"), file_get_contents($snifferFile)) . "';\n", $sspakScript); |
|
| 390 | + . str_replace(array("\\", "'"), array("\\\\", "\\'"), file_get_contents($snifferFile))."';\n", $sspakScript); |
|
| 391 | 391 | |
| 392 | 392 | file_put_contents($destFile, $sspakScript); |
| 393 | 393 | chmod($destFile, 0775); |