/** * @AdminRequired * @NoCSRFRequired */ public function Check() { \OCP\JSON::setContentTypeHeader('application/json'); if ($this->Allow) { try { $LastVersionNumber = Tools::GetLastVersionNumber(); $AppVersion = \OCP\App::getAppVersion('ocdownloader'); $Response = array('ERROR' => false, 'RESULT' => version_compare($AppVersion, $LastVersionNumber, '<')); } catch (Exception $E) { $Response = array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Error while checking application version on GitHub')); } } else { $Response = array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('You are not allowed to check for application updates')); } return new JSONResponse($Response); }