Make orphan pages list use page-list statistic type

Also add count to page-list
This commit is contained in:
Starbeamrainbowlabs 2018-04-28 11:06:23 +01:00
parent 72825f8755
commit 1f190da2df
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
4 changed files with 7 additions and 29 deletions

View File

@ -387,7 +387,7 @@ if($settings->css === "auto")
/////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */
$version = "v0.16-dev";
$commit = "de61612b18b88b9a2e91d1bc7b85438221d88762";
$commit = "72825f87552618c6a7bd99507d3b588652eea1f6";
/// Environment ///
/** Holds information about the current request environment. */
$env = new stdClass();
@ -4685,6 +4685,7 @@ register_module([
$content .= "<p>$settings->sitename doesn't current have the page listing module installed, so HTML rendering of this statistic is currently unavailable. Try <a href='mailto:" . hide_email($settings->admindetails_email) . "'>contacting $settings->admindetails_name</a>, $settings->sitename's administrator and asking then to install the <code>page-list</code> module.</p>";
break;
}
$content .= "<p><strong>Count:</strong> " . count($stats->{$_GET["stat"]}->value) . "</p>\n";
$content .= generate_page_list($stats->{$_GET["stat"]}->value);
break;
@ -8034,7 +8035,7 @@ register_module([
statistic_add([
"id" => "orphan-pages",
"name" => "Orphan Pages",
"type" => "page",
"type" => "page-list",
"update" => function($old_stats) {
global $pageindex, $env;
@ -8066,18 +8067,6 @@ register_module([
$result->value = $orphaned_pages;
$result->completed = true;
return $result;
},
"render" => function($stats_data) {
global $pageindex;
$result = "<h2>$stats_data->name</h2>\n";
$result .= "<p><strong>Count:</strong> " . count($stats_data->value) . "</p>\n";
$result .= "<ul class='orphan-pages'>\n";
foreach($stats_data->value as $pagename) {
$pagename_display = !empty($pageindex->$pagename->redirect) && $pageindex->$pagename->redirect ? "<em>$pagename</em>" : $pagename;
$result .= "\t<li><a href='?page=" . rawurlencode($pagename) . "'>$pagename_display</a></li>\n";
}
$result .= "</ul>\n";
return $result;
}
]);
statistic_add([

View File

@ -113,7 +113,7 @@
"author": "Starbeamrainbowlabs",
"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",
"lastupdate": 1524781183,
"lastupdate": 1524909895,
"optional": false
},
{
@ -266,7 +266,7 @@
"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.",
"id": "parser-parsedown",
"lastupdate": 1524909661,
"lastupdate": 1524909840,
"optional": false
}
]

View File

@ -61,6 +61,7 @@ register_module([
$content .= "<p>$settings->sitename doesn't current have the page listing module installed, so HTML rendering of this statistic is currently unavailable. Try <a href='mailto:" . hide_email($settings->admindetails_email) . "'>contacting $settings->admindetails_name</a>, $settings->sitename's administrator and asking then to install the <code>page-list</code> module.</p>";
break;
}
$content .= "<p><strong>Count:</strong> " . count($stats->{$_GET["stat"]}->value) . "</p>\n";
$content .= generate_page_list($stats->{$_GET["stat"]}->value);
break;

View File

@ -74,7 +74,7 @@ register_module([
statistic_add([
"id" => "orphan-pages",
"name" => "Orphan Pages",
"type" => "page",
"type" => "page-list",
"update" => function($old_stats) {
global $pageindex, $env;
@ -106,18 +106,6 @@ register_module([
$result->value = $orphaned_pages;
$result->completed = true;
return $result;
},
"render" => function($stats_data) {
global $pageindex;
$result = "<h2>$stats_data->name</h2>\n";
$result .= "<p><strong>Count:</strong> " . count($stats_data->value) . "</p>\n";
$result .= "<ul class='orphan-pages'>\n";
foreach($stats_data->value as $pagename) {
$pagename_display = !empty($pageindex->$pagename->redirect) && $pageindex->$pagename->redirect ? "<em>$pagename</em>" : $pagename;
$result .= "\t<li><a href='?page=" . rawurlencode($pagename) . "'>$pagename_display</a></li>\n";
}
$result .= "</ul>\n";
return $result;
}
]);
statistic_add([