diff --git a/apps/updatenotification/controller/admincontroller.php b/apps/updatenotification/controller/admincontroller.php index 5dbcc685809..94c2828dbeb 100644 --- a/apps/updatenotification/controller/admincontroller.php +++ b/apps/updatenotification/controller/admincontroller.php @@ -79,6 +79,33 @@ class AdminController extends Controller { $this->dateTimeFormatter = $dateTimeFormatter; } + /** + * Whether the instance is compatible with the updater + * + * @return bool + */ + protected function isCompatibleWithUpdater() { + $updaterCompatible = true; + if(!function_exists('proc_open') || !function_exists('shell_exec')) { + $updaterCompatible = false; + } else { + $whichUnzip = shell_exec('command -v unzip'); + if(!class_exists('ZipArchive') && empty($whichUnzip)) { + $updaterCompatible = false; + } + + $whichPhp = shell_exec('command -v php'); + if(empty($whichPhp)) { + $updaterCompatible = false; + } + } + if(!function_exists('curl_exec')) { + $updaterCompatible = false; + } + + return $updaterCompatible; + } + /** * @return TemplateResponse */ @@ -94,7 +121,6 @@ class AdminController extends Controller { 'production', ]; $currentChannel = \OCP\Util::getChannel(); - // Remove the currently used channel from the channels list if(($key = array_search($currentChannel, $channels)) !== false) { unset($channels[$key]); @@ -106,6 +132,7 @@ class AdminController extends Controller { 'currentChannel' => $currentChannel, 'channels' => $channels, 'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'], + 'updaterRequirementsFulfilled' => $this->isCompatibleWithUpdater(), ]; return new TemplateResponse($this->appName, 'admin', $params, ''); diff --git a/apps/updatenotification/templates/admin.php b/apps/updatenotification/templates/admin.php index c1adc8d0d3e..e9de87304c5 100644 --- a/apps/updatenotification/templates/admin.php +++ b/apps/updatenotification/templates/admin.php @@ -12,13 +12,19 @@ $channels = $_['channels']; /** @var string $currentChannel */ $currentChannel = $_['currentChannel']; + /** @var bool $updaterRequirementsFulfilled */ + $updaterRequirementsFulfilled = $_['updaterRequirementsFulfilled']; ?>