aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_webfinger/appinfo
diff options
context:
space:
mode:
authorFlorian Hülsmann <fh@cbix.de>2012-03-28 16:07:50 +0200
committerFlorian Hülsmann <fh@cbix.de>2012-03-28 16:07:50 +0200
commitbcda46eda3b3b9208609bc5a9497632aa0dabfa9 (patch)
treef9fcfe8f36356b140513851c38f79c995bb4fe1d /apps/user_webfinger/appinfo
parentcb2dd97509ffd039fbd321aea4a8d631e3effcc7 (diff)
downloadnextcloud-server-bcda46eda3b3b9208609bc5a9497632aa0dabfa9.tar.gz
nextcloud-server-bcda46eda3b3b9208609bc5a9497632aa0dabfa9.zip
webfinger installation creates symlink in document root
Diffstat (limited to 'apps/user_webfinger/appinfo')
-rw-r--r--apps/user_webfinger/appinfo/install.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/apps/user_webfinger/appinfo/install.php b/apps/user_webfinger/appinfo/install.php
index f570a3a249b..9ba953a4e60 100644
--- a/apps/user_webfinger/appinfo/install.php
+++ b/apps/user_webfinger/appinfo/install.php
@@ -3,4 +3,34 @@ $appInfoDir = __DIR__;
$thisAppDir = dirname($appInfoDir);
$appsDir = dirname($thisAppDir);
$ownCloudDir = dirname($appsDir);
-@symlink($thisAppDir, $ownCloudDir.'/.well-known');
+$docRoot = $_SERVER['DOCUMENT_ROOT'];
+if(file_exists($docRoot . '/.well-known/host-meta')) {
+ OC_Log::write(
+ 'user_webfinger',
+ $docRoot . "/.well-known already exists; installation aborted",
+ OC_Log::ERROR
+ );
+} else {
+ if(@symlink($thisAppDir, $docRoot . '/.well-known')) {
+ OC_Log::write(
+ 'user_webfinger',
+ "Webfinger symlink created at " . $docRoot . "/.well-known",
+ OC_Log::INFO
+ );
+ } else {
+ if(@symlink($thisAppDir, $ownCloudDir . '/.well-known')) {
+ OC_Log::write(
+ 'user_webfinger',
+ "Couldn't create webfinger symlink in document root, linked to " . $ownCloudDir . "/.well-known instead",
+ OC_Log::WARN
+ );
+ } else {
+ OC_Log::write(
+ 'user_webfinger',
+ "Couldn't create webfinger symlink, either check write permissions or create the link manually!",
+ OC_Log::ERROR
+ );
+ }
+ }
+}
+?>