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

Add user count and redirect page count statistics

This commit is contained in:
Starbeamrainbowlabs 2018-04-26 23:20:52 +01:00
parent 6fc44b7404
commit 0c00cf3631
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 73 additions and 7 deletions

View file

@ -8,6 +8,8 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Added page moves to the recent changes page (#151) - Added page moves to the recent changes page (#151)
- Hyperlinked image preview on file pages to the original image (#153) - Hyperlinked image preview on file pages to the original image (#153)
- Added the commit hash Pepperminty Wiki was built against to the master settings configuration page, and the debug action - Added the commit hash Pepperminty Wiki was built against to the master settings configuration page, and the debug action
- Added user count statistic
- Added redirect page count statistic
- [Rest API] Added support for the `mode` parameter to the `random` action - [Rest API] Added support for the `mode` parameter to the `random` action
- [Rest API] Added `format` parameter to `recentchanges` action - [Rest API] Added `format` parameter to `recentchanges` action
- [Rest API] Added `comments-fetch` action to return a page's comments as JSON - [Rest API] Added `comments-fetch` action to return a page's comments as JSON

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 = "3c21f371f680b6db44dc2b145809c49a6c56458e"; $commit = "6fc44b7404f98907a9f351b92654a0da7305a92e";
/// Environment /// /// Environment ///
/** Holds information about the current request environment. */ /** Holds information about the current request environment. */
$env = new stdClass(); $env = new stdClass();
@ -4762,7 +4762,21 @@ register_module([
/// Built-in Statisics /// /// Built-in Statisics ///
////////////////////////// //////////////////////////
// The longest pages
statistic_add([
"id" => "user_count",
"name" => "Users",
"type" => "scalar",
"update" => function($old_stats) {
global $settings;
$result = new stdClass(); // completed, value, state
$result->completed = true;
$result->value = count(get_object_vars($settings->users));
return $result;
}
]);
statistic_add([ statistic_add([
"id" => "longest-pages", "id" => "longest-pages",
"name" => "Longest Pages", "name" => "Longest Pages",
@ -4826,6 +4840,24 @@ register_module([
} }
]); ]);
statistic_add([
"id" => "redirect_count",
"name" => "Redirect Pages",
"type" => "scalar",
"update" => function($old_stats) {
global $pageindex;
$result = new stdClass(); // completed, value, state
$result->completed = true;
$result->value = 0;
foreach($pageindex as $pagename => $pagedata) {
if(!empty($pagedata->redirect) && $pagedata->redirect)
$result->value++;
}
return $result;
}
]);
// Perform an automatic recalculation of the statistics if needed // Perform an automatic recalculation of the statistics if needed
if($env->action !== "stats-update") if($env->action !== "stats-update")
update_statistics(false); update_statistics(false);
@ -7929,7 +7961,7 @@ register_module([
register_module([ register_module([
"name" => "Parsedown", "name" => "Parsedown",
"version" => "0.9.10", "version" => "0.9.11",
"author" => "Emanuil Rusev & Starbeamrainbowlabs", "author" => "Emanuil Rusev & Starbeamrainbowlabs",
"description" => "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https://github.com/erusev/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.", "description" => "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https://github.com/erusev/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.",
"id" => "parser-parsedown", "id" => "parser-parsedown",

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": 1505768903, "lastupdate": 1524781183,
"optional": false "optional": false
}, },
{ {
@ -262,11 +262,11 @@
}, },
{ {
"name": "Parsedown", "name": "Parsedown",
"version": "0.9.10", "version": "0.9.11",
"author": "Emanuil Rusev & Starbeamrainbowlabs", "author": "Emanuil Rusev & Starbeamrainbowlabs",
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.", "description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.",
"id": "parser-parsedown", "id": "parser-parsedown",
"lastupdate": 1524780647, "lastupdate": 1524780823,
"optional": false "optional": false
} }
] ]

View file

@ -138,7 +138,21 @@ register_module([
/// Built-in Statisics /// /// Built-in Statisics ///
////////////////////////// //////////////////////////
// The longest pages
statistic_add([
"id" => "user_count",
"name" => "Users",
"type" => "scalar",
"update" => function($old_stats) {
global $settings;
$result = new stdClass(); // completed, value, state
$result->completed = true;
$result->value = count(get_object_vars($settings->users));
return $result;
}
]);
statistic_add([ statistic_add([
"id" => "longest-pages", "id" => "longest-pages",
"name" => "Longest Pages", "name" => "Longest Pages",
@ -202,6 +216,24 @@ register_module([
} }
]); ]);
statistic_add([
"id" => "redirect_count",
"name" => "Redirect Pages",
"type" => "scalar",
"update" => function($old_stats) {
global $pageindex;
$result = new stdClass(); // completed, value, state
$result->completed = true;
$result->value = 0;
foreach($pageindex as $pagename => $pagedata) {
if(!empty($pagedata->redirect) && $pagedata->redirect)
$result->value++;
}
return $result;
}
]);
// Perform an automatic recalculation of the statistics if needed // Perform an automatic recalculation of the statistics if needed
if($env->action !== "stats-update") if($env->action !== "stats-update")
update_statistics(false); update_statistics(false);