|
From: <var...@us...> - 2021-08-05 14:06:31
|
Revision: 10441
http://sourceforge.net/p/phpwiki/code/10441
Author: vargenau
Date: 2021-08-05 14:06:23 +0000 (Thu, 05 Aug 2021)
Log Message:
-----------
Remove functions get_db_version, set_db_version, phpwiki_version; simplify upgrade
Modified Paths:
--------------
trunk/lib/WikiDB.php
trunk/lib/main.php
trunk/lib/prepend.php
trunk/lib/stdlib.php
trunk/lib/upgrade.php
Modified: trunk/lib/WikiDB.php
===================================================================
--- trunk/lib/WikiDB.php 2021-08-05 10:43:36 UTC (rev 10440)
+++ trunk/lib/WikiDB.php 2021-08-05 14:06:23 UTC (rev 10441)
@@ -634,19 +634,6 @@
}
/**
- * Roughly similar to the float in phpwiki_version(). Set by action=upgrade.
- */
- public function get_db_version()
- {
- return (float)$this->get('_db_version');
- }
-
- public function set_db_version($ver)
- {
- $this->set('_db_version', (float)$ver);
- }
-
- /**
* Access WikiDB global meta-data.
*
* NOTE: this is currently implemented in a hackish and
Modified: trunk/lib/main.php
===================================================================
--- trunk/lib/main.php 2021-08-05 10:43:36 UTC (rev 10440)
+++ trunk/lib/main.php 2021-08-05 14:06:23 UTC (rev 10441)
@@ -93,7 +93,6 @@
// Fixme: Does pear reset the error mask to 1? We have to find the culprit
//$x = error_reporting();
- $this->version = phpwiki_version();
parent::__construct(); // [90ms]
// Normalize args...
Modified: trunk/lib/prepend.php
===================================================================
--- trunk/lib/prepend.php 2021-08-05 10:43:36 UTC (rev 10440)
+++ trunk/lib/prepend.php 2021-08-05 14:06:23 UTC (rev 10441)
@@ -29,7 +29,6 @@
* Things which must be done and defined before anything else.
*/
-// see lib/stdlib.php: phpwiki_version()
define('PHPWIKI_VERSION', '1.6.0');
// A new php-5.1.x feature: Turn off php-5.1.x auto_globals_jit = On, or use this mess below.
Modified: trunk/lib/stdlib.php
===================================================================
--- trunk/lib/stdlib.php 2021-08-05 10:43:36 UTC (rev 10440)
+++ trunk/lib/stdlib.php 2021-08-05 14:06:23 UTC (rev 10441)
@@ -72,7 +72,6 @@
subPageSlice ($pagename, $pos)
isActionPage ($filename)
- phpwiki_version ()
isWikiWord ($word)
url_get_contents ($uri)
GenerateId ($name)
@@ -1677,24 +1676,6 @@
}
}
-// 1.3.8 => 1030.08
-// 1.3.9-p1 => 1030.091
-// 1.3.10pre => 1030.099
-// 1.3.11pre-20041120 => 1030.1120041120
-// 1.3.12-rc1 => 1030.119
-function phpwiki_version()
-{
- static $PHPWIKI_VERSION;
- if (!isset($PHPWIKI_VERSION)) {
- $arr = explode('.', preg_replace('/\D+$/', '', PHPWIKI_VERSION)); // remove the pre
- $arr[2] = preg_replace('/\.+/', '.', preg_replace('/\D/', '.', $arr[2]));
- $PHPWIKI_VERSION = $arr[0] * 1000 + $arr[1] * 10 + 0.01 * $arr[2];
- if (strstr(PHPWIKI_VERSION, 'pre') or strstr(PHPWIKI_VERSION, 'rc'))
- $PHPWIKI_VERSION -= 0.01;
- }
- return $PHPWIKI_VERSION;
-}
-
function phpwiki_gzhandler($ob)
{
/**
Modified: trunk/lib/upgrade.php
===================================================================
--- trunk/lib/upgrade.php 2021-08-05 10:43:36 UTC (rev 10440)
+++ trunk/lib/upgrade.php 2021-08-05 14:06:23 UTC (rev 10441)
@@ -53,22 +53,15 @@
class Upgrade
{
- public $current_db_version;
public $_configUpdates;
public $check_args;
public $dbi;
private $request;
- private $phpwiki_version;
- private $isSQL;
- private $db_version;
function __construct(&$request)
{
$this->request =& $request;
$this->dbi =& $request->_dbi;
- $this->phpwiki_version = $this->current_db_version = phpwiki_version();
- $this->db_version = $this->dbi->get_db_version();
- $this->isSQL = $this->dbi->_backend->isSQL();
}
private function doPgsrcUpdate($pagename, $path, $filename)
@@ -182,11 +175,7 @@
}
}
- echo "<h2>", sprintf(_("Check for necessary %s updates"),
- "pgsrc"), "</h2>\n";
- if ($this->db_version < 1030.12200612) {
- echo "<h3>", _("Rename to Help: pages"), "</h3>\n";
- }
+ echo "<h2>", sprintf(_("Check for necessary %s updates"), "pgsrc"), "</h2>\n";
$translation = __("HomePage");
if ($translation == "HomePage") {
$path = findFile(WIKI_PGSRC);
@@ -202,9 +191,7 @@
if (!isActionPage($filename)) {
// There're a lot of now unneeded pages around.
// At first rename the BlaPlugin pages to Help/<pagename> and then to the update.
- if ($this->db_version < 1030.12200612) {
- $this->_rename_to_help_page($pagename);
- }
+ $this->_rename_to_help_page($pagename);
if (in_array($pagename, $themepgsrc)) {
echo sprintf(_('%s already checked in theme pgsrc'), $pagename).' ... '._('Skipped').'<br />';
} else {
@@ -216,15 +203,13 @@
private function _rename_page_helper($oldname, $pagename)
{
- echo sprintf(_("rename %s to %s"), $oldname, $pagename), " ... ";
if ($this->dbi->isWikiPage($oldname) and !$this->dbi->isWikiPage($pagename)) {
+ echo sprintf(_("rename %s to %s"), $oldname, $pagename), " ... ";
if ($this->dbi->_backend->rename_page($oldname, $pagename)) {
echo _("OK"), " <br />\n";
} else {
echo ' <span style="color: red; font-weight: bold;">' . _("FAILED") . "</span><br />\n";
}
- } else {
- echo " " . _("Skipped") . "<br />\n";
}
}
@@ -278,9 +263,9 @@
unlink($out);
return array(false, $reason);
} else {
- @unlink("$file.bak");
- @rename($file, "$file.bak");
- if (!rename($tmp, $file))
+ @unlink($filename.".bak");
+ @rename($filename, $filename.".bak");
+ if (!rename($tmp, $filename))
return array(false, sprintf(_("couldn't move %s to %s"), $tmp, $filename));
return true;
}
@@ -295,7 +280,6 @@
"config.ini"), "</h2>\n";
$entry = new UpgradeConfigEntry($this,
array('key' => 'cache_control_none',
- 'fixed_with' => 1012.0,
'header' => sprintf(_("Check for %s"), "CACHE_CONTROL = NONE"),
'applicable_args' => array('CACHE_CONTROL'),
'notice' => _("CACHE_CONTROL is set to 'NONE', and must be changed to 'NO_CACHE'"),
@@ -305,7 +289,6 @@
$entry = new UpgradeConfigEntry($this,
array('key' => 'group_method_none',
- 'fixed_with' => 1012.0,
'header' => sprintf(_("Check for %s"), "GROUP_METHOD = NONE"),
'applicable_args' => array('GROUP_METHOD'),
'notice' => _("GROUP_METHOD is set to NONE, and must be changed to \"NONE\""),
@@ -315,7 +298,6 @@
$entry = new UpgradeConfigEntry($this,
array('key' => 'blog_empty_default_prefix',
- 'fixed_with' => 1013.0,
'header' => sprintf(_("Check for %s"), "BLOG_EMPTY_DEFAULT_PREFIX"),
'applicable_args' => array('BLOG_EMPTY_DEFAULT_PREFIX'),
'notice' => _("fix BLOG_EMPTY_DEFAULT_PREFIX into BLOG_DEFAULT_EMPTY_PREFIX"),
@@ -337,7 +319,6 @@
{
public $applicable_cb;
public $header;
- public $fixed_with;
public $method_cb;
public $check_cb;
public $reason;
@@ -356,10 +337,9 @@
*/
function __construct(&$parent, $params)
{
- $this->parent =& $parent; // get the properties db_version
+ $this->parent =& $parent;
foreach (array('key' => 'required',
// the wikidb stores the version when we actually fixed that.
- 'fixed_with' => 'required',
'header' => '', // always printed
'applicable_cb' => null, // method to check if applicable
'applicable_args' => array(), // might be the config name
@@ -386,25 +366,9 @@
$this->applicable_cb =& $object;
}
- private function _check_if_already_fixed()
- {
- // not yet fixed?
- if (!isset($this->upgrade['name']))
- return false;
- // override with force?
- if ($this->parent->request->getArg('force'))
- return false;
- // already fixed and with an ok version
- if ($this->upgrade['name'] >= $this->fixed_with)
- return $this->upgrade['name'];
- // already fixed but with an older version. do it again.
- return false;
- }
-
public function pass()
{
// store in db no to fix again
- $this->upgrade['name'] = $this->parent->phpwiki_version;
$this->parent->dbi->set($this->_db_key, $this->upgrade);
echo "<b>", _("FIXED"), "</b>";
if (isset($this->reason))
@@ -436,12 +400,6 @@
public function check($args = null)
{
if ($this->header) echo $this->header, ' ... ';
- if ($when = $this->_check_if_already_fixed()) {
- // be totally silent if no header is defined.
- if ($this->header) echo _("fixed with"), " ", $when, "<br />\n";
- flush();
- return true;
- }
if (is_object($this->applicable_cb)) {
if (!$this->applicable_cb->call_array($this->applicable_args))
return $this->skip();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|