|
From: <var...@us...> - 2021-08-11 08:05:50
|
Revision: 10481
http://sourceforge.net/p/phpwiki/code/10481
Author: vargenau
Date: 2021-08-11 08:05:47 +0000 (Wed, 11 Aug 2021)
Log Message:
-----------
We keep all revisions: remove ArchiveCleaner and $ExpireParams
Modified Paths:
--------------
trunk/lib/IniConfig.php
trunk/lib/WikiDB.php
trunk/lib/editpage.php
trunk/lib/plugin/SystemInfo.php
trunk/locale/Makefile
trunk/locale/it/pgsrc/NoteDiRilascio
trunk/pgsrc/ReleaseNotes
Removed Paths:
-------------
trunk/lib/ArchiveCleaner.php
Deleted: trunk/lib/ArchiveCleaner.php
===================================================================
--- trunk/lib/ArchiveCleaner.php 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/lib/ArchiveCleaner.php 2021-08-11 08:05:47 UTC (rev 10481)
@@ -1,185 +0,0 @@
-<?php
-/**
- * Copyright © 2002 Geoffrey T. Dairiki <da...@da...>
- *
- * This file is part of PhpWiki.
- *
- * PhpWiki is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * PhpWiki is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- *
- */
-
-class ArchiveCleaner
-{
- function __construct($expire_params)
- {
- $this->expire_params = $expire_params;
- }
-
- /**
- * @param WikiDB_PageRevision $revision
- * @return bool
- */
- private function isMergeable($revision)
- {
- if (!$revision->get('is_minor_edit'))
- return false;
-
- $page = $revision->getPage();
- $author_id = $revision->get('author_id');
-
- $previous = $page->getRevisionBefore($revision, false);
-
- return !empty($author_id)
- && $author_id == $previous->get('author_id');
- }
-
- /**
- * @param WikiDB_Page $page
- */
- public function cleanPageRevisions($page)
- {
- $INFINITY = 0x7fffffff;
-
- $expire = &$this->expire_params;
- $counter = array();
- $counter['major'] = new ArchiveCleaner_Counter($expire['major']);
- $counter['minor'] = new ArchiveCleaner_Counter($expire['minor']);
- $counter['author'] = new ArchiveCleaner_Counter($expire['author']);
- // shortcut to keep all
- if (($counter['minor']->min_keep == $INFINITY)
- and ($counter['major']->min_keep == $INFINITY)
- )
- return;
-
- $authors_seen = array();
-
- $current = $page->getCurrentRevision(false);
-
- for ($revision = $page->getRevisionBefore($current, false);
- $revision->getVersion() > 0;
- $revision = $page->getRevisionBefore($revision, false)) {
-
- if ($revision->get('is_minor_edit'))
- $keep = $counter['minor']->keep($revision);
- else
- $keep = $counter['major']->keep($revision);
-
- if ($this->isMergeable($revision)) {
- if (!$keep) {
- $page->mergeRevision($revision);
- }
- } else {
- $author_id = $revision->get('author_id');
- if (empty($authors_seen[$author_id])) {
- if ($counter['author']->keep($revision))
- $keep = true;
- $authors_seen[$author_id] = true;
- }
- if (!$keep) {
- $page->deleteRevision($revision);
- }
- }
- }
- }
-}
-
-/**
- * @access private
- */
-class ArchiveCleaner_Counter
-{
- function __construct($params)
- {
-
- if (!empty($params))
- extract($params);
- $INFINITY = 0x7fffffff;
-
- $this->max_keep = isset($max_keep) ? $max_keep : $INFINITY;
-
- $this->min_age = isset($min_age) ? $min_age : 0;
- $this->min_keep = isset($min_keep) ? $min_keep : 0;
-
- $this->max_age = isset($max_age) ? $max_age : $INFINITY;
- $this->keep = isset($keep) ? $keep : $INFINITY;
-
- if ($this->keep > $this->max_keep)
- $this->keep = $this->max_keep;
- if ($this->min_keep == $INFINITY) { // shortcut to keep all
- $this->max_keep = $this->keep = $this->min_age = $this->max_age = $INFINITY;
- }
- if ($this->min_keep > $this->keep)
- $this->min_keep = $this->keep;
-
- if ($this->min_age > $this->max_age)
- $this->min_age = $this->max_age;
-
- $this->now = time();
- $this->count = 0;
- $this->previous_supplanted = false;
-
- }
-
- /**
- * @param WikiDB_PageRevision $revision
- * @return float|int
- */
- private function computeAge($revision)
- {
- $supplanted = $revision->get('_supplanted');
-
- if (!$supplanted) {
- // Every revision but the most recent should have a supplanted time.
- // However, if it doesn't...
- trigger_error(sprintf("Warning: Page “%s”, version '%d' has no '_supplanted' timestamp",
- $revision->getPageName(),
- $revision->getVersion()),
- E_USER_NOTICE);
- // Assuming revisions are chronologically ordered, the previous
- // supplanted time is a good value to use...
- if ($this->previous_supplanted > 0)
- $supplanted = $this->previous_supplanted;
- else {
- // no supplanted timestamp.
- // don't delete this revision based on age.
- return 0;
- }
- }
-
- $this->previous_supplanted = $supplanted;
- return ($this->now - $supplanted) / (24 * 3600);
- }
-
- /**
- * @param WikiDB_PageRevision $revision
- * @return bool
- */
- function keep($revision)
- {
- $INFINITY = 0x7fffffff;
- if ($this->min_keep == $INFINITY)
- return true;
- $count = ++$this->count;
- $age = $this->computeAge($revision);
-
- if ($count > $this->max_keep)
- return false;
- if ($age <= $this->min_age || $count <= $this->min_keep)
- return true;
- return $age <= $this->max_age && $count <= $this->keep;
- }
-}
Modified: trunk/lib/IniConfig.php
===================================================================
--- trunk/lib/IniConfig.php 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/lib/IniConfig.php 2021-08-11 08:05:47 UTC (rev 10481)
@@ -343,27 +343,6 @@
unset($item);
unset($k);
- // Expiry stuff
- global $ExpireParams;
- foreach (array('major', 'minor', 'author') as $major) {
- foreach (array('max_age', 'min_age', 'min_keep', 'keep', 'max_keep') as $max) {
- $item = strtoupper($major) . '_' . strtoupper($max);
- if (defined($item))
- $val = constant($item);
- elseif (array_key_exists($item, $rs))
- $val = $rs[$item];
- elseif (array_key_exists($item, $rsdef))
- $val = $rsdef[$item];
- if (!isset($ExpireParams[$major]))
- $ExpireParams[$major] = array();
- $ExpireParams[$major][$max] = $val;
- unset($rs[$item]);
- }
- }
- unset($item);
- unset($major);
- unset($max);
-
// User authentication
if (!isset($GLOBALS['USER_AUTH_ORDER'])) {
if (isset($rs['USER_AUTH_ORDER']))
Modified: trunk/lib/WikiDB.php
===================================================================
--- trunk/lib/WikiDB.php 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/lib/WikiDB.php 2021-08-11 08:05:47 UTC (rev 10481)
@@ -2310,9 +2310,6 @@
$readdata = false;
if (USECACHE) { //temporary - for debugging
assert(is_string($pagename) && $pagename != '');
- // There is a bug here somewhere which results in an assertion failure at line 105
- // of ArchiveCleaner.php It goes away if we use the next line.
- //$need_content = true;
$nc = $need_content ? '1' : '0';
$cache = &$this->_versiondata_cache;
if (!isset($cache[$pagename][$version][$nc])
Modified: trunk/lib/editpage.php
===================================================================
--- trunk/lib/editpage.php 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/lib/editpage.php 2021-08-11 08:05:47 UTC (rev 10481)
@@ -356,11 +356,6 @@
// New contents successfully saved...
$this->updateLock();
- // Clean out archived versions of this page.
- require_once 'lib/ArchiveCleaner.php';
- $cleaner = new ArchiveCleaner($GLOBALS['ExpireParams']);
- $cleaner->cleanPageRevisions($page);
-
/* generate notification emails done in WikiDB::save to catch
all direct calls (admin plugins) */
Modified: trunk/lib/plugin/SystemInfo.php
===================================================================
--- trunk/lib/plugin/SystemInfo.php 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/lib/plugin/SystemInfo.php 2021-08-11 08:05:47 UTC (rev 10481)
@@ -151,24 +151,6 @@
return $s;
}
- function ExpireParams()
- {
- global $ExpireParams;
- $s = sprintf(_("Keep up to %d major edits, but keep them no longer than %d days."),
- $ExpireParams['major']['keep'],
- $ExpireParams['major']['max_age']);
- $s .= sprintf(_(" Keep up to %d minor edits, but keep them no longer than %d days."),
- $ExpireParams['minor']['keep'],
- $ExpireParams['minor']['max_age']);
- $s .= sprintf(_(" Keep the latest contributions of the last %d authors up to %d days."),
- $ExpireParams['author']['keep'], $ExpireParams['author']['max_age']);
- $s .= sprintf(_(" Additionally, try to keep the latest contributions of all authors in the last %d days (even if there are more than %d of them,) but in no case keep more than %d unique author revisions."),
- $ExpireParams['author']['min_age'],
- $ExpireParams['author']['keep'],
- $ExpireParams['author']['max_keep']);
- return $s;
- }
-
function pagestats()
{
global $request;
@@ -555,7 +537,6 @@
//'accessstats' => _("Access statistics"),
'hitstats' => _("Hit statistics"),
'discspace' => _("Harddisc usage"),
- 'expireparams' => _("Expiry parameters"),
'wikinameregexp' => _("Wikiname regexp"),
'allowedprotocols' => _("Allowed protocols"),
'inlineimages' => _("Inline images"),
Modified: trunk/locale/Makefile
===================================================================
--- trunk/locale/Makefile 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/locale/Makefile 2021-08-11 08:05:47 UTC (rev 10481)
@@ -74,7 +74,6 @@
${POT_FILE}: .././getimg.php
${POT_FILE}: .././ImageTile.php
${POT_FILE}: .././index.php
-${POT_FILE}: .././lib/ArchiveCleaner.php
${POT_FILE}: .././lib/ASCIIMathPHP/ASCIIMathPHP.cfg.php
${POT_FILE}: .././lib/ASCIIMathPHP/ASCIIMathPHP.class.php
${POT_FILE}: .././lib/AtomParser.php
Modified: trunk/locale/it/pgsrc/NoteDiRilascio
===================================================================
--- trunk/locale/it/pgsrc/NoteDiRilascio 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/locale/it/pgsrc/NoteDiRilascio 2021-08-11 08:05:47 UTC (rev 10481)
@@ -1,4 +1,4 @@
-Date: Thu, 29 Jul 2021 21:08:02 +0000
+Date: Wed, 11 Aug 2021 10:03:04 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
Content-Type: application/x-phpwiki;
pagename=NoteDiRilascio;
@@ -8,10 +8,10 @@
<<CreateToc with_toclink||=1 headers||=1,2,3 width=300px position=right>>
-== 1.6.0 2020-12-XX Marc-Etienne Vargenau ==
+== 1.6.0 2021-08-XX Marc-Etienne Vargenau ==
Major release:
-* PHP 7 compatible (works from PHP 5.3.3 to PHP 7)
+* PHP 7 and 8 compatible (works from PHP 5.3.3 to PHP 8.0)
* Full HTML 5: Add HTML 5 <main> <header> <footer> <nav> in all themes. Add ARIA roles.
* Flash is dead
* Internet Explorer is dead
@@ -28,6 +28,7 @@
* Security fixes
=== Changes ===
+* All revisions are kept.
* Add new button in Edit Toolbar: convert Tab Separated Values to Wikicreole table
* Update jQuery to 2.2.4
* Pear: use ##mysqli## instead of ##mysql##
Modified: trunk/pgsrc/ReleaseNotes
===================================================================
--- trunk/pgsrc/ReleaseNotes 2021-08-10 16:29:05 UTC (rev 10480)
+++ trunk/pgsrc/ReleaseNotes 2021-08-11 08:05:47 UTC (rev 10481)
@@ -1,4 +1,4 @@
-Date: Fri, 30 Jul 2021 12:55:59 +0000
+Date: Wed, 11 Aug 2021 10:03:04 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
Content-Type: application/x-phpwiki;
pagename=ReleaseNotes;
@@ -11,7 +11,7 @@
== 1.6.0 2021-08-XX Marc-Etienne Vargenau ==
Major release:
-* PHP 7 and 8 compatible (works from PHP 5.3.3 to PHP 8)
+* PHP 7 and 8 compatible (works from PHP 5.3.3 to PHP 8.0)
* Full HTML 5: Add HTML 5 <main> <header> <footer> <nav> in all themes. Add ARIA roles.
* Flash is dead
* Internet Explorer is dead
@@ -28,6 +28,7 @@
* Security fixes
=== Changes ===
+* All revisions are kept.
* Add new button in Edit Toolbar: convert Tab Separated Values to Wikicreole table
* Update jQuery to 2.2.4
* Pear: use ##mysqli## instead of ##mysql##
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|