1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-26 05:32:59 +00:00

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. */ /** The version of Pepperminty Wiki currently running. */
$version = "v0.16-dev"; $version = "v0.16-dev";
$commit = "de61612b18b88b9a2e91d1bc7b85438221d88762"; $commit = "72825f87552618c6a7bd99507d3b588652eea1f6";
/// Environment /// /// Environment ///
/** Holds information about the current request environment. */ /** Holds information about the current request environment. */
$env = new stdClass(); $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>"; $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; break;
} }
$content .= "<p><strong>Count:</strong> " . count($stats->{$_GET["stat"]}->value) . "</p>\n";
$content .= generate_page_list($stats->{$_GET["stat"]}->value); $content .= generate_page_list($stats->{$_GET["stat"]}->value);
break; break;
@ -8034,7 +8035,7 @@ register_module([
statistic_add([ statistic_add([
"id" => "orphan-pages", "id" => "orphan-pages",
"name" => "Orphan Pages", "name" => "Orphan Pages",
"type" => "page", "type" => "page-list",
"update" => function($old_stats) { "update" => function($old_stats) {
global $pageindex, $env; global $pageindex, $env;
@ -8066,18 +8067,6 @@ register_module([
$result->value = $orphaned_pages; $result->value = $orphaned_pages;
$result->completed = true; $result->completed = true;
return $result; 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([ statistic_add([

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": 1524781183, "lastupdate": 1524909895,
"optional": false "optional": false
}, },
{ {
@ -266,7 +266,7 @@
"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": 1524909661, "lastupdate": 1524909840,
"optional": false "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>"; $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; break;
} }
$content .= "<p><strong>Count:</strong> " . count($stats->{$_GET["stat"]}->value) . "</p>\n";
$content .= generate_page_list($stats->{$_GET["stat"]}->value); $content .= generate_page_list($stats->{$_GET["stat"]}->value);
break; break;

View file

@ -74,7 +74,7 @@ register_module([
statistic_add([ statistic_add([
"id" => "orphan-pages", "id" => "orphan-pages",
"name" => "Orphan Pages", "name" => "Orphan Pages",
"type" => "page", "type" => "page-list",
"update" => function($old_stats) { "update" => function($old_stats) {
global $pageindex, $env; global $pageindex, $env;
@ -106,18 +106,6 @@ register_module([
$result->value = $orphaned_pages; $result->value = $orphaned_pages;
$result->completed = true; $result->completed = true;
return $result; 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([ statistic_add([