aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Setup.php
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-07-11 20:53:37 +0200
committerAndy Scherzinger <info@andy-scherzinger.de>2024-08-08 22:08:42 +0200
commit0563757ea43b853770305f80c763a547525abf66 (patch)
treec07ae092b92002e7a2f98fcdb55449e6306d092f /lib/private/Setup.php
parent8c0bece57aee2aca571650e6c2decad27088a5ae (diff)
downloadnextcloud-server-0563757ea43b853770305f80c763a547525abf66.tar.gz
nextcloud-server-0563757ea43b853770305f80c763a547525abf66.zip
fix(SetupCheck): Properly check public access to data directory
When checking for public (web) access to the data directory the status is not enough as you might have a webserver that forwards to e.g. a login page. So instead check that the content of the file matches. For this the `.ncdata` file (renamed from `.ocdata`¹) has minimal text content to allow checking. ¹The file was renamed from the legacy `.ocdata`, there is a repair step to remove the old one. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/Setup.php')
-rw-r--r--lib/private/Setup.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index a67d74bd032..62db4879bbc 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -360,9 +360,12 @@ class Setup {
Installer::installShippedApps(false, $output);
// create empty file in data dir, so we can later find
- // out that this is indeed an ownCloud data directory
+ // out that this is indeed a Nextcloud data directory
$this->outputDebug($output, 'Setup data directory');
- file_put_contents($config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
+ file_put_contents(
+ $config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ncdata',
+ "# Nextcloud data directory\n# Do not change this file",
+ );
// Update .htaccess files
self::updateHtaccess();