summaryrefslogtreecommitdiffstats
path: root/owncloud-9.0.4-further_htaccess_cleanup.patch
blob: b7091026671c7aa713bef59a9bdaa8362504dd5d (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
commit a8c9a64d54bbf547017f58a943e04efcb3d8d6f5
Author: James Hogarth <james.hogarth@gmail.com>
Date:   Tue Jul 19 12:34:06 2016 +0100

    kill htaccess updates

diff --git a/lib/private/setup.php b/lib/private/setup.php
index a2f8fdd..f5be6e2 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -396,69 +396,7 @@ class Setup {
 	 * Append the correct ErrorDocument path for Apache hosts
 	 */
 	public static function updateHtaccess() {
-		$config = \OC::$server->getConfig();
-
-		// For CLI read the value from overwrite.cli.url
-		if(\OC::$CLI) {
-			$webRoot = $config->getSystemValue('overwrite.cli.url', '');
-			if($webRoot === '') {
-				return;
-			}
-			$webRoot = parse_url($webRoot, PHP_URL_PATH);
-			$webRoot = rtrim($webRoot, '/');
-		} else {
-			$webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';
-		}
-
-		$setupHelper = new \OC\Setup($config, \OC::$server->getIniWrapper(),
-			\OC::$server->getL10N('lib'), new \OC_Defaults(), \OC::$server->getLogger(),
-			\OC::$server->getSecureRandom());
-
-		$htaccessContent = file_get_contents($setupHelper->pathToHtaccess());
-		$content = "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####\n";
-		$htaccessContent = explode($content, $htaccessContent, 2)[0];
-
-		//custom 403 error page
-		$content.= "\nErrorDocument 403 ".$webRoot."/core/templates/403.php";
-
-		//custom 404 error page
-		$content.= "\nErrorDocument 404 ".$webRoot."/core/templates/404.php";
-
-		// Add rewrite rules if the RewriteBase is configured
-		$rewriteBase = $config->getSystemValue('htaccess.RewriteBase', '');
-		if($rewriteBase !== '') {
-			$content .= "\n<IfModule mod_rewrite.c>";
-			$content .= "\n  Options -MultiViews";
-			$content .= "\n  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]";
-			$content .= "\n  RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !\\.(css|js|svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/remote.php";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/public.php";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/cron.php";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/status.php";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/updater/";
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs-provider/";
-			$content .= "\n  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*";
-			$content .= "\n  RewriteRule . index.php [PT,E=PATH_INFO:$1]";
-			$content .= "\n  RewriteBase " . $rewriteBase;
-			$content .= "\n  <IfModule mod_env.c>";
-			$content .= "\n    SetEnv front_controller_active true";
-			$content .= "\n    <IfModule mod_dir.c>";
-			$content .= "\n      DirectorySlash off";
-			$content .= "\n    </IfModule>";
-			$content .= "\n  </IfModule>";
-			$content .= "\n</IfModule>";
-		}
-
-		if ($content !== '') {
-			//suppress errors in case we don't have permissions for it
-			@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n");
-		}
-
+        return true;
 	}
 
 	public static function protectDataDirectory() {