1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-24 17:13:01 +00:00

Make longest pages statistic use page-list too

This commit is contained in:
Starbeamrainbowlabs 2018-04-28 11:13:58 +01:00
parent 1f190da2df
commit d8ee42f5dd
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 7 additions and 17 deletions

View file

@ -39,6 +39,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Disallow uploads if editing is disabled. Previously files could still be uploaded even if editing was disabled - unless `upload_enabled` was set to `false`. - Disallow uploads if editing is disabled. Previously files could still be uploaded even if editing was disabled - unless `upload_enabled` was set to `false`.
- Added `x-login-required: yes` header to responses that redirect to the login page for easy detection by machines - Added `x-login-required: yes` header to responses that redirect to the login page for easy detection by machines
- Added `x-login-success: (yes|no)` header to login responses for easier machine parsing - Added `x-login-success: (yes|no)` header to login responses for easier machine parsing
- Enhance the longest pages statistic rendering
### Removed ### Removed
- [Module API] Removed `accept_contains_mime`, as it's both unstable and currently unnecessary. Contributions for a better version are welcome! - [Module API] Removed `accept_contains_mime`, as it's both unstable and currently unnecessary. Contributions for a better version are welcome!

View file

@ -387,7 +387,7 @@ if($settings->css === "auto")
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */ /** The version of Pepperminty Wiki currently running. */
$version = "v0.16-dev"; $version = "v0.16-dev";
$commit = "72825f87552618c6a7bd99507d3b588652eea1f6"; $commit = "1f190da2df88cf16caad5fe7f82ea9437c78ff9f";
/// Environment /// /// Environment ///
/** Holds information about the current request environment. */ /** Holds information about the current request environment. */
$env = new stdClass(); $env = new stdClass();
@ -4781,7 +4781,7 @@ register_module([
statistic_add([ statistic_add([
"id" => "longest-pages", "id" => "longest-pages",
"name" => "Longest Pages", "name" => "Longest Pages",
"type" => "page", "type" => "page-list",
"update" => function($old_stats) { "update" => function($old_stats) {
global $pageindex; global $pageindex;
@ -4792,7 +4792,7 @@ register_module([
} }
arsort($pages); arsort($pages);
$result->value = $pages; $result->value = array_keys($pages);
$result->completed = true; $result->completed = true;
return $result; return $result;
}, },

View file

@ -113,7 +113,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "An extensible statistics calculation system. Comes with a range of built-in statistics, but can be extended by other modules too.", "description": "An extensible statistics calculation system. Comes with a range of built-in statistics, but can be extended by other modules too.",
"id": "feature-stats", "id": "feature-stats",
"lastupdate": 1524909895, "lastupdate": 1524910399,
"optional": false "optional": false
}, },
{ {

View file

@ -157,7 +157,7 @@ register_module([
statistic_add([ statistic_add([
"id" => "longest-pages", "id" => "longest-pages",
"name" => "Longest Pages", "name" => "Longest Pages",
"type" => "page", "type" => "page-list",
"update" => function($old_stats) { "update" => function($old_stats) {
global $pageindex; global $pageindex;
@ -168,20 +168,9 @@ register_module([
} }
arsort($pages); arsort($pages);
$result->value = $pages; $result->value = array_keys($pages);
$result->completed = true; $result->completed = true;
return $result; return $result;
},
"render" => function($stats_data) {
$result = "<h2>$stats_data->name</h2>\n";
$result .= "<ol class='stats-list longest-pages-list'>\n";
$i = 0;
foreach($stats_data->value as $pagename => $page_length) {
$result .= "\t<li class='stats-item long-page'>$pagename <em>(" . human_filesize($page_length) . ")</em></li>\n";
$i++;
}
$result .= "</ol>\n";
return $result;
} }
]); ]);