summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-09-10 22:05:20 +0200
committerBart Visscher <bartv@thisnet.nl>2013-09-10 22:05:20 +0200
commit65aab3dc8c88f012e063ccea7cacc17f528b7d4d (patch)
tree281c65eb0e9095dc1bcd68c9ef51ae1afa9018ed
parent8ae612f6930235aa1768d3a5beeff65a3565d90a (diff)
downloadnextcloud-server-65aab3dc8c88f012e063ccea7cacc17f528b7d4d.tar.gz
nextcloud-server-65aab3dc8c88f012e063ccea7cacc17f528b7d4d.zip
Check for failure in creating htaccessWorking testfile
-rw-r--r--core/setup/controller.php14
-rwxr-xr-xlib/util.php12
2 files changed, 20 insertions, 6 deletions
diff --git a/core/setup/controller.php b/core/setup/controller.php
index 54bfe14612a..8ddcf19bb6d 100644
--- a/core/setup/controller.php
+++ b/core/setup/controller.php
@@ -60,8 +60,18 @@ class Controller {
$vulnerableToNullByte = true;
}
+ $errors = array();
+
// Protect data directory here, so we can test if the protection is working
\OC_Setup::protectDataDirectory();
+ try {
+ $htaccessworking = \OC_Util::isHtAccessWorking();
+ } catch (\OC\HintException $e) {
+ $errors[] = array(
+ 'error' => $e->getMessage(),
+ 'hint' => $e->getHint()
+ );
+ }
return array(
'hasSQLite' => $hasSQLite,
@@ -71,9 +81,9 @@ class Controller {
'hasMSSQL' => $hasMSSQL,
'directory' => $datadir,
'secureRNG' => \OC_Util::secureRNGAvailable(),
- 'htaccessWorking' => \OC_Util::isHtAccessWorking(),
+ 'htaccessWorking' => $htaccessWorking,
'vulnerableToNullByte' => $vulnerableToNullByte,
- 'errors' => array(),
+ 'errors' => $errors,
);
}
}
diff --git a/lib/util.php b/lib/util.php
index 0777643a952..e8e3bc37e5f 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -689,9 +689,13 @@ class OC_Util {
return false;
}
- $fp = @fopen($testfile, 'w');
- @fwrite($fp, $testcontent);
- @fclose($fp);
+ $fp = @fopen($testFile, 'w');
+ if (!$fp) {
+ throw new OC\HintException('Can\'t create test file to check for working .htaccess file.',
+ 'Make sure it is possible for the webserver to write to '.$testFile);
+ }
+ fwrite($fp, $testContent);
+ fclose($fp);
// accessing the file via http
$url = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/data'.$fileName);
@@ -700,7 +704,7 @@ class OC_Util {
@fclose($fp);
// cleanup
- @unlink($testfile);
+ @unlink($testFile);
// does it work ?
if($content==$testContent) {