diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-03-26 14:51:33 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-03-28 13:59:22 +0100 |
commit | 65202d2a18aca3b253ce5f3c7c9af17ee6d12e52 (patch) | |
tree | 04453d95db5dc3df386188cd85032052fded6db9 /lib/private | |
parent | d3752ca1e925c3aed46c13f7ea26c8f540db05e0 (diff) | |
download | nextcloud-server-65202d2a18aca3b253ce5f3c7c9af17ee6d12e52.tar.gz nextcloud-server-65202d2a18aca3b253ce5f3c7c9af17ee6d12e52.zip |
Add check for activated local memcache
Also used the opportunity to refactor it into an AppFramework controller so that we can unit test it.
Fixes https://github.com/owncloud/core/issues/14956
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/setup.php | 3 | ||||
-rw-r--r-- | lib/private/util.php | 43 |
2 files changed, 8 insertions, 38 deletions
diff --git a/lib/private/setup.php b/lib/private/setup.php index 1aa2af124c6..7ca30e172ec 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -181,7 +181,8 @@ class Setup { \OC\Setup::protectDataDirectory(); try { - $htAccessWorking = \OC_Util::isHtaccessWorking(); + $util = new \OC_Util(); + $htAccessWorking = $util->isHtaccessWorking(\OC::$server->getConfig()); } catch (\OC\HintException $e) { $errors[] = array( 'error' => $e->getMessage(), diff --git a/lib/private/util.php b/lib/private/util.php index 5aa65401b9a..e423bb6a7df 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1155,14 +1155,13 @@ class OC_Util { /** * Check if the .htaccess file is working - * - * @throws OC\HintException If the testfile can't get written. + * @param \OCP\IConfig $config * @return bool - * @description Check if the .htaccess file is working by creating a test - * file in the data directory and trying to access via http + * @throws Exception + * @throws \OC\HintException If the test file can't get written. */ - public static function isHtaccessWorking() { - if (\OC::$CLI || !OC::$server->getConfig()->getSystemValue('check_for_working_htaccess', true)) { + public function isHtaccessWorking(\OCP\IConfig $config) { + if (\OC::$CLI || !$config->getSystemValue('check_for_working_htaccess', true)) { return true; } @@ -1176,7 +1175,7 @@ class OC_Util { $testContent = 'testcontent'; // creating a test file - $testFile = OC::$server->getConfig()->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; if (file_exists($testFile)) {// already running this test, possible recursive call return false; @@ -1245,36 +1244,6 @@ class OC_Util { } /** - * Check if the ownCloud server can connect to the internet - * - * @param \OCP\Http\Client\IClientService $clientService - * @return bool - */ - public static function isInternetConnectionWorking(\OCP\Http\Client\IClientService $clientService) { - // in case there is no internet connection on purpose return false - if (self::isInternetConnectionEnabled() === false) { - return false; - } - - try { - $client = $clientService->newClient(); - $response = $client->get('https://www.owncloud.org/'); - return $response->getStatusCode() === 200; - } catch (\Exception $e) { - return false; - } - } - - /** - * Check if the connection to the internet is disabled on purpose - * - * @return string - */ - public static function isInternetConnectionEnabled() { - return \OC_Config::getValue("has_internet_connection", true); - } - - /** * clear all levels of output buffering * * @return void |