File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed
tests/phpbu/Backup/Collector Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff 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 #'
Original file line number Diff line number Diff 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 */
Original file line number Diff line number Diff 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 *
Original file line number Diff line number Diff 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 ();
You can’t perform that action at this time.
0 commit comments