Merge pull request #26299 from nextcloud/enh/noid/log-storage-unavailable

Log when a storage is marked as unavailable
This commit is contained in:
Morris Jobke 2021-03-25 17:08:13 +01:00 committed by GitHub
commit c25daf5df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -30,6 +30,7 @@
namespace OC\Files\Cache; namespace OC\Files\Cache;
use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IStorage;
use Psr\Log\LoggerInterface;
/** /**
* Handle the mapping between the string and numeric storage ids * Handle the mapping between the string and numeric storage ids
@ -175,6 +176,9 @@ class Storage {
*/ */
public function setAvailability($isAvailable, int $delay = 0) { public function setAvailability($isAvailable, int $delay = 0) {
$available = $isAvailable ? 1 : 0; $available = $isAvailable ? 1 : 0;
if (!$isAvailable) {
\OC::$server->get(LoggerInterface::class)->info('Storage with ' . $this->storageId . ' marked as unavailable', ['app' => 'lib']);
}
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $query = \OC::$server->getDatabaseConnection()->getQueryBuilder();
$query->update('storages') $query->update('storages')