Skip to content

Commit bf3fc38

Browse files
Removed 'Compressed' methods
to not get confused if encryption is being added in the future
1 parent 3f81024 commit bf3fc38

File tree

12 files changed

+79
-67
lines changed

12 files changed

+79
-67
lines changed

src/Backup/Collector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@ protected function collect($path, $depth)
8181
if ($this->target->shouldBeCompressed()) {
8282
$fileRegex .= '.' . $this->target->getCompressor()->getSuffix();
8383
}
84+
/** @var \SplFileInfo $file */
8485
foreach ($dItter as $i => $file) {
8586
if ($file->isDir()) {
8687
continue;
8788
}
8889
// skip currently created backup
89-
if ($file->getPathname() == $this->target->getPathnameCompressed()) {
90+
if ($file->getPathname() == $this->target->getPathname()) {
9091
continue;
9192
}
9293
if (preg_match('#' . $fileRegex . '#i', $file->getFilename())) {

src/Backup/Source/Cli.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class Cli
4545
protected function execute(Exec $exec, Target $target, $compressOutput = true)
4646
{
4747
/** @var \phpbu\App\Backup\Cli\Result $res */
48-
$res = $exec->execute($compressOutput ? $target->getPathname() : null);
48+
$res = $exec->execute($compressOutput ? $target->getPathnamePlain() : null);
4949
$code = $res->getCode();
5050
$cmd = $res->getCmd();
5151
$output = $res->getOutput();
@@ -69,8 +69,8 @@ protected function execute(Exec $exec, Target $target, $compressOutput = true)
6969
}
7070
} else {
7171
// remove file with errors
72-
if ($target->fileExists(false)) {
73-
$target->unlink(false);
72+
if ($target->fileExists(true)) {
73+
$target->unlink(true);
7474
}
7575
}
7676

@@ -86,7 +86,7 @@ protected function execute(Exec $exec, Target $target, $compressOutput = true)
8686
protected function compressOutput(Target $target)
8787
{
8888
$exec = $target->getCompressor()
89-
->getExec($target->getPathname(false), array('-f'));
89+
->getExec($target->getPathnamePlain(), array('-f'));
9090

9191
$old = error_reporting(0);
9292
$res = $exec->execute();

src/Backup/Source/Tar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Tar extends Cli implements Source
3939
*/
4040
private $compressors = array(
4141
'bzip2' => 'j',
42-
'gzip' => 'z',
42+
'gzip' => 'z',
4343
);
4444

4545
/**
@@ -126,7 +126,7 @@ public function getExec(Target $target)
126126

127127
// check if 'tar' can handle the requested compression
128128
if ($target->shouldBeCompressed()) {
129-
$name = $target->getCompressor()->getCommand(false);
129+
$name = $target->getCompressor()->getCommand(false);
130130
$compressOption = $this->getCompressorOption($name);
131131
// the requested compression is not available for the 'tar' command
132132
if (!$compressOption) {
@@ -137,7 +137,7 @@ public function getExec(Target $target)
137137
}
138138

139139
$tar->addOption('-' . $compressOption . 'cf');
140-
$tar->addArgument($target->getPathname(true));
140+
$tar->addArgument($target->getPathname());
141141
$tar->addOption('-C', $this->path, ' ');
142142
$tar->addArgument('.');
143143
$this->exec->addCommand($tar);

src/Backup/Sync/AmazonS3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ public function setup(array $config)
109109
*/
110110
public function sync(Target $target, Result $result)
111111
{
112-
$sourcePath = $target->getPathnameCompressed();
113-
$targetPath = $this->path . $target->getFilenameCompressed();
112+
$sourcePath = $target->getPathname();
113+
$targetPath = $this->path . $target->getFilename();
114114

115115
$s3 = S3Client::factory(
116116
array(

src/Backup/Sync/Cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function execute(Cmd $command)
4747
*/
4848
protected function replaceTargetPlaceholder($string, Target $target)
4949
{
50-
$targetFile = $target->getPathnameCompressed();
50+
$targetFile = $target->getPathname();
5151
$targetDir = dirname($targetFile);
5252
$search = array('%TARGET_DIR%', '%TARGET_FILE%');
5353
$replace = array($targetDir, $targetFile);

src/Backup/Sync/Copycom.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ public function setup(array $config)
100100
*/
101101
public function sync(Target $target, Result $result)
102102
{
103-
$sourcePath = $target->getPathnameCompressed();
104-
$targetPath = $this->path . $target->getFilenameCompressed();
103+
$sourcePath = $target->getPathname();
104+
$targetPath = $this->path . $target->getFilename();
105105

106106
$copy = new CopycomApi($this->appKey, $this->appSecret, $this->userKey, $this->userSecret);
107107

src/Backup/Sync/Dropbox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public function setup(array $config)
7575
*/
7676
public function sync(Target $target, Result $result)
7777
{
78-
$sourcePath = $target->getPathnameCompressed();
79-
$dropboxPath = $this->path . $target->getFilenameCompressed();
78+
$sourcePath = $target->getPathname();
79+
$dropboxPath = $this->path . $target->getFilename();
8080
$client = new DropboxApi\Client($this->token, "phpbu/1.1.0");
8181
$pathError = DropboxApi\Path::findErrorNonRoot($dropboxPath);
8282

src/Backup/Sync/Rsync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function sync(Target $target, Result $result)
122122
// std err > dev null
123123
$rsync->silence();
124124

125-
$targetFile = $target->getPathnameCompressed();
125+
$targetFile = $target->getPathname();
126126
$targetDir = dirname($targetFile);
127127

128128
// use archive mode, verbose and compress if not already done

src/Backup/Sync/Sftp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ public function sync(Target $target, Result $result)
106106
}
107107
error_reporting($old);
108108

109-
$remoteFilename = $target->getFilenameCompressed();
110-
$localFile = $target->getPathnameCompressed();
109+
$remoteFilename = $target->getFilename();
110+
$localFile = $target->getPathname();
111111

112112
if ('' !== $this->remotePath) {
113113
$remoteDirs = explode('/', $this->remotePath);

src/Backup/Sync/SoftLayer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public function setup(array $config)
104104
*/
105105
public function sync(Target $target, Result $result)
106106
{
107-
$sourcePath = $target->getPathnameCompressed();
108-
$targetPath = $this->path . $target->getFilenameCompressed();
107+
$sourcePath = $target->getPathname();
108+
$targetPath = $this->path . $target->getFilename();
109109

110110
$options = array('adapter' => ObjectStorage_Http_Client::SOCKET, 'timeout' => 20);
111111
$objectStorage = new ObjectStorage($this->host, $this->user, $this->secret, $options);

0 commit comments

Comments
 (0)