summaryrefslogtreecommitdiffstats
path: root/apps/user_webfinger/appinfo/install.php
blob: 775141dce41388e3e3f50eaba0f75af34871e3dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
$appInfoDir = __DIR__;
$thisAppDir = dirname($appInfoDir);
$appsDir = dirname($thisAppDir);
$ownCloudDir = dirname($appsDir);
$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
            );
        }
    }
}
?>