commit a8c9a64d54bbf547017f58a943e04efcb3d8d6f5 Author: James Hogarth 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"; - $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 "; - $content .= "\n SetEnv front_controller_active true"; - $content .= "\n "; - $content .= "\n DirectorySlash off"; - $content .= "\n "; - $content .= "\n "; - $content .= "\n"; - } - - 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() {