diff --git a/Changelog.md b/Changelog.md
index 77ac4cd..dfa2a30 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -20,6 +20,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Squashed a warning in the search redirector
- The search redirector will now check both the specified page name and the page name in Title Case
- Improve help text description of image captions displayed alongside images
+ - Fixed the page history page - it should now display all page revisions in valid HTML
## Changed
- Password hashing has been overhauled! A totally new-and-different system is being used now, so you'll need to rehash all your passwords.
diff --git a/build/index.php b/build/index.php
index 733635a..f7a774a 100644
--- a/build/index.php
+++ b/build/index.php
@@ -150,6 +150,8 @@ $guiConfig = <<<'GUICONFIG'
"comment_max_length": { "type": "number", "description": "The maximum allowed length, in characters, for comments", "default": 5000 },
"comment_min_length": { "type": "number", "description": "The minimum allowed length, in characters, for comments", "default": 10 },
"comment_time_icon": { "type": "text", "description": "The icon to show next to the time that a comment was posted.", "default": "🕗" },
+ "history_max_revisions": { "type": "number", "description": "The maximum revisions that should be stored. If this limit is reached, them the oldest revision will be deleted. Defaults to -1, which is no limit.", "default": -1 },
+ "history_revert_require_moderator": { "type": "checkbox", "description": "Whether a user must be a moderator in order use the page reversion functionality.", "default": true },
"upload_enabled": { "type": "checkbox", "description": "Whether to allow uploads to the server.", "default": true},
"upload_allowed_file_types": { "type": "array", "description": "An array of mime types that are allowed to be uploaded.", "default": [
"image/jpeg",
@@ -402,7 +404,7 @@ if($settings->sessionprefix == "auto")
/////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */
$version = "v0.17-dev";
-$commit = "2853cf4da595832f9d7e3519c3fb96cfb714d745";
+$commit = "06c2b3886826e915f709df06714c79b3a7a6dd18";
/// Environment ///
/** Holds information about the current request environment. */
$env = new stdClass();
@@ -3205,7 +3207,7 @@ SCRIPT;
register_module([
"name" => "Page History",
- "version" => "0.3.1",
+ "version" => "0.4",
"author" => "Starbeamrainbowlabs",
"description" => "Adds the ability to keep unlimited page history, limited only by your disk space. Note that this doesn't store file history (yet). Currently depends on feature-recent-changes for rendering of the history page.",
"id" => "feature-history",
@@ -3242,8 +3244,8 @@ register_module([
foreach(array_reverse($pageindex->{$env->page}->history) as $revisionData)
{
// Only display edits & reverts for now
- if($revisionData->type != "edit" || $revisionData->type != "revert")
- continue;
+ if(!in_array($revisionData->type, [ "edit", "revert" ]))
+ continue;
// The number (and the sign) of the size difference to display
$size_display = ($revisionData->sizediff > 0 ? "+" : "") . $revisionData->sizediff;
@@ -3252,12 +3254,13 @@ register_module([
$size_display_class .= " significant";
$size_title_display = human_filesize($revisionData->newsize - $revisionData->sizediff) . " -> " . human_filesize($revisionData->newsize);
- $content .= "
";
+ $content .= "\t\t\t";
$content .= "#$revisionData->rid " . render_editor(page_renderer::render_username($revisionData->editor)) . " " . render_timestamp($revisionData->timestamp) . " ($size_display)";
if($env->is_logged_in || ($settings->history_revert_require_moderator && $env->is_admin && $env->is_logged_in))
$content .= " (restore this revision)";
- $content .= "";
+ $content .= "\n";
}
+ $content .= "\t\t";
}
else
{
@@ -3374,6 +3377,39 @@ register_module([
});
register_save_preprocessor("history_add_revision");
+
+ if(module_exists("feature-stats")) {
+ statistic_add([
+ "id" => "history_most_revisions",
+ "name" => "Most revised page",
+ "type" => "scalar",
+ "update" => function($old_stats) {
+ global $pageindex;
+
+ $target_pagename = "";
+ $target_revisions = -1;
+ foreach($pageindex as $pagename => $pagedata) {
+ if(!isset($pagedata->history))
+ continue;
+
+ $revisions_count = count($pagedata->history);
+ if($revisions_count > $target_revisions) {
+ $target_revisions = $revisions_count;
+ $target_pagename = $pagename;
+ }
+ }
+
+ $result = new stdClass(); // completed, value, state
+ $result->completed = true;
+ $result->value = "(no revisions saved yet)";
+ if($target_revisions > -1) {
+ $result->value = "$target_revisions (" . htmlentities($target_pagename) . ")";
+ }
+
+ return $result;
+ }
+ ]);
+ }
}
]);
diff --git a/module_index.json b/module_index.json
index 972a7c0..ef76375 100755
--- a/module_index.json
+++ b/module_index.json
@@ -73,11 +73,11 @@
},
{
"name": "Page History",
- "version": "0.3.1",
+ "version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds the ability to keep unlimited page history, limited only by your disk space. Note that this doesn't store file history (yet). Currently depends on feature-recent-changes for rendering of the history page.",
"id": "feature-history",
- "lastupdate": 1530571420,
+ "lastupdate": 1530615218,
"optional": false
},
{
@@ -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": 1525975761,
+ "lastupdate": 1530614499,
"optional": false
},
{
diff --git a/modules/feature-history.php b/modules/feature-history.php
index e090b38..f1cad59 100644
--- a/modules/feature-history.php
+++ b/modules/feature-history.php
@@ -1,7 +1,7 @@
"Page History",
- "version" => "0.3.1",
+ "version" => "0.4",
"author" => "Starbeamrainbowlabs",
"description" => "Adds the ability to keep unlimited page history, limited only by your disk space. Note that this doesn't store file history (yet). Currently depends on feature-recent-changes for rendering of the history page.",
"id" => "feature-history",
@@ -38,8 +38,8 @@ register_module([
foreach(array_reverse($pageindex->{$env->page}->history) as $revisionData)
{
// Only display edits & reverts for now
- if($revisionData->type != "edit" || $revisionData->type != "revert")
- continue;
+ if(!in_array($revisionData->type, [ "edit", "revert" ]))
+ continue;
// The number (and the sign) of the size difference to display
$size_display = ($revisionData->sizediff > 0 ? "+" : "") . $revisionData->sizediff;
@@ -48,12 +48,13 @@ register_module([
$size_display_class .= " significant";
$size_title_display = human_filesize($revisionData->newsize - $revisionData->sizediff) . " -> " . human_filesize($revisionData->newsize);
- $content .= "";
+ $content .= "\t\t\t";
$content .= "#$revisionData->rid " . render_editor(page_renderer::render_username($revisionData->editor)) . " " . render_timestamp($revisionData->timestamp) . " ($size_display)";
if($env->is_logged_in || ($settings->history_revert_require_moderator && $env->is_admin && $env->is_logged_in))
$content .= " (restore this revision)";
- $content .= "";
+ $content .= "\n";
}
+ $content .= "\t\t";
}
else
{
@@ -170,6 +171,39 @@ register_module([
});
register_save_preprocessor("history_add_revision");
+
+ if(module_exists("feature-stats")) {
+ statistic_add([
+ "id" => "history_most_revisions",
+ "name" => "Most revised page",
+ "type" => "scalar",
+ "update" => function($old_stats) {
+ global $pageindex;
+
+ $target_pagename = "";
+ $target_revisions = -1;
+ foreach($pageindex as $pagename => $pagedata) {
+ if(!isset($pagedata->history))
+ continue;
+
+ $revisions_count = count($pagedata->history);
+ if($revisions_count > $target_revisions) {
+ $target_revisions = $revisions_count;
+ $target_pagename = $pagename;
+ }
+ }
+
+ $result = new stdClass(); // completed, value, state
+ $result->completed = true;
+ $result->value = "(no revisions saved yet)";
+ if($target_revisions > -1) {
+ $result->value = "$target_revisions (" . htmlentities($target_pagename) . ")";
+ }
+
+ return $result;
+ }
+ ]);
+ }
}
]);
diff --git a/peppermint.guiconfig.json b/peppermint.guiconfig.json
index 61b31bf..c5adc38 100644
--- a/peppermint.guiconfig.json
+++ b/peppermint.guiconfig.json
@@ -127,6 +127,8 @@
"comment_max_length": { "type": "number", "description": "The maximum allowed length, in characters, for comments", "default": 5000 },
"comment_min_length": { "type": "number", "description": "The minimum allowed length, in characters, for comments", "default": 10 },
"comment_time_icon": { "type": "text", "description": "The icon to show next to the time that a comment was posted.", "default": "🕗" },
+ "history_max_revisions": { "type": "number", "description": "The maximum revisions that should be stored. If this limit is reached, them the oldest revision will be deleted. Defaults to -1, which is no limit.", "default": -1 },
+ "history_revert_require_moderator": { "type": "checkbox", "description": "Whether a user must be a moderator in order use the page reversion functionality.", "default": true },
"upload_enabled": { "type": "checkbox", "description": "Whether to allow uploads to the server.", "default": true},
"upload_allowed_file_types": { "type": "array", "description": "An array of mime types that are allowed to be uploaded.", "default": [
"image/jpeg",