From e42f98335d4c65dc8f19ea6962e8896dc2b3118e Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 31 Aug 2023 14:39:23 +0200 Subject: [PATCH 01/13] Improve install errors Prevent phpbu from spamming default errors during self update. --- src/Cmd.php | 63 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/src/Cmd.php b/src/Cmd.php index 1955227b..9ac1c314 100644 --- a/src/Cmd.php +++ b/src/Cmd.php @@ -35,6 +35,8 @@ use phpbu\App\Cmd\Args; use phpbu\App\Configuration\Bootstrapper; use phpbu\App\Util\Arr; +use RuntimeException; + use function fgets; use function file_put_contents; use function getcwd; @@ -189,9 +191,9 @@ protected function findConfiguration() : string * Create a application configuration * * @param string $configurationFile - * @param \phpbu\App\Factory $factory - * @return \phpbu\App\Configuration - * @throws \phpbu\App\Exception + * @param Factory $factory + * @return Configuration + * @throws Exception */ protected function createConfiguration(string $configurationFile, Factory $factory) : Configuration { @@ -235,7 +237,7 @@ protected function createConfiguration(string $configurationFile, Factory $facto /** * Override configuration settings with command line arguments * - * @param \phpbu\App\Configuration $configuration + * @param Configuration $configuration */ protected function overrideConfigWithArguments(Configuration $configuration) : void { @@ -269,16 +271,7 @@ protected function handleSelfUpdate() : void echo 'Updating the phpbu PHAR to version ' . $latestVersion . ' ... '; - $old = error_reporting(0); - $phar = file_get_contents($remoteFilename); - error_reporting($old); - if (!$phar) { - echo ' failed' . PHP_EOL . 'Could not reach phpbu update site' . PHP_EOL; - exit(self::EXIT_EXCEPTION); - } - file_put_contents($tempFilename, $phar); - - chmod($tempFilename, 0777 & ~umask()); + $this->overwriteOriginalBinaryWithTempBinary($tempFilename, $this->downloadLatestPHAR($remoteFilename)); // check downloaded phar try { @@ -355,7 +348,7 @@ private function handleConfigGeneration() : void * Returns latest released phpbu version * * @return string - * @throws \RuntimeException + * @throws RuntimeException */ protected function getLatestVersion() : string { @@ -427,7 +420,7 @@ protected function printHelp() : void * @param string $message * @param bool $hint */ - private function printError($message, $hint = false) : void + private function printError($message, $hint = false): void { $help = $hint ? ', use "phpbu -h" for help' : ''; $this->printVersionString(); @@ -443,4 +436,42 @@ public static function main() : void $app = new static(); $app->run($_SERVER['argv']); } + + /** + * Will download the PHAR and return the content + * + * @param string $remoteFilename + * @return string + */ + private function downloadLatestPHAR(string $remoteFilename): string + { + $old = error_reporting(0); + $phar = file_get_contents($remoteFilename); + error_reporting($old); + if (!$phar) { + echo ' failed' . PHP_EOL . 'Could not reach phpbu update site' . PHP_EOL; + exit(self::EXIT_EXCEPTION); + } + + return $phar; + } + + /** + * Will copy the downloaded PHAR data to the original phpbu binary + * + * @param string $tempFilename + * @param string $phar + * @return void + */ + private function overwriteOriginalBinaryWithTempBinary(string $tempFilename, string $phar): void + { + $old = error_reporting(0); + $success = file_put_contents($tempFilename, $phar); + error_reporting($old); + if (!$success) { + echo ' permission denied' . PHP_EOL . 'Could not update phpbu binary file' . PHP_EOL; + exit(self::EXIT_EXCEPTION); + } + chmod($tempFilename, 0777 & ~umask()); + } } From de36a9c7e89b43077eab928e03fbcbe199768736 Mon Sep 17 00:00:00 2001 From: ohmydevops Date: Thu, 28 Sep 2023 15:45:25 +0330 Subject: [PATCH 02/13] Add json sample in README.md --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aae971d9..f88106e0 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,33 @@ To show a guide how to restore your backup use the *--restore* option. ## Configuration Example -Simple configuration example: +Simple configuration example in JSON: + +```json +{ + "verbose":true, + "backups":[ + { + "name":"myAppDB", + "source":{ + "type":"mysqldump", + "options":{ + "databases":"mydbname", + "user":"user.name", + "password":"topsecret" + } + }, + "target":{ + "dirname":"backup", + "filename":"mysql-%Y%m%d-%H%i.sql", + "compress":"bzip2" + } + } + ] +} +``` + +Simple configuration example in XML: ```xml From fa16fe170e633be2a6ad255709009dd061b1dc73 Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 28 Sep 2023 20:36:17 +0200 Subject: [PATCH 03/13] Move json example to the bottom --- README.md | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index f88106e0..786119c7 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,30 @@ To show a guide how to restore your backup use the *--restore* option. ## Configuration Example +Simple configuration example in XML: + +```xml + + + + + + + + + +``` + Simple configuration example in JSON: ```json @@ -169,27 +193,3 @@ Simple configuration example in JSON: ] } ``` - -Simple configuration example in XML: - -```xml - - - - - - - - - -``` From 78b5ce83efcdaddf1516fc8d24176ab455ff43ed Mon Sep 17 00:00:00 2001 From: Hemn Movafeghi Date: Thu, 14 Dec 2023 13:23:54 +0300 Subject: [PATCH 04/13] Update Prometheus.php --- src/Log/Prometheus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Log/Prometheus.php b/src/Log/Prometheus.php index 75b9a1b1..5b9396bb 100644 --- a/src/Log/Prometheus.php +++ b/src/Log/Prometheus.php @@ -76,7 +76,7 @@ public function onBackupEnd(Event\Backup\End $event) { $this->backupStats[$event->getConfiguration()->getName()]['timeEnd'] = microtime(true); $this->backupStats[$event->getConfiguration()->getName()]['lastRun'] = microtime(true); - $this->backupStats[$event->getConfiguration()->getName()]['size'] = $event->getTarget()->getSize(); + $this->backupStats[$event->getConfiguration()->getName()]['size'] = $event->getTarget()->getSize() ?? 0; } /** From 63e02e366e53cb8e5bc4b7c0751ca370cd9bfc93 Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Wed, 20 Dec 2023 17:23:33 +0100 Subject: [PATCH 05/13] Fix the PHAR build --- build.xml | 384 +++++++++++++++++++++++++++++++------------------- composer.json | 13 +- phive.xml | 10 +- 3 files changed, 254 insertions(+), 153 deletions(-) diff --git a/build.xml b/build.xml index c546605f..ad9956ac 100644 --- a/build.xml +++ b/build.xml @@ -92,57 +92,16 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + @@ -332,23 +291,36 @@ - - - - + + + + - - - + + + + + + + + + + + + + + + + + + - + @@ -370,64 +342,88 @@ - - - + + + + + - - - - + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + + + - - - - - + + + + + + - - - + + + + + - + + + + + + + + + + + + + + + @@ -435,34 +431,69 @@ - - - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + @@ -471,75 +502,140 @@ - - - - + + + + - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - + + + + - - - + + + + + + + + + + - - - - + + + + - - - + + + + + + + + + + + + + + + + + - diff --git a/composer.json b/composer.json index 7fef3511..7ad9ae69 100644 --- a/composer.json +++ b/composer.json @@ -44,24 +44,24 @@ } }, "require": { - "php": ">=7.2.0", + "php": ">=8.0", "ext-dom": "*", "ext-json": "*", "ext-spl": "*", "sebastian/environment": "^3.0|^4.0|^5.0|^6.0", "sebastianfeldmann/cli": "^3.4", - "symfony/process": "^3.0|^4.0|^5.0|^6.0" + "symfony/process": "^3.0|^4.0|^5.0|^6.0|^7.0" }, "require-dev": { "sebastianfeldmann/git": "^3.2", "sebastianfeldmann/ftp": "^0.9", "guzzlehttp/guzzle": "^5.3.4|^6.5.8|^7.5.0", "aws/aws-sdk-php": "^3.10", - "kunalvarma05/dropbox-php-sdk": "^0.2", + "kunalvarma05/dropbox-php-sdk": "^0.4", "phpseclib/phpseclib": "^2.0", "softlayer/objectstorage": "dev-master", "vlucas/phpdotenv": "^4.0", - "google/apiclient":"2.7.*", + "google/apiclient":"^2.7", "php-opencloud/openstack": "^3.0", "arhitector/yandex": "^2.0", "microsoft/azure-storage-blob": "^1.4", @@ -95,5 +95,10 @@ "test": "tools/phpunit", "analyse": "tools/phpstan analyse", "style": "tools/phpcs --standard=psr2 src" + }, + "config": { + "allow-plugins": { + "php-http/discovery": true + } } } diff --git a/phive.xml b/phive.xml index 4c4dc0ab..137a0ab9 100644 --- a/phive.xml +++ b/phive.xml @@ -1,8 +1,8 @@ - - - - - + + + + + From 7ef92d0e82eaa520288a4715b226e92d6b8b313f Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 12:06:14 +0100 Subject: [PATCH 06/13] Fix the PHAR build --- build/phar-autoload.php.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build/phar-autoload.php.in b/build/phar-autoload.php.in index 48181404..e8909b65 100644 --- a/build/phar-autoload.php.in +++ b/build/phar-autoload.php.in @@ -43,11 +43,6 @@ if ($execute) { require __PHPBU_PHAR_ROOT__ . '/lib/aws-sdk/functions.php'; // guzzle functions require __PHPBU_PHAR_ROOT__ . '/lib/guzzlehttp/guzzle/functions_include.php'; - require __PHPBU_PHAR_ROOT__ . '/lib/guzzlehttp/psr7/functions_include.php'; - require __PHPBU_PHAR_ROOT__ . '/lib/guzzlehttp/promises/functions_include.php'; - // dropbox collection helper - require __PHPBU_PHAR_ROOT__ . '/lib/tightenco/Collect/Support/helpers.php'; - require __PHPBU_PHAR_ROOT__ . '/lib/tightenco/Collect/Support/alias.php'; // load the symfony polyfills require __PHPBU_PHAR_ROOT__ . '/lib/symfony/polyfill-ctype/bootstrap.php'; require __PHPBU_PHAR_ROOT__ . '/lib/symfony/polyfill-mbstring/bootstrap.php'; From a7c7391623433e6e191b2f01dce9443767028956 Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 12:06:29 +0100 Subject: [PATCH 07/13] Update trusted phive install keys --- .github/workflows/integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 97232ab3..7f1056e6 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - php: ['7.3', '7.4', '8.0', '8.1'] + php: ['8.0', '8.1', '8.2', '8.3'] steps: - uses: actions/checkout@master @@ -27,7 +27,7 @@ jobs: run: php -v - name : Install tooling - run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2A8299CE842DD38C,661E97400F658E25 + run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 51C67305FFC2E5C0,4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2DF45277AEF09A2F - name: Update composer run: composer self-update From baa1b419e07f88fd1121d82c2f7e8a28a77f27fb Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 12:50:28 +0100 Subject: [PATCH 08/13] Update trusted phive install keys --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7f1056e6..30258b6d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -27,7 +27,7 @@ jobs: run: php -v - name : Install tooling - run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 51C67305FFC2E5C0,4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2DF45277AEF09A2F + run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 661E97400F658E25,51C67305FFC2E5C0,4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2DF45277AEF09A2F - name: Update composer run: composer self-update From 55a0467e385c49ee65f040e1dac0d0e2b838e550 Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 12:53:06 +0100 Subject: [PATCH 09/13] Update trusted phive install keys --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 30258b6d..44a33ca9 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -27,7 +27,7 @@ jobs: run: php -v - name : Install tooling - run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 661E97400F658E25,51C67305FFC2E5C0,4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2DF45277AEF09A2F + run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 661E97400F658E25,51C67305FFC2E5C0,4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2DF45277AEF09A2F,2A8299CE842DD38C - name: Update composer run: composer self-update From 6130353959769235f7b5320bff34ea87ae6b49ea Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 12:58:05 +0100 Subject: [PATCH 10/13] Update trusted phive install keys --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 44a33ca9..e8eae1dc 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -27,7 +27,7 @@ jobs: run: php -v - name : Install tooling - run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 661E97400F658E25,51C67305FFC2E5C0,4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2DF45277AEF09A2F,2A8299CE842DD38C + run : GITHUB_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} phive --no-progress --home ./.phive install --force-accept-unsigned --trust-gpg-keys 661E97400F658E25,5E6DDE998AB73B8E,51C67305FFC2E5C0,4AA394086372C20A,31C7E470E2138192,8E730BA25823D8B5,CF1A108D0E7AE720,2DF45277AEF09A2F,2A8299CE842DD38C - name: Update composer run: composer self-update From d21200d30945a31cf29f1c2f935632fa636a19a6 Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 13:32:11 +0100 Subject: [PATCH 11/13] Fix deprecations --- src/Backup/Sync/AmazonS3v3.php | 4 ++-- src/Backup/Sync/AzureBlob.php | 2 +- src/Backup/Sync/Dropbox.php | 2 +- src/Backup/Sync/GoogleDrive.php | 2 +- src/Backup/Sync/YandexDisk.php | 2 +- src/Util/Cli.php | 2 +- src/Util/Str.php | 4 ++-- tests/phpbu/Log/ResultFormatter/FormDataTest.php | 12 ++++++++---- 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Backup/Sync/AmazonS3v3.php b/src/Backup/Sync/AmazonS3v3.php index 211c253f..f161c3ac 100644 --- a/src/Backup/Sync/AmazonS3v3.php +++ b/src/Backup/Sync/AmazonS3v3.php @@ -69,7 +69,7 @@ public function sync(Target $target, Result $result) // run remote cleanup $this->cleanup($target, $result); } catch (\Exception $e) { - throw new Exception($e->getMessage(), null, $e); + throw new Exception($e->getMessage(), 0, $e); } } @@ -95,7 +95,7 @@ protected function createClient() : S3Client if ($this->signatureVersion) { $config['signature_version'] = $this->signatureVersion; } - + return new S3Client($config); } diff --git a/src/Backup/Sync/AzureBlob.php b/src/Backup/Sync/AzureBlob.php index 5bb8fbd9..70c16c7a 100644 --- a/src/Backup/Sync/AzureBlob.php +++ b/src/Backup/Sync/AzureBlob.php @@ -134,7 +134,7 @@ public function sync(Target $target, Result $result) // run remote cleanup $this->cleanup($target, $result); } catch (\Exception $e) { - throw new Exception($e->getMessage(), null, $e); + throw new Exception($e->getMessage(), 0, $e); } } diff --git a/src/Backup/Sync/Dropbox.php b/src/Backup/Sync/Dropbox.php index c9d401c6..a4cd2a2e 100644 --- a/src/Backup/Sync/Dropbox.php +++ b/src/Backup/Sync/Dropbox.php @@ -124,7 +124,7 @@ public function sync(Target $target, Result $result) // run remote cleanup $this->cleanup($target, $result); } catch (\Exception $e) { - throw new Exception($e->getMessage(), null, $e); + throw new Exception($e->getMessage(), 0, $e); } } diff --git a/src/Backup/Sync/GoogleDrive.php b/src/Backup/Sync/GoogleDrive.php index 43dd9980..8d1b4793 100644 --- a/src/Backup/Sync/GoogleDrive.php +++ b/src/Backup/Sync/GoogleDrive.php @@ -143,7 +143,7 @@ public function sync(Target $target, Result $result) $result->debug(sprintf('upload: done: %s', $apiResult->getId())); $this->cleanup($target, $result); } catch (\Exception $e) { - throw new Exception($e->getMessage(), null, $e); + throw new Exception($e->getMessage(), 0, $e); } } diff --git a/src/Backup/Sync/YandexDisk.php b/src/Backup/Sync/YandexDisk.php index af76da83..d507d1cf 100644 --- a/src/Backup/Sync/YandexDisk.php +++ b/src/Backup/Sync/YandexDisk.php @@ -112,7 +112,7 @@ public function sync(Target $target, Result $result): void } $this->cleanup($target, $result); } catch (\Exception $e) { - throw new Exception($e->getMessage(), null, $e); + throw new Exception($e->getMessage(), 0, $e); } } diff --git a/src/Util/Cli.php b/src/Util/Cli.php index c2050169..835d8f0b 100644 --- a/src/Util/Cli.php +++ b/src/Util/Cli.php @@ -139,7 +139,7 @@ public static function detectCmdLocationWithWhich(string $cmd) : string $bin = ''; // on nx systems use 'which' command. if (!defined('PHP_WINDOWS_VERSION_BUILD')) { - $command = trim(`which $cmd`); + $command = trim((string) `which $cmd`); $bin = self::isExecutable($command); } return $bin; diff --git a/src/Util/Str.php b/src/Util/Str.php index 43387cba..9147d721 100644 --- a/src/Util/Str.php +++ b/src/Util/Str.php @@ -28,9 +28,9 @@ public static function toBoolean($value, $default) : bool if (is_bool($value)) { return $value; } - if (strtolower($value) == 'false') { + if (strtolower((string)$value) == 'false') { return false; - } elseif (strtolower($value) == 'true') { + } elseif (strtolower((string)$value) == 'true') { return true; } return $default; diff --git a/tests/phpbu/Log/ResultFormatter/FormDataTest.php b/tests/phpbu/Log/ResultFormatter/FormDataTest.php index b8ab6418..701eb9f7 100644 --- a/tests/phpbu/Log/ResultFormatter/FormDataTest.php +++ b/tests/phpbu/Log/ResultFormatter/FormDataTest.php @@ -1,6 +1,9 @@ getResultMock(); $formatter = new FormData(); $queryString = $formatter->format($result); - $rawData = parse_query($queryString); + $rawData = []; + parse_str($queryString, $rawData); $this->assertNotEmpty($queryString); $this->assertEquals(0, $rawData['status']); @@ -39,12 +43,12 @@ public function testFormat() */ protected function getResultMock() { - $result = $this->createMock(\phpbu\App\Result::class); + $result = $this->createMock(Result::class); $result->expects($this->once())->method('started')->willReturn(microtime(true)); $result->expects($this->once())->method('allOk')->willReturn(true); $result->expects($this->once())->method('backupsFailedCount')->willReturn(0); $result->expects($this->once())->method('errorCount')->willReturn(1); - $result->expects($this->once())->method('getErrors')->willReturn([new \Exception('foo bar')]); + $result->expects($this->once())->method('getErrors')->willReturn([new Exception('foo bar')]); $result->expects($this->once())->method('getBackups')->willReturn([$this->getBackupResultMock()]); return $result; @@ -57,7 +61,7 @@ protected function getResultMock() */ protected function getBackupResultMock() { - $backup = $this->createMock(\phpbu\App\Result\Backup::class); + $backup = $this->createMock(Backup::class); $backup->method('getName')->willReturn('foo'); $backup->method('allOk')->willReturn(true); $backup->method('checkCount')->willReturn(0); From a226ee3a2916eef57bc16cf6c3bb2665deda152f Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 13:49:18 +0100 Subject: [PATCH 12/13] Fix static code issues --- src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php | 2 +- src/Backup/Path.php | 2 +- src/Backup/Sync/Xtp.php | 7 ++++--- src/Backup/Sync/YandexDisk.php | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php b/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php index db2ed962..5a8efa68 100644 --- a/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php +++ b/src/Backup/Cleaner/Stepwise/Keeper/OnePerGroup.php @@ -27,7 +27,7 @@ class OnePerGroup implements Keeper /** * List of groups containing the files. * - * @var \phpbu\App\Backup\File\Local[][] + * @var \phpbu\App\Backup\File[][] */ private $groups = []; diff --git a/src/Backup/Path.php b/src/Backup/Path.php index b62c6b2d..2866e70c 100644 --- a/src/Backup/Path.php +++ b/src/Backup/Path.php @@ -208,7 +208,7 @@ public function getPathThatIsNotChanging(): string } /** - * Return path when casted to string. + * Return path when cast to string. * * @return string */ diff --git a/src/Backup/Sync/Xtp.php b/src/Backup/Sync/Xtp.php index 52dbd787..baf2e2f0 100644 --- a/src/Backup/Sync/Xtp.php +++ b/src/Backup/Sync/Xtp.php @@ -1,6 +1,7 @@ host = $config['host']; $this->user = $config['user']; $this->password = Util\Arr::getValue($config, 'password', ''); - $this->remotePath = Util\Path::withoutTrailingSlash(Util\Path::replaceDatePlaceholders($path)); + $this->remotePath = new Path(Util\Path::withoutTrailingSlash(Util\Path::replaceDatePlaceholders($path))); } /** @@ -99,7 +100,7 @@ public function simulate(Target $target, Result $result) . ' host: ' . $this->host . PHP_EOL . ' user: ' . $this->user . PHP_EOL . ' password: ********' . PHP_EOL - . ' path: ' . $this->remotePath . PHP_EOL + . ' path: ' . $this->remotePath->getPath() . PHP_EOL ); $this->simulateRemoteCleanup($target, $result); diff --git a/src/Backup/Sync/YandexDisk.php b/src/Backup/Sync/YandexDisk.php index d507d1cf..79859861 100644 --- a/src/Backup/Sync/YandexDisk.php +++ b/src/Backup/Sync/YandexDisk.php @@ -120,7 +120,7 @@ private function createFolders(): void { $folderPath = ''; $folderPaths = explode('/', $this->path->getPath()); - if (!empty($folderPaths)) { + if (count($folderPaths)) { foreach ($folderPaths as $folderPathPart) { if (!empty($folderPathPart)) { $folderPath .= "/$folderPathPart"; From b32f8bf8da48e108b05fa2f05b56e3cd363b6dea Mon Sep 17 00:00:00 2001 From: Sebastian Feldmann Date: Thu, 21 Dec 2023 15:21:42 +0100 Subject: [PATCH 13/13] Update php version --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 786119c7..53328ed1 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ and assists you monitor your backup creation. Get an in depth look into all the features and a short 'getting started' tutorial at the [PHPBU Website](https://phpbu.de). [![Latest Stable Version](https://poser.pugx.org/phpbu/phpbu/v/stable.svg)](https://packagist.org/packages/phpbu/phpbu) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg)](https://php.net/) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg)](https://php.net/) [![Downloads](https://img.shields.io/packagist/dt/phpbu/phpbu.svg?v1)](https://packagist.org/packages/phpbu/phpbu) [![License](https://poser.pugx.org/phpbu/phpbu/license.svg)](https://packagist.org/packages/phpbu/phpbu) [![Build Status](https://github.com/sebastianfeldmann/phpbu/workflows/Integration/badge.svg)](https://github.com/sebastianfeldmann/phpbu/actions) @@ -16,6 +16,7 @@ Get an in depth look into all the features and a short 'getting started' tutoria [![Code Coverage](https://scrutinizer-ci.com/g/sebastianfeldmann/phpbu/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/sebastianfeldmann/phpbu/?branch=master) [![PHP Website](https://img.shields.io/website-up-down-green-red/https/phpbu.de.svg)](https://phpbu.de) +If you are not using php 7.4 or greater already you can still use phpbu version [6.0.20](https://phar.phpbu.de/phpbu-5.2.10.phar) \ If you are not using php 7.2 or greater already you can still use phpbu version [5.2.10](https://phar.phpbu.de/phpbu-5.2.10.phar) \ If you are behind php 7.0 you can still use phpbu version [4.0.10](https://phar.phpbu.de/phpbu-4.0.10.phar)