Example #1
0
 /**
  * Append the correct ErrorDocument path for Apache hosts
  *
  * @throws \OC\HintException If .htaccess does not include the current version
  */
 public static function updateHtaccess()
 {
     $setupHelper = new OC_Setup(\OC::$server->getConfig());
     if (!$setupHelper->isCurrentHtaccess()) {
         throw new \OC\HintException('.htaccess file has the wrong version. Please upload the correct version. Maybe you forgot to replace it after updating?');
     }
     $content = "\n";
     $content .= "ErrorDocument 403 " . OC::$WEBROOT . "/core/templates/403.php\n";
     //custom 403 error page
     $content .= "ErrorDocument 404 " . OC::$WEBROOT . "/core/templates/404.php";
     //custom 404 error page
     @file_put_contents($setupHelper->pathToHtaccess(), $content, FILE_APPEND);
     //suppress errors in case we don't have permissions for it
 }