Move mod_rewrite detection to the client side

This commit is contained in:
Kijin Sung 2016-01-10 15:11:29 +09:00
parent 86bd1b531d
commit 43098721b1
5 changed files with 55 additions and 57 deletions

View file

@ -452,52 +452,6 @@ class installController extends install
}
}
/**
* check this server can use rewrite module
* make a file to files/config and check url approach by ".htaccess" rules
*
* @return bool
*/
function checkRewriteUsable() {
$checkString = "isApproached";
$checkFilePath = 'files/config/tmpRewriteCheck.txt';
FileHandler::writeFile(_XE_PATH_.$checkFilePath, trim($checkString));
$scheme = ($_SERVER['HTTPS'] === 'on') ? 'https' : 'http';
$hostname = $_SERVER['SERVER_NAME'];
$port = $_SERVER['SERVER_PORT'];
$str_port = '';
if($port)
{
$str_port = ':' . $port;
}
$tmpPath = $_SERVER['DOCUMENT_ROOT'];
//if DIRECTORY_SEPARATOR is not /(IIS)
if(DIRECTORY_SEPARATOR !== '/')
{
//change to slash for compare
$tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']);
}
$query = "/JUST/CHECK/REWRITE/" . $checkFilePath;
$currentPath = str_replace($tmpPath, "", _XE_PATH_);
if($currentPath != "")
{
$query = $currentPath . $query;
}
$requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query);
$requestConfig = array();
$requestConfig['ssl_verify_peer'] = false;
$buff = FileHandler::getRemoteResource($requestUrl, null, 3, 'GET', null, array(), array(), array(), $requestConfig);
FileHandler::removeFile(_XE_PATH_.$checkFilePath);
return (trim($buff) == $checkString);
}
/**
* @brief Create files and subdirectories
* Local evironment setting before installation by using DB information