-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2858 from nextcloud/enh/noid/add-low-space-notifi…
…cation add low-on-space notification
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
// increase memory limit to 2GB | ||
ini_set('memory_limit', '2048M'); | ||
|
||
use DI\Container; | ||
use AIO\Data\DataConst; | ||
|
||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
$container = \AIO\DependencyInjection::GetContainer(); | ||
|
||
/** @var \AIO\Docker\DockerActionManager $dockerActionManger */ | ||
$dockerActionManger = $container->get(\AIO\Docker\DockerActionManager::class); | ||
/** @var \AIO\ContainerDefinitionFetcher $containerDefinitionFetcher */ | ||
$containerDefinitionFetcher = $container->get(\AIO\ContainerDefinitionFetcher::class); | ||
|
||
$id = 'nextcloud-aio-nextcloud'; | ||
$nextcloudContainer = $containerDefinitionFetcher->GetContainerById($id); | ||
|
||
$df = disk_free_space(DataConst::GetDataDirectory()); | ||
if ($df !== false && (int)$df < 1024 * 1024 * 1024 * 5) { | ||
error_log("The drive that hosts the mastercontainer volume has less than 5 GB free space. Container updates and backups might not succeed due to that!"); | ||
$dockerActionManger->sendNotification($nextcloudContainer, 'Low on space!', 'The drive that hosts the mastercontainer volume has less than 5 GB free space. Container updates and backups might not succeed due to that!'); | ||
} |