Skip to content

Commit e3a8a54

Browse files
Merge branch 'master' into 5.1
2 parents f5027b7 + eab5192 commit e3a8a54

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

phpstan.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ parameters:
66
- '#Call to an undefined method SebastianFeldmann\\Ftp\\Client::delete\(\)#'
77
- '#Call to an undefined method ObjectStorage_Abstract::setLocalFile\(\)#'
88
- '#Instantiated class phpbu\\App\\Runner\\Restore not found#'
9-
- '#Cannot cast DateTimeImmutable to int#'
10-
- '#Cannot call method getTimestamp\(\) on string#'

src/Backup/Collector/Dropbox.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ protected function collectBackups()
4949
$items = $this->client->listFolder(
5050
Util\Path::withTrailingSlash($this->path->getPathThatIsNotChanging()),
5151
[
52-
'limit' => 100,
53-
'recursive' => true,
52+
'recursive' => true
5453
]
5554
);
5655
/** @var \Kunnu\Dropbox\Models\FileMetadata $item */

src/Log/Mail.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ public function onPhpbuEnd(Event\App\End $event)
197197
. $info
198198
. $footer
199199
. '</body></html>';
200-
$sent = null;
201200
$state = $result->allOk() ? 'OK' : ($result->backupOkButSkipsOrFails() ? 'WARNING' : 'ERROR');
202201

203202
$this->mailer->Subject = $this->subject . ' [' . $state . ']';
@@ -208,8 +207,8 @@ public function onPhpbuEnd(Event\App\End $event)
208207
$this->mailer->addAddress($recipient);
209208
}
210209

211-
if (!$this->mailer->send()) {
212-
throw new Exception($this->mailer->ErrorInfo);
210+
if ($this->transportType !== 'null') {
211+
$this->sendMail();
213212
}
214213
}
215214
}
@@ -351,6 +350,22 @@ protected function setupSendmailMailer(array $options)
351350
// nothing to do here
352351
}
353352

353+
/**
354+
* Send the email
355+
*
356+
* @throws \phpbu\App\Exception
357+
*/
358+
protected function sendMail()
359+
{
360+
try {
361+
if (!$this->mailer->send()) {
362+
throw new Exception($this->mailer->ErrorInfo);
363+
}
364+
} catch (\Exception $e) {
365+
throw new Exception($e->getMessage());
366+
}
367+
}
368+
354369
/**
355370
* Return mail header html
356371
*

tests/phpbu/Backup/Collector/DropboxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function ($item) {
6666

6767
$dropboxClientStub->expects($this->once())
6868
->method('listFolder')
69-
->with('backups/', ['limit' => 100, 'recursive' => true])
69+
->with('backups/', ['recursive' => true])
7070
->willReturn($dropboxFileListResult);
7171

7272
$time = time();

0 commit comments

Comments
 (0)