Skip to content

Commit 8708e54

Browse files
committed
BackupTrait::getTarget() has been removed
1 parent 484f112 commit 8708e54

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# 2.x branch
2+
## 2.7 branch
3+
### 2.7.0
4+
* `BackupTrait::getTarget()` has been removed.
5+
26
## 2.6 branch
37
### 2.6.6
48
* APIs are now generated by `phpDocumentor` and no longer by` apigen`.

src/BackupTrait.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ trait BackupTrait
3636
* Returns an absolute path
3737
* @param string $path Relative or absolute path
3838
* @return string
39-
* @uses getTarget()
4039
*/
4140
public function getAbsolutePath($path)
4241
{
43-
return (new Filesystem())->isAbsolutePath($path) ? $path : add_slash_term($this->getTarget()) . $path;
42+
if (!(new Filesystem())->isAbsolutePath($path)) {
43+
$path = add_slash_term(Configure::read('DatabaseBackup.target')) . $path;
44+
}
45+
46+
return $path;
4447
}
4548

4649
/**
@@ -136,15 +139,6 @@ public function getExtension($filename)
136139
return in_array($extension, $this->getValidExtensions()) ? $extension : null;
137140
}
138141

139-
/**
140-
* Returns the target path
141-
* @return string
142-
*/
143-
public function getTarget()
144-
{
145-
return Configure::read('DatabaseBackup.target');
146-
}
147-
148142
/**
149143
* Returns all valid compressions
150144
* @return array

src/Utility/BackupManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function deleteAll()
6868
*/
6969
public function index()
7070
{
71-
$finder = (new Finder())->files()->name('/\.sql(\.(gz|bz2))?$/')->in($this->getTarget());
71+
$finder = (new Finder())->files()->name('/\.sql(\.(gz|bz2))?$/')->in(Configure::read('DatabaseBackup.target'));
7272

7373
return collection($finder)->map(function (SplFileInfo $file) {
7474
return new Entity([

tests/TestCase/Utility/BackupExportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function testFilename()
117117
{
118118
$this->BackupExport->filename('backup.sql.bz2');
119119
$this->assertEquals(
120-
add_slash_term($this->BackupExport->getTarget()) . 'backup.sql.bz2',
120+
add_slash_term(Configure::read('DatabaseBackup.target')) . 'backup.sql.bz2',
121121
$this->getProperty($this->BackupExport, 'filename')
122122
);
123123
$this->assertEquals('bzip2', $this->getProperty($this->BackupExport, 'compression'));

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.6
1+
2.7.0

0 commit comments

Comments
 (0)