Removes folderstatus extension.

This commit is contained in:
Lars Jung 2012-10-06 15:10:04 +02:00
parent 029872a212
commit c6a9374488
4 changed files with 3 additions and 79 deletions

View file

@ -1,10 +0,0 @@
modulejs.define('ext/folderstatus', ['_', 'core/settings'], function (_, allsettings) {
var settings = _.extend({
enabled: false,
folders: {}
}, allsettings.folderstatus);
return settings.enabled ? settings.folders : {};
});

View file

@ -130,21 +130,6 @@ options, types and langs
"enabled": true "enabled": true
}, },
/* [all]
Associative array of folders and their HTTP status codes to
avoid HEAD requests to that folders. The key (folder) must start
and end with a slash (/).
For example
"/some/folder/": 200
will always return HTTP status 200 (OK), which will be interpreted
as a non auto indexed folder, that means a folder containing an
appropriate default index file.
*/
"folderstatus": {
"enabled": true,
"folders": {}
},
/* [all] /* [all]
Adds Google Analytics asynchronous tracking code. Adds Google Analytics asynchronous tracking code.
@ -313,10 +298,7 @@ options, types and langs
/* [all] /* [all]
Show a folder tree. Show a folder tree.
Note that this tree might have side effects as it sends HEAD requests Note that this might affect performance significantly.
to the folders, and therefore will invoke index.php scripts. Use
"folderstatus" above to avoid such requests.
It might also affect performance significantly.
Slide tree bar into viewport if there is enough space. Slide tree bar into viewport if there is enough space.
*/ */

View file

@ -152,20 +152,6 @@ class H5ai {
return null; return null;
} }
if ($this->options["folderstatus"]["enabled"]) {
$folders = $this->options["folderstatus"]["folders"];
if (array_key_exists($absHref, $folders)) {
return $folders[$absHref];
}
}
// return $this->fetchHttpCode($absHref);
return $this->guessHttpCode($absHref);
}
public function guessHttpCode($absHref) {
$absPath = $this->getAbsPath($absHref); $absPath = $this->getAbsPath($absHref);
foreach ($this->index_files as $if) { foreach ($this->index_files as $if) {
@ -181,40 +167,6 @@ class H5ai {
} }
public function fetchHttpCode($absHref) {
$host = getenv("HTTP_HOST");
$port = getenv("SERVER_PORT");
$msg = "HEAD $absHref HTTP/1.1\r\nHost: $host\r\nConnection: Close\r\n";
if (isset($_SERVER['PHP_AUTH_USER'])) {
$msg .= "Authorization: Basic " . base64_encode($_SERVER['PHP_AUTH_USER'] . ":" . $_SERVER['PHP_AUTH_PW']) . "\r\n";
}
$msg .= "\r\n";
$errno = "";
$errstr = "";
$socket = fsockopen($host, $port, $errno, $errstr, 30);
if($socket === 0) {
return null;
}
fwrite($socket, $msg);
$content = fgets($socket);
$code = intval(trim(substr($content, 9, 4)));
if ($code === 200) {
while ($content !== false && stripos($content, "Content-Type") === false) {
$content = fgets($socket);
}
if (stripos($content, H5ai::$H5AI_CONTENT_TYPE) !== false) {
$code = "h5ai";
}
}
fclose($socket);
return $code;
}
private function fileExists($file) { private function fileExists($file) {
return is_string($file) && file_exists($file); return is_string($file) && file_exists($file);

View file

@ -14,10 +14,10 @@ function normalized_require_once($lib) {
require_once(APP_ABS_PATH . $lib); require_once(APP_ABS_PATH . $lib);
} }
normalized_require_once("/conf/config.php"); normalized_require_once("/server/php/inc/util.php");
normalized_require_once("/server/php/inc/App.php"); normalized_require_once("/server/php/inc/App.php");
normalized_require_once("/server/php/inc/Entry.php"); normalized_require_once("/server/php/inc/Entry.php");
normalized_require_once("/server/php/inc/util.php"); normalized_require_once("/conf/config.php");
$APP = new H5ai(APP_ABS_PATH, APP_ABS_HREF); $APP = new H5ai(APP_ABS_PATH, APP_ABS_HREF);