Added wiki size to dev help. Fixes #97.
This commit is contained in:
parent
6de0547715
commit
6411ce9b2a
|
@ -621,6 +621,17 @@ function mb_stripos_all($haystack, $needle) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests whether a string ends with a given substring.
|
||||||
|
* @param string $whole The string to test against.
|
||||||
|
* @param string $end The substring test for.
|
||||||
|
* @return bool Whether $whole ends in $end.
|
||||||
|
*/
|
||||||
|
function endsWith($whole, $end)
|
||||||
|
{
|
||||||
|
return (strpos($whole, $end, strlen($whole) - strlen($end)) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the system's mime type mappings, considering the first extension
|
* Returns the system's mime type mappings, considering the first extension
|
||||||
* listed to be cacnonical.
|
* listed to be cacnonical.
|
||||||
|
@ -3998,6 +4009,17 @@ register_module([
|
||||||
|
|
||||||
$content .= "<li>The id index is currently " . human_filesize(filesize($paths->idindex)) . " in size, and took " . $env->perfdata->idindex_decode_time . "ms to decode.</li>";
|
$content .= "<li>The id index is currently " . human_filesize(filesize($paths->idindex)) . " in size, and took " . $env->perfdata->idindex_decode_time . "ms to decode.</li>";
|
||||||
|
|
||||||
|
$wikiSize = 0;
|
||||||
|
$wikiFiles = glob_recursive($env->storage_prefix . "*");
|
||||||
|
foreach($wikiFiles as $filename)
|
||||||
|
{
|
||||||
|
if(endsWith($filename, ".php")) continue; // Skip php files
|
||||||
|
$wikiSize += filesize($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
$content .= "<li>$settings->sitename is currently " . human_filesize($wikiSize) . " in size.</li>\n";
|
||||||
|
|
||||||
|
$content .= "</ul>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
11
core.php
11
core.php
|
@ -320,6 +320,17 @@ function mb_stripos_all($haystack, $needle) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests whether a string ends with a given substring.
|
||||||
|
* @param string $whole The string to test against.
|
||||||
|
* @param string $end The substring test for.
|
||||||
|
* @return bool Whether $whole ends in $end.
|
||||||
|
*/
|
||||||
|
function endsWith($whole, $end)
|
||||||
|
{
|
||||||
|
return (strpos($whole, $end, strlen($whole) - strlen($end)) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the system's mime type mappings, considering the first extension
|
* Returns the system's mime type mappings, considering the first extension
|
||||||
* listed to be cacnonical.
|
* listed to be cacnonical.
|
|
@ -131,7 +131,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds a rather useful help page. Access through the 'help' action. This module also exposes help content added to Pepperminty Wiki's inbuilt invisible help section system.",
|
"description": "Adds a rather useful help page. Access through the 'help' action. This module also exposes help content added to Pepperminty Wiki's inbuilt invisible help section system.",
|
||||||
"id": "page-help",
|
"id": "page-help",
|
||||||
"lastupdate": 1471688804,
|
"lastupdate": 1471697360,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
|
@ -64,6 +64,17 @@ register_module([
|
||||||
|
|
||||||
$content .= "<li>The id index is currently " . human_filesize(filesize($paths->idindex)) . " in size, and took " . $env->perfdata->idindex_decode_time . "ms to decode.</li>";
|
$content .= "<li>The id index is currently " . human_filesize(filesize($paths->idindex)) . " in size, and took " . $env->perfdata->idindex_decode_time . "ms to decode.</li>";
|
||||||
|
|
||||||
|
$wikiSize = 0;
|
||||||
|
$wikiFiles = glob_recursive($env->storage_prefix . "*");
|
||||||
|
foreach($wikiFiles as $filename)
|
||||||
|
{
|
||||||
|
if(endsWith($filename, ".php")) continue; // Skip php files
|
||||||
|
$wikiSize += filesize($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
$content .= "<li>$settings->sitename is currently " . human_filesize($wikiSize) . " in size.</li>\n";
|
||||||
|
|
||||||
|
$content .= "</ul>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
Loading…
Reference in New Issue