Log exception

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2019-02-06 20:39:15 +01:00 committed by Morris Jobke
parent 382495e26d
commit 11a27b247f
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
2 changed files with 10 additions and 5 deletions

View File

@ -149,7 +149,7 @@ class Repair implements IOutput {
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getLogger()),
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache')),
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->getLogger()),
];
}

View File

@ -22,11 +22,11 @@ declare(strict_types=1);
namespace OC\Repair\NC16;
use OC\Files\AppData\AppData;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
@ -44,12 +44,16 @@ class CleanupCardDAVPhotoCache implements IRepairStep {
/** @var IConfig */
private $config;
/** @var AppData */
/** @var IAppData */
private $appData;
public function __construct(IConfig $config, IAppData $appData) {
/** @var ILogger */
private $logger;
public function __construct(IConfig $config, IAppData $appData, ILogger $logger) {
$this->config = $config;
$this->appData = $appData;
$this->logger = $logger;
}
public function getName(): string {
@ -78,7 +82,8 @@ class CleanupCardDAVPhotoCache implements IRepairStep {
/** @var ISimpleFolder $folder */
$folder->getFile('photo.')->delete();
} catch (\Exception $e) {
$output->warning('Could not delete "photo." file in dav-photocache/' . $folder->getName());
$this->logger->logException($e);
$output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."');
}
}
}