diff options
author | Florian Hülsmann <fh@cbix.de> | 2012-03-28 18:07:50 +0400 |
---|---|---|
committer | Florian Hülsmann <fh@cbix.de> | 2012-03-28 18:07:50 +0400 |
commit | 98602782eb1d678dceb1f1779b903c88c29a9c63 (patch) | |
tree | b58ef91905f4f2d2ea6e60b30e979cfa8053743b /user_webfinger | |
parent | dda599db5fe544bfb6afa25f5ce97d54663b9194 (diff) |
webfinger installation creates symlink in document root
Diffstat (limited to 'user_webfinger')
-rw-r--r-- | user_webfinger/appinfo/install.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/user_webfinger/appinfo/install.php b/user_webfinger/appinfo/install.php index f570a3a24..9ba953a4e 100644 --- a/user_webfinger/appinfo/install.php +++ b/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 + ); + } + } +} +?> |