From c8aa3b86922037594833ecfd97ded94c6fccf889 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Thu, 19 Sep 2019 08:59:29 +0100 Subject: [PATCH] Bugfix: Revision counters for new pages didn't tick upwards --- module_index.json | 4 ++-- modules/feature-history.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module_index.json b/module_index.json index f15e1b3..b5d62a4 100755 --- a/module_index.json +++ b/module_index.json @@ -75,7 +75,7 @@ "version": "0.1", "author": "Starbeamrainbowlabs", "description": "Displays a special page to aid in setting up a new wiki for the first time.", - "lastupdate": 1568296731, + "lastupdate": 1568802471, "optional": false, "extra_data": [] }, @@ -95,7 +95,7 @@ "version": "0.4.2", "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.", - "lastupdate": 1568296731, + "lastupdate": 1568879874, "optional": false, "extra_data": [] }, diff --git a/modules/feature-history.php b/modules/feature-history.php index 029451a..256ed47 100644 --- a/modules/feature-history.php +++ b/modules/feature-history.php @@ -209,7 +209,7 @@ register_module([ /** * Adds a history revision against a page. - * Note: Does not updaate the current page content! This function _only_ + * Note: Does not update the current page content! This function _only_ * records a new revision against a page name. Thus it is possible to have a * disparity between the history revisions and the actual content displayed in * the current revision if you're not careful! @@ -234,8 +234,8 @@ function history_add_revision(&$pageinfo, &$newsource, &$oldsource, $save_pagein // this point // TODO Store tag changes here - end($pageinfo->history); // Calculate the next revision id - we can't just count the revisions here because we might have a revision limit - $nextRid = !empty($pageindex->history) ? $pageinfo->history[key($pageinfo->history)]->rid + 1 : 0; + // Calculate the next revision id - we can't just count the revisions here because we might have a revision limit + $nextRid = !empty($pageinfo->history) ? end($pageinfo->history)->rid + 1 : 0; $ridFilename = "$pageinfo->filename.r$nextRid"; // Insert a new entry into the history $pageinfo->history[] = [