From: <var...@us...> - 2008-08-28 18:20:53
|
Revision: 6220 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6220&view=rev Author: vargenau Date: 2008-08-28 18:21:03 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Add comment about warning when themes/*/pgsrc does not exist Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2008-08-28 18:18:50 UTC (rev 6219) +++ trunk/lib/upgrade.php 2008-08-28 18:21:03 UTC (rev 6220) @@ -193,6 +193,8 @@ // WARNING: Also override the HomePage here. global $WikiTheme; $path = $WikiTheme->file("pgsrc"); + // TBD: the call to fileSet prints a warning: + // Notice: Unable to open directory 'themes/MonoBook/pgsrc' for reading $pgsrc = new fileSet($path); if ($pgsrc->getFiles()) { echo "<h3>",sprintf(_("check for additional theme %s updates"), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2008-10-31 13:48:45
|
Revision: 6341 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6341&view=rev Author: vargenau Date: 2008-10-31 13:48:40 +0000 (Fri, 31 Oct 2008) Log Message: ----------- Much simpler function isActionPage Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2008-10-30 16:55:09 UTC (rev 6340) +++ trunk/lib/upgrade.php 2008-10-31 13:48:40 UTC (rev 6341) @@ -106,20 +106,13 @@ /** * If a matching pgsrc => pluginname exists - * Need the english filename (required precondition: urlencode == urldecode). - * Returns the plugin name. + * Need the English filename (required precondition: urlencode == urldecode). */ function isActionPage($filename) { - static $special = array("DebugInfo" => "_BackendInfo", - "PhpWikiRecentChanges" => "RssFeed", - "ProjectSummary" => "RssFeed", - "RecentReleases" => "RssFeed", - "InterWikiMap" => "InterWikiMap", - ); - $base = preg_replace("/\..{1,4}$/","",basename($filename)); - if (isset($special[$base])) return $special[$base]; - if (FindFile("lib/plugin/".$base.".php",true)) return $base; - else return false; + + global $AllActionPages; + + return (in_array($filename, $AllActionPages)); } function CheckActionPageUpdate() { @@ -1296,232 +1289,6 @@ EndLoadDump($request); } - -/* - $Log: not supported by cvs2svn $ - Revision 1.61 2008/03/17 19:12:32 rurban - get rid of @ error protection in unserialize - define $backend_type for dba - fix _upgrade_relation_links for missing SQL relation field - - Revision 1.60 2007/08/25 18:43:35 rurban - add missing DBParams. Detected by Sacha Sch\xE4r. - - Revision 1.59 2007/06/09 18:57:44 rurban - fix action=upgrade for dba - - Revision 1.58 2007/01/28 22:54:18 rurban - more objectification. store last db update. - - Revision 1.57 2007/01/04 16:43:09 rurban - Changed to class Upgrade: Do not pollute our namespace with global functions. Less arguments needed. Fix missing permissions on wrong DBADMIN_USER. Let user input override the wrong constant. - - Revision 1.56 2007/01/03 21:25:34 rurban - rename InterWikiKarte to InterWikiListe. Support nosql, nopgsrc, noplugin, noconfig args. - - Revision 1.55 2007/01/02 13:24:01 rurban - 1.3.13 support: _rename_page_helper, _rename_to_help_page, _upgrade_relation_links, check for ACCESS_LOG_SQL remote_host varchar(50), _upgrade_psql_tsearch2 - - Revision 1.54 2006/12/03 17:07:29 rurban - #1535843 by matt brown: Upgrade Wizard Password fixes are not portable - - Revision 1.53 2006/12/03 17:03:18 rurban - #1535851 by matt brown - - Revision 1.52 2006/12/03 17:01:18 rurban - #1535839 by matt brown - - Revision 1.51 2006/08/07 21:05:30 rurban - patch #1535837 (debian) - - Revision 1.50 2006/06/18 11:04:09 rurban - keep overwrite arg - - Revision 1.49 2006/05/18 06:03:39 rurban - use $dbh->_backend->isSQL - - Revision 1.48 2005/11/14 22:32:38 rurban - remove user, SKIP on !session - - Revision 1.47 2005/02/27 19:13:27 rurban - latin1 mysql fix - - Revision 1.46 2005/02/12 17:22:18 rurban - locale update: missing . : fixed. unified strings - proper linebreaks - - Revision 1.45 2005/02/10 19:01:19 rurban - add PDO support - - Revision 1.44 2005/02/07 15:40:42 rurban - use defined CHARSET for db. more comment - Revision 1.43 2005/02/04 11:44:07 rurban - check passwd in access_log - - Revision 1.42 2005/02/02 19:38:13 rurban - prefer utf8 pagenames for collate issues - - Revision 1.41 2005/01/31 12:15:29 rurban - print OK - - Revision 1.40 2005/01/30 23:22:17 rurban - clarify messages - - Revision 1.39 2005/01/30 23:09:17 rurban - sanify session fields - - Revision 1.38 2005/01/25 07:57:02 rurban - add dbadmin form, add mysql LOCK TABLES check, add plugin args updater (not yet activated) - - Revision 1.37 2005/01/20 10:19:08 rurban - add InterWikiMap to special pages - - Revision 1.36 2004/12/20 12:56:11 rurban - patch #1088128 by Kai Krakow. avoid chicken & egg problem - - Revision 1.35 2004/12/13 14:35:41 rurban - verbose arg - - Revision 1.34 2004/12/11 09:39:28 rurban - needed init for ref - - Revision 1.33 2004/12/10 22:33:39 rurban - add WikiAdminUtils method for convert-cached-html - missed some vars. - - Revision 1.32 2004/12/10 22:15:00 rurban - fix $page->get('_cached_html) - refactor upgrade db helper _convert_cached_html() to be able to call them from WikiAdminUtils also. - support 2nd genericSqlQuery param (bind huge arg) - - Revision 1.31 2004/12/10 02:45:26 rurban - SQL optimization: - put _cached_html from pagedata into a new seperate blob, not huge serialized string. - it is only rarelely needed: for current page only, if-not-modified - but was extracted for every simple page iteration. - - Revision 1.30 2004/11/29 17:58:57 rurban - just aesthetics - - Revision 1.29 2004/11/29 16:08:31 rurban - added missing nl - - Revision 1.28 2004/11/16 16:25:14 rurban - fix accesslog tablename, print CREATED only if really done - - Revision 1.27 2004/11/07 16:02:52 rurban - new sql access log (for spam prevention), and restructured access log class - dbh->quote (generic) - pear_db: mysql specific parts seperated (using replace) - - Revision 1.26 2004/10/14 19:19:34 rurban - loadsave: check if the dumped file will be accessible from outside. - and some other minor fixes. (cvsclient native not yet ready) - - Revision 1.25 2004/09/06 08:28:00 rurban - rename genericQuery to genericSqlQuery - - Revision 1.24 2004/07/05 13:56:22 rurban - sqlite autoincrement fix - - Revision 1.23 2004/07/04 10:28:06 rurban - DBADMIN_USER fix - - Revision 1.22 2004/07/03 17:21:28 rurban - updated docs: submitted new mysql bugreport (#1491 did not fix it) - - Revision 1.21 2004/07/03 16:51:05 rurban - optional DBADMIN_USER:DBADMIN_PASSWD for action=upgrade (if no ALTER permission) - added atomic mysql REPLACE for PearDB as in ADODB - fixed _lock_tables typo links => link - fixes unserialize ADODB bug in line 180 - - Revision 1.20 2004/07/03 14:48:18 rurban - Tested new mysql 4.1.3-beta: binary search bug as fixed. - => fixed action=upgrade, - => version check in PearDB also (as in ADODB) - - Revision 1.19 2004/06/19 12:19:09 rurban - slightly improved docs - - Revision 1.18 2004/06/19 11:47:17 rurban - added CheckConfigUpdate: CACHE_CONTROL = NONE => NO_CACHE - - Revision 1.17 2004/06/17 11:31:50 rurban - check necessary localized actionpages - - Revision 1.16 2004/06/16 10:38:58 rurban - Disallow refernces in calls if the declaration is a reference - ("allow_call_time_pass_reference clean"). - PhpWiki is now allow_call_time_pass_reference = Off clean, - but several external libraries may not. - In detail these libs look to be affected (not tested): - * Pear_DB odbc - * adodb oracle - - Revision 1.15 2004/06/07 19:50:40 rurban - add owner field to mimified dump - - Revision 1.14 2004/06/07 18:38:18 rurban - added mysql 4.1.x search fix - - Revision 1.13 2004/06/04 20:32:53 rurban - Several locale related improvements suggested by Pierrick Meignen - LDAP fix by John Cole - reanable admin check without ENABLE_PAGEPERM in the admin plugins - - Revision 1.12 2004/05/18 13:59:15 rurban - rename simpleQuery to genericSqlQuery - - Revision 1.11 2004/05/15 13:06:17 rurban - skip the HomePage, at first upgrade the ActionPages, then the database, then the rest - - Revision 1.10 2004/05/15 01:19:41 rurban - upgrade prefix fix by Kai Krakow - - Revision 1.9 2004/05/14 11:33:03 rurban - version updated to 1.3.11pre - upgrade stability fix - - Revision 1.8 2004/05/12 10:49:55 rurban - require_once fix for those libs which are loaded before FileFinder and - its automatic include_path fix, and where require_once doesn't grok - dirname(__FILE__) != './lib' - upgrade fix with PearDB - navbar.tmpl: remove spaces for IE button alignment - - Revision 1.7 2004/05/06 17:30:38 rurban - CategoryGroup: oops, dos2unix eol - improved phpwiki_version: - pre -= .0001 (1.3.10pre: 1030.099) - -p1 += .001 (1.3.9-p1: 1030.091) - improved InstallTable for mysql and generic SQL versions and all newer tables so far. - abstracted more ADODB/PearDB methods for action=upgrade stuff: - backend->backendType(), backend->database(), - backend->listOfFields(), - backend->listOfTables(), - - Revision 1.6 2004/05/03 15:05:36 rurban - + table messages - - Revision 1.4 2004/05/02 21:26:38 rurban - limit user session data (HomePageHandle and auth_dbi have to invalidated anyway) - because they will not survive db sessions, if too large. - extended action=upgrade - some WikiTranslation button work - revert WIKIAUTH_UNOBTAINABLE (need it for main.php) - some temp. session debug statements - - Revision 1.3 2004/04/29 22:33:30 rurban - fixed sf.net bug #943366 (Kai Krakow) - couldn't load localized url-undecoded pagenames - - Revision 1.2 2004/03/12 15:48:07 rurban - fixed explodePageList: wrong sortby argument order in UnfoldSubpages - simplified lib/stdlib.php:explodePageList - - */ - // For emacs users // Local Variables: // mode: php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2008-10-31 14:29:21
|
Revision: 6342 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6342&view=rev Author: vargenau Date: 2008-10-31 14:29:13 +0000 (Fri, 31 Oct 2008) Log Message: ----------- Move the HomePage check to doPgsrcUpdate Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2008-10-31 13:48:40 UTC (rev 6341) +++ trunk/lib/upgrade.php 2008-10-31 14:29:13 UTC (rev 6342) @@ -2,6 +2,7 @@ rcs_id('$Id$'); /* Copyright 2004,2005,2006,2007 $ThePhpWikiProgrammingTeam + Copyright 2008 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -64,6 +65,15 @@ * TODO: check for the pgsrc_version number, not the revision mtime only */ function doPgsrcUpdate($pagename, $path, $filename) { + // don't ever update the HomePage + if ((defined(HOME_PAGE) and ($pagename == HOME_PAGE)) + or ($pagename == _("HomePage")) + or ($pagename == "HomePage")) { + echo "$path/$pagename: ",_("always skip the HomePage."), + _(" skipped"),".<br />\n"; + return; + } + $page = $this->dbi->getPage($pagename); if ($page->exists()) { // check mtime: update automatically if pgsrc is newer @@ -155,23 +165,10 @@ $path = FindLocalizedFile(WIKI_PGSRC); $pgsrc = new fileSet($path); // fixme: verification, ... - $isHomePage = false; foreach ($pgsrc->getFiles() as $filename) { if (substr($filename,-1,1) == '~') continue; if (substr($filename,-5,5) == '.orig') continue; $pagename = urldecode($filename); - // don't ever update the HomePage - if (defined(HOME_PAGE)) - if ($pagename == HOME_PAGE) $isHomePage = true; - else - if ($pagename == _("HomePage")) $isHomePage = true; - if ($pagename == "HomePage") $isHomePage = true; - if ($isHomePage) { - echo "$path/$pagename: ",_("always skip the HomePage."), - _(" skipped"),".<br />\n"; - $isHomePage = false; - continue; - } if (!$this->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. @@ -183,7 +180,6 @@ } // Now check some theme specific pgsrc files (blog, wikilens, custom). - // WARNING: Also override the HomePage here. global $WikiTheme; $path = $WikiTheme->file("pgsrc"); // TBD: the call to fileSet prints a warning: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-06-23 15:43:30
|
Revision: 7565 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7565&view=rev Author: vargenau Date: 2010-06-23 15:43:24 +0000 (Wed, 23 Jun 2010) Log Message: ----------- Remove unused function fixThemeTemplate Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2010-06-23 15:42:31 UTC (rev 7564) +++ trunk/lib/upgrade.php 2010-06-23 15:43:24 UTC (rev 7565) @@ -1204,29 +1204,6 @@ $replace = $args[1]; $template = $args[2]; } - - function fixThemeTemplate($match, $new, $template) { - // for all custom themes - $ourthemes = explode(":","blog:Crao:default:Hawaiian:MacOSX:MonoBook:Portland:shamino_com:SpaceWiki:wikilens:Wordpress"); - $themedir = NormalizeLocalFileName("themes"); - $dh = opendir($themedir); - while ($r = readdir($dh)) { - if (filetype($r) == 'dir' and $r[0] != '.' and !is_array($r, $ourthemes)) - $customthemes[] = $r; - } - $success = true; - $errors = ''; - foreach ($customthemes as $customtheme) { - $template = FindFile("themes/$customtheme/templates/$template"); - $do = $this->parent->fixLocalFile($match, $new, template); - if (!$do[0]) { - $success = false; - $errors .= $do[1]." "; - echo $do[1]; - } - } - return array($success, $errors); - } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2010-06-24 06:35:46
|
Revision: 7567 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7567&view=rev Author: rurban Date: 2010-06-24 06:35:40 +0000 (Thu, 24 Jun 2010) Log Message: ----------- revert r7565, deletion of fixThemeTemplate. This is optionally needed by custom themes, not by the standard. Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2010-06-23 19:43:46 UTC (rev 7566) +++ trunk/lib/upgrade.php 2010-06-24 06:35:40 UTC (rev 7567) @@ -1204,6 +1204,29 @@ $replace = $args[1]; $template = $args[2]; } + + function fixThemeTemplate($match, $new, $template) { + // for all custom themes + $ourthemes = explode(":","blog:Crao:default:Hawaiian:MacOSX:MonoBook:Portland:shamino_com:SpaceWiki:wikilens:Wordpress"); + $themedir = NormalizeLocalFileName("themes"); + $dh = opendir($themedir); + while ($r = readdir($dh)) { + if (filetype($r) == 'dir' and $r[0] != '.' and !is_array($r, $ourthemes)) + $customthemes[] = $r; + } + $success = true; + $errors = ''; + foreach ($customthemes as $customtheme) { + $template = FindFile("themes/$customtheme/templates/$template"); + $do = $this->parent->fixLocalFile($match, $new, template); + if (!$do[0]) { + $success = false; + $errors .= $do[1]." "; + echo $do[1]; + } + } + return array($success, $errors); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-07-15 15:19:03
|
Revision: 7613 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7613&view=rev Author: vargenau Date: 2010-07-15 15:18:53 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Upgrade: check theme specific pgsrc first in case the page is present in both Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2010-07-15 15:13:44 UTC (rev 7612) +++ trunk/lib/upgrade.php 2010-07-15 15:18:53 UTC (rev 7613) @@ -70,7 +70,7 @@ or ($pagename == _("HomePage")) or ($pagename == "HomePage")) { echo "$path/$pagename: ",_("always skip the HomePage."), - _(" skipped"),".<br />\n"; + _(" Skipped"),".<br />\n"; return; } @@ -101,11 +101,11 @@ echo "<br />\n"; } else { echo "$path/$pagename: ",_("older than the existing page."), - _(" skipped"),".<br />\n"; + _(" Skipped"),".<br />\n"; } } else { echo "$path/$pagename: ",("unknown format."), - _(" skipped"),".<br />\n"; + _(" Skipped"),".<br />\n"; } } else { echo sprintf(_("%s does not exist"),$pagename),"<br />\n"; @@ -115,7 +115,7 @@ } function CheckActionPageUpdate() { - echo "<h3>",sprintf(_("check for necessary %s updates"), + echo "<h3>",sprintf(_("Check for necessary %s updates"), _("ActionPage")),"</h3>\n"; // 1.3.13 before we pull in all missing pages, we rename existing ones $this->_rename_page_helper(_("_AuthInfo"), _("DebugAuthInfo")); @@ -146,45 +146,46 @@ // see loadsave.php for saving new pages. function CheckPgsrcUpdate() { - echo "<h3>",sprintf(_("check for necessary %s updates"), - "pgsrc"),"</h3>\n"; - if ($this->db_version < 1030.12200612) { - echo "<h4>",_("rename to Help: pages"),"</h4>\n"; - } - $path = FindLocalizedFile(WIKI_PGSRC); - $pgsrc = new fileSet($path); - // fixme: verification, ... - foreach ($pgsrc->getFiles() as $filename) { - if (substr($filename,-1,1) == '~') continue; - if (substr($filename,-5,5) == '.orig') continue; - $pagename = urldecode($filename); - 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->doPgsrcUpdate($pagename,$path,$filename); - } - } - - // Now check some theme specific pgsrc files (blog, wikilens, custom). - global $WikiTheme; - $path = $WikiTheme->file("pgsrc"); + // Check some theme specific pgsrc files (blog, wikilens, gforge, custom). + // We check theme specific pgsrc first in case the page is present in both + // theme specific and global pgsrc + global $WikiTheme; + $path = $WikiTheme->file("pgsrc"); // TBD: the call to fileSet prints a warning: // Notice: Unable to open directory 'themes/MonoBook/pgsrc' for reading - $pgsrc = new fileSet($path); - if ($pgsrc->getFiles()) { - echo "<h3>",sprintf(_("check for additional theme %s updates"), - "pgsrc"),"</h3>\n"; - foreach ($pgsrc->getFiles() as $filename) { - if (substr($filename,-1,1) == '~') continue; - if (substr($filename,-5,5) == '.orig') continue; - $pagename = urldecode($filename); - $this->doPgsrcUpdate($pagename,$path,$filename); - } - } - return; + $pgsrc = new fileSet($path); + if ($pgsrc->getFiles()) { + echo "<h3>",sprintf(_("Check for necessary theme %s updates"), + "pgsrc"),"</h3>\n"; + foreach ($pgsrc->getFiles() as $filename) { + if (substr($filename,-1,1) == '~') continue; + if (substr($filename,-5,5) == '.orig') continue; + $pagename = urldecode($filename); + $this->doPgsrcUpdate($pagename,$path,$filename); + } + } + + echo "<h3>",sprintf(_("Check for necessary %s updates"), + "pgsrc"),"</h3>\n"; + if ($this->db_version < 1030.12200612) { + echo "<h4>",_("rename to Help: pages"),"</h4>\n"; + } + $path = FindLocalizedFile(WIKI_PGSRC); + $pgsrc = new fileSet($path); + // fixme: verification, ... + foreach ($pgsrc->getFiles() as $filename) { + if (substr($filename,-1,1) == '~') continue; + if (substr($filename,-5,5) == '.orig') continue; + $pagename = urldecode($filename); + 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->doPgsrcUpdate($pagename,$path,$filename); + } + } } function _rename_page_helper($oldname, $pagename) { @@ -196,7 +197,7 @@ echo " <b><font color=\"red\">", _("FAILED"), "</font></b>", " <br />\n"; } else { - echo _(" skipped")," <br />\n"; + echo _(" Skipped")," <br />\n"; } } @@ -380,7 +381,7 @@ function CheckDatabaseUpdate() { global $DBAuthParams, $DBParams; - echo "<h3>",sprintf(_("check for necessary %s updates"), + echo "<h3>",sprintf(_("Check for necessary %s updates"), _("database")), " - ", DATABASE_TYPE,"</h3>\n"; $dbadmin = $this->request->getArg('dbadmin'); @@ -404,7 +405,7 @@ $prefix = isset($DBParams['prefix']) ? $DBParams['prefix'] : ''; $tables = $this->dbi->_backend->listOfTables(); foreach (explode(':','session:pref:member') as $table) { - echo sprintf(_("check for table %s"), $table)," ..."; + echo sprintf(_("Check for table %s"), $table)," ..."; if (!in_array($prefix.$table, $tables)) { $this->installTable($table, $backend_type); } else { @@ -424,7 +425,7 @@ if (ACCESS_LOG_SQL and $this->isSQL) { $table = "accesslog"; - echo sprintf(_("check for table %s"), $table)," ..."; + echo sprintf(_("Check for table %s"), $table)," ..."; if (!in_array($prefix.$table, $tables)) { $this->installTable($table, $backend_type); } else { @@ -433,7 +434,7 @@ } if ($this->isSQL and (class_exists("RatingsUserFactory") or $this->dbi->isWikiPage(_("RateIt")))) { $table = "rating"; - echo sprintf(_("check for table %s"), $table)," ..."; + echo sprintf(_("Check for table %s"), $table)," ..."; if (!in_array($prefix.$table, $tables)) { $this->installTable($table, $backend_type); } else { @@ -448,7 +449,7 @@ if ($this->isSQL and $this->phpwiki_version >= 1030.08 and USE_DB_SESSION and isset($this->request->_dbsession)) { - echo _("check for new session.sess_ip column")," ... "; + echo _("Check for new session.sess_ip column")," ... "; $database = $this->dbi->_backend->database(); assert(!empty($DBParams['db_session_table'])); $session_tbl = $prefix . $DBParams['db_session_table']; @@ -467,7 +468,7 @@ if (substr($backend_type,0,5) == 'mysql') { // upgrade to 4.1.8 destroyed my session table: // sess_id => varchar(10), sess_data => varchar(5). For others obviously also. - echo _("check for mysql session.sess_id sanity")," ... "; + echo _("Check for mysql session.sess_id sanity")," ... "; $result = $this->dbi->genericSqlQuery("DESCRIBE $session_tbl"); if (DATABASE_TYPE == 'SQL') { $iter = new WikiDB_backend_PearDB_generic_iter($backend, $result); @@ -500,7 +501,7 @@ // mysql >= 4.0.4 requires LOCK TABLE privileges if (substr($backend_type,0,5) == 'mysql') { - echo _("check for mysql LOCK TABLE privilege")," ..."; + echo _("Check for mysql LOCK TABLE privilege")," ..."; $mysql_version = $this->dbi->_backend->_serverinfo['version']; if ($mysql_version > 400.40) { if (!empty($this->dbi->_backend->_parsedDSN)) @@ -555,7 +556,7 @@ if ($this->phpwiki_version >= 1030.099 and substr($backend_type,0,5) == 'mysql' and DATABASE_TYPE != 'PDO') { - echo _("check for mysql page.id auto_increment flag")," ..."; + echo _("Check for mysql page.id auto_increment flag")," ..."; assert(!empty($page_tbl)); $database = $this->dbi->_backend->database(); $fields = mysql_list_fields($database, $page_tbl, $this->dbi->_backend->connection()); @@ -592,7 +593,7 @@ // Illegal mix of collations (latin1_bin,IMPLICIT) and // (utf8_general_ci, COERCIBLE) for operation '=']) if (isWindows() and substr($backend_type,0,5) == 'mysql') { - echo _("check for mysql 4.1.x/5.0.0 binary search on windows problem")," ..."; + echo _("Check for mysql 4.1.x/5.0.0 binary search on windows problem")," ..."; $mysql_version = $this->dbi->_backend->_serverinfo['version']; if ($mysql_version < 401.0) { echo sprintf(_("version <em>%s</em>"), $mysql_version)," ", @@ -643,7 +644,7 @@ } } if ($this->isSQL and ACCESS_LOG_SQL & 2) { - echo _("check for ACCESS_LOG_SQL passwords in POST requests")," ..."; + echo _("Check for ACCESS_LOG_SQL passwords in POST requests")," ..."; // Don't display passwords in POST requests (up to 2005-02-04 12:03:20) $res = $this->dbi->genericSqlIter("SELECT time_stamp, remote_host, " . "request_args FROM ${prefix}accesslog WHERE request_args LIKE " . @@ -666,7 +667,7 @@ echo _("OK"),"<br />\n"; if ($this->phpwiki_version >= 1030.13) { - echo _("check for ACCESS_LOG_SQL remote_host varchar(50)")," ..."; + echo _("Check for ACCESS_LOG_SQL remote_host varchar(50)")," ..."; $database = $this->dbi->_backend->database(); $accesslog_tbl = $prefix . 'accesslog'; $fields = $this->dbi->_backend->listOfFields($database, $accesslog_tbl); @@ -811,7 +812,7 @@ $count = 0; if ($this->phpwiki_version >= 1030.10) { if ($verbose) - echo _("check for extra page.cached_html column")," ... "; + echo _("Check for extra page.cached_html column")," ... "; $database = $this->dbi->_backend->database(); extract($this->dbi->_backend->_table_names); $fields = $this->dbi->_backend->listOfFields($database, $page_tbl); @@ -874,7 +875,7 @@ */ function _upgrade_relation_links ( $verbose=true ) { if ($this->phpwiki_version >= 1030.12200610 and $this->isSQL) { - echo _("check for relation field in link table")," ..."; + echo _("Check for relation field in link table")," ..."; $database = $this->dbi->_backend->database(); $link_tbl = $prefix . 'link'; $fields = $this->dbi->_backend->listOfFields($database, $link_tbl); @@ -908,7 +909,7 @@ function CheckPluginUpdate() { return; - echo "<h3>",sprintf(_("check for necessary %s updates"), + echo "<h3>",sprintf(_("Check for necessary %s updates"), _("plugin argument")),"</h3>\n"; $this->_configUpdates = array(); @@ -996,12 +997,12 @@ } function CheckConfigUpdate () { - echo "<h3>",sprintf(_("check for necessary %s updates"), + echo "<h3>",sprintf(_("Check for necessary %s updates"), "config.ini"),"</h3>\n"; $entry = new UpgradeConfigEntry ($this, array('key' => 'cache_control_none', 'fixed_with' => 1012.0, - 'header' => sprintf(_("check for %s"),"CACHE_CONTROL = NONE"), + 'header' => sprintf(_("Check for %s"),"CACHE_CONTROL = NONE"), 'applicable_args' => 'CACHE_CONTROL', 'notice' => _("CACHE_CONTROL is set to 'NONE', and must be changed to 'NO_CACHE'"), 'check_args' => array("/^\s*CACHE_CONTROL\s*=\s*NONE/", "CACHE_CONTROL = NO_CACHE"))); @@ -1011,7 +1012,7 @@ $entry = new UpgradeConfigEntry ($this, array('key' => 'group_method_none', 'fixed_with' => 1012.0, - 'header' => sprintf(_("check for %s"), "GROUP_METHOD = NONE"), + 'header' => sprintf(_("Check for %s"), "GROUP_METHOD = NONE"), 'applicable_args' => 'GROUP_METHOD', 'notice' =>_("GROUP_METHOD is set to NONE, and must be changed to \"NONE\""), 'check_args' => array("/^\s*GROUP_METHOD\s*=\s*NONE/", "GROUP_METHOD = \"NONE\""))); @@ -1021,7 +1022,7 @@ $entry = new UpgradeConfigEntry ($this, array('key' => 'blog_empty_default_prefix', 'fixed_with' => 1013.0, - 'header' => sprintf(_("check for %s"), "BLOG_EMPTY_DEFAULT_PREFIX"), + 'header' => sprintf(_("Check for %s"), "BLOG_EMPTY_DEFAULT_PREFIX"), 'applicable_args' => 'BLOG_EMPTY_DEFAULT_PREFIX', 'notice' =>_("fix BLOG_EMPTY_DEFAULT_PREFIX into BLOG_DEFAULT_EMPTY_PREFIX"), 'check_args' => array("/BLOG_EMPTY_DEFAULT_PREFIX\s*=/","BLOG_DEFAULT_EMPTY_PREFIX ="))); @@ -1115,7 +1116,7 @@ } function skip() { // not applicable if (isset($this->silent_skip)) return true; - echo _(" skipped"),".<br />\n"; + echo _(" Skipped"),".<br />\n"; flush(); return true; } @@ -1261,8 +1262,8 @@ if (!$request->getArg('nodb')) $upgrade->CheckDatabaseUpdate($request); // first check cached_html and friends if (!$request->getArg('nopgsrc')) { + $upgrade->CheckPgsrcUpdate($request); $upgrade->CheckActionPageUpdate($request); - $upgrade->CheckPgsrcUpdate($request); } if (!$request->getArg('noplugin')) $upgrade->CheckPluginUpdate($request); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-07-16 14:25:24
|
Revision: 7622 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7622&view=rev Author: vargenau Date: 2010-07-16 14:25:17 +0000 (Fri, 16 Jul 2010) Log Message: ----------- Make upgrade work for subpages like PhpWikiAdministration/Chown Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2010-07-16 08:13:55 UTC (rev 7621) +++ trunk/lib/upgrade.php 2010-07-16 14:25:17 UTC (rev 7622) @@ -132,7 +132,7 @@ if (substr($filename,-1,1) == '~') continue; if (substr($filename,-5,5) == '.orig') continue; $pagename = urldecode($filename); - if (isActionPage($filename)) { + if (isActionPage($pagename)) { $translation = gettext($pagename); if ($translation == $pagename) $this->doPgsrcUpdate($pagename, $path, $filename); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-10-03 12:35:49
|
Revision: 8156 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8156&view=rev Author: vargenau Date: 2011-10-03 12:35:43 +0000 (Mon, 03 Oct 2011) Log Message: ----------- FAIL --> FAILED Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2011-10-03 12:33:36 UTC (rev 8155) +++ trunk/lib/upgrade.php 2011-10-03 12:35:43 UTC (rev 8156) @@ -678,7 +678,7 @@ echo "<b>",_("FIXING"),"remote_host</b>"," ... "; $this->dbi->genericSqlQuery("ALTER TABLE $accesslog_tbl CHANGE remote_host VARCHAR(100)"); } else { - echo _("FAIL"); + echo _("FAILED"); } echo "<br />\n"; } @@ -886,7 +886,7 @@ $this->dbi->genericSqlQuery("ALTER TABLE $link_tbl ADD relation INT DEFAULT 0;"); $this->dbi->genericSqlQuery("CREATE INDEX link_relation ON $link_tbl (relation);"); } else { - echo _("FAIL"); + echo _("FAILED"); } echo "<br />\n"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-10-02 12:51:51
|
Revision: 8383 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8383&view=rev Author: vargenau Date: 2012-10-02 12:51:40 +0000 (Tue, 02 Oct 2012) Log Message: ----------- Translate string Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-10-02 12:47:45 UTC (rev 8382) +++ trunk/lib/upgrade.php 2012-10-02 12:51:40 UTC (rev 8383) @@ -104,7 +104,7 @@ _(" Skipped"),".<br />\n"; } } else { - echo "$path/$pagename: ",("unknown format."), + echo "$path/$pagename: ",_("unknown format."), _(" Skipped"),".<br />\n"; } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-10-05 11:53:17
|
Revision: 8392 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8392&view=rev Author: vargenau Date: 2012-10-05 11:53:09 +0000 (Fri, 05 Oct 2012) Log Message: ----------- Reformat code Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-10-02 14:59:08 UTC (rev 8391) +++ trunk/lib/upgrade.php 2012-10-05 11:53:09 UTC (rev 8392) @@ -42,110 +42,115 @@ * 5. Check for changed theme variables. (hard, not yet) * 6. Convert the single-request upgrade to a class-based multi-page * version. (hard) - + * * Done: overwrite=1 link on edit conflicts at first occurence "Overwrite all". * * @author: Reini Urban */ require_once 'lib/loadsave.php'; -class Upgrade { +class Upgrade +{ - function Upgrade (&$request) { - $this->request =& $request; - $this->dbi =& $request->_dbi; // no reference for dbadmin ? - $this->phpwiki_version = $this->current_db_version = phpwiki_version(); - //$this->current_db_version = 1030.13; // should be stored in the db. should be phpwiki_version + function Upgrade(&$request) + { + $this->request =& $request; + $this->dbi =& $request->_dbi; // no reference for dbadmin ? + $this->phpwiki_version = $this->current_db_version = phpwiki_version(); + //$this->current_db_version = 1030.13; // should be stored in the db. should be phpwiki_version - $this->db_version = $this->dbi->get_db_version(); - $this->isSQL = $this->dbi->_backend->isSQL(); + $this->db_version = $this->dbi->get_db_version(); + $this->isSQL = $this->dbi->_backend->isSQL(); } /** * TODO: check for the pgsrc_version number, not the revision mtime only */ - function doPgsrcUpdate($pagename, $path, $filename) { - // don't ever update the HomePage - if ((defined(HOME_PAGE) and ($pagename == HOME_PAGE)) - or ($pagename == _("HomePage")) - or ($pagename == "HomePage")) { - echo "$path/$pagename: ",_("always skip the HomePage."), - _(" Skipped"),".<br />\n"; + function doPgsrcUpdate($pagename, $path, $filename) + { + // don't ever update the HomePage + if ((defined(HOME_PAGE) and ($pagename == HOME_PAGE)) + or ($pagename == _("HomePage")) + or ($pagename == "HomePage") + ) { + echo "$path/$pagename: ", _("always skip the HomePage."), + _(" Skipped"), ".<br />\n"; return; - } + } - $page = $this->dbi->getPage($pagename); - if ($page->exists()) { - // check mtime: update automatically if pgsrc is newer - $rev = $page->getCurrentRevision(); - $page_mtime = $rev->get('mtime'); - $data = implode("", file($path."/".$filename)); - if (($parts = ParseMimeifiedPages($data))) { - usort($parts, 'SortByPageVersion'); - reset($parts); - $pageinfo = $parts[0]; - $stat = stat($path."/".$filename); - $new_mtime = 0; - if (isset($pageinfo['versiondata']['mtime'])) - $new_mtime = $pageinfo['versiondata']['mtime']; - if (!$new_mtime and isset($pageinfo['versiondata']['lastmodified'])) - $new_mtime = $pageinfo['versiondata']['lastmodified']; - if (!$new_mtime and isset($pageinfo['pagedata']['date'])) - $new_mtime = $pageinfo['pagedata']['date']; - if (!$new_mtime) - $new_mtime = $stat[9]; - if ($new_mtime > $page_mtime) { - echo "$path/$pagename: ",_("newer than the existing page."), - _(" replace "),"($new_mtime > $page_mtime)","<br />\n"; - LoadAny($this->request, $path."/".$filename); + $page = $this->dbi->getPage($pagename); + if ($page->exists()) { + // check mtime: update automatically if pgsrc is newer + $rev = $page->getCurrentRevision(); + $page_mtime = $rev->get('mtime'); + $data = implode("", file($path . "/" . $filename)); + if (($parts = ParseMimeifiedPages($data))) { + usort($parts, 'SortByPageVersion'); + reset($parts); + $pageinfo = $parts[0]; + $stat = stat($path . "/" . $filename); + $new_mtime = 0; + if (isset($pageinfo['versiondata']['mtime'])) + $new_mtime = $pageinfo['versiondata']['mtime']; + if (!$new_mtime and isset($pageinfo['versiondata']['lastmodified'])) + $new_mtime = $pageinfo['versiondata']['lastmodified']; + if (!$new_mtime and isset($pageinfo['pagedata']['date'])) + $new_mtime = $pageinfo['pagedata']['date']; + if (!$new_mtime) + $new_mtime = $stat[9]; + if ($new_mtime > $page_mtime) { + echo "$path/$pagename: ", _("newer than the existing page."), + _(" replace "), "($new_mtime > $page_mtime)", "<br />\n"; + LoadAny($this->request, $path . "/" . $filename); + echo "<br />\n"; + } else { + echo "$path/$pagename: ", _("older than the existing page."), + _(" Skipped"), ".<br />\n"; + } + } else { + echo "$path/$pagename: ", _("unknown format."), + _(" Skipped"), ".<br />\n"; + } + } else { + echo sprintf(_("%s does not exist"), $pagename), "<br />\n"; + LoadAny($this->request, $path . "/" . $filename); echo "<br />\n"; - } else { - echo "$path/$pagename: ",_("older than the existing page."), - _(" Skipped"),".<br />\n"; } - } else { - echo "$path/$pagename: ",_("unknown format."), - _(" Skipped"),".<br />\n"; - } - } else { - echo sprintf(_("%s does not exist"),$pagename),"<br />\n"; - LoadAny($this->request, $path."/".$filename); - echo "<br />\n"; } - } - function CheckActionPageUpdate() { - echo "<h3>",sprintf(_("Check for necessary %s updates"), - _("ActionPage")),"</h3>\n"; - // 1.3.13 before we pull in all missing pages, we rename existing ones - $this->_rename_page_helper(_("_AuthInfo"), _("DebugAuthInfo")); - // this is in some templates. so we keep the old name - //$this->_rename_page_helper($this->dbi, _("DebugInfo"), _("DebugBackendInfo")); - $this->_rename_page_helper(_("_GroupInfo"), _("GroupAuthInfo")); //never officially existed - $this->_rename_page_helper("InterWikiKarte", "InterWikiListe"); // german only + function CheckActionPageUpdate() + { + echo "<h2>", sprintf(_("Check for necessary %s updates"), + _("ActionPage")), "</h2>\n"; + // 1.3.13 before we pull in all missing pages, we rename existing ones + $this->_rename_page_helper(_("_AuthInfo"), _("DebugAuthInfo")); + // this is in some templates. so we keep the old name + //$this->_rename_page_helper($this->dbi, _("DebugInfo"), _("DebugBackendInfo")); + $this->_rename_page_helper(_("_GroupInfo"), _("GroupAuthInfo")); //never officially existed + $this->_rename_page_helper("InterWikiKarte", "InterWikiListe"); // german only - $path = FindFile('pgsrc'); - $pgsrc = new fileSet($path); - // most actionpages have the same name as the plugin - $loc_path = FindLocalizedFile('pgsrc'); - foreach ($pgsrc->getFiles() as $filename) { - if (substr($filename,-1,1) == '~') continue; - if (substr($filename,-5,5) == '.orig') continue; - $pagename = urldecode($filename); - if (isActionPage($pagename)) { - $translation = gettext($pagename); - if ($translation == $pagename) - $this->doPgsrcUpdate($pagename, $path, $filename); - elseif (FindLocalizedFile('pgsrc/'.urlencode($translation),1)) - $this->doPgsrcUpdate($translation, $loc_path, urlencode($translation)); - else - $this->doPgsrcUpdate($pagename, $path, $filename); + $path = FindFile('pgsrc'); + $pgsrc = new fileSet($path); + // most actionpages have the same name as the plugin + $loc_path = FindLocalizedFile('pgsrc'); + foreach ($pgsrc->getFiles() as $filename) { + if (substr($filename, -1, 1) == '~') continue; + if (substr($filename, -5, 5) == '.orig') continue; + $pagename = urldecode($filename); + if (isActionPage($pagename)) { + $translation = gettext($pagename); + if ($translation == $pagename) + $this->doPgsrcUpdate($pagename, $path, $filename); + elseif (FindLocalizedFile('pgsrc/' . urlencode($translation), 1)) + $this->doPgsrcUpdate($translation, $loc_path, urlencode($translation)); else + $this->doPgsrcUpdate($pagename, $path, $filename); + } } } - } // see loadsave.php for saving new pages. - function CheckPgsrcUpdate() { + function CheckPgsrcUpdate() + { // Check some theme specific pgsrc files (blog, wikilens, fusionforge, custom). // We check theme specific pgsrc first in case the page is present in both // theme specific and global pgsrc @@ -155,27 +160,27 @@ // Notice: Unable to open directory 'themes/MonoBook/pgsrc' for reading $pgsrc = new fileSet($path); if ($pgsrc->getFiles()) { - echo "<h3>",sprintf(_("Check for necessary theme %s updates"), - "pgsrc"),"</h3>\n"; + echo "<h2>", sprintf(_("Check for necessary theme %s updates"), + "pgsrc"), "</h2>\n"; foreach ($pgsrc->getFiles() as $filename) { - if (substr($filename,-1,1) == '~') continue; - if (substr($filename,-5,5) == '.orig') continue; + if (substr($filename, -1, 1) == '~') continue; + if (substr($filename, -5, 5) == '.orig') continue; $pagename = urldecode($filename); - $this->doPgsrcUpdate($pagename,$path,$filename); + $this->doPgsrcUpdate($pagename, $path, $filename); } } - echo "<h3>",sprintf(_("Check for necessary %s updates"), - "pgsrc"),"</h3>\n"; + echo "<h2>", sprintf(_("Check for necessary %s updates"), + "pgsrc"), "</h2>\n"; if ($this->db_version < 1030.12200612) { - echo "<h4>",_("rename to Help: pages"),"</h4>\n"; + echo "<h4>", _("rename to Help: pages"), "</h4>\n"; } $path = FindLocalizedFile(WIKI_PGSRC); $pgsrc = new fileSet($path); // fixme: verification, ... foreach ($pgsrc->getFiles() as $filename) { - if (substr($filename,-1,1) == '~') continue; - if (substr($filename,-5,5) == '.orig') continue; + if (substr($filename, -1, 1) == '~') continue; + if (substr($filename, -5, 5) == '.orig') continue; $pagename = urldecode($filename); if (!isActionPage($filename)) { // There're a lot of now unneeded pages around. @@ -183,29 +188,31 @@ if ($this->db_version < 1030.12200612) { $this->_rename_to_help_page($pagename); } - $this->doPgsrcUpdate($pagename,$path,$filename); + $this->doPgsrcUpdate($pagename, $path, $filename); } } } - function _rename_page_helper($oldname, $pagename) { - echo sprintf(_("rename %s to %s"), $oldname, $pagename)," ..."; - if ($this->dbi->isWikiPage($oldname) and !$this->dbi->isWikiPage($pagename)) { - if ($this->dbi->_backend->rename_page($oldname, $pagename)) - echo _("OK")," <br />\n"; - else - echo " <b><font color=\"red\">", _("FAILED"), "</font></b>", - " <br />\n"; - } else { - echo _(" Skipped")," <br />\n"; + function _rename_page_helper($oldname, $pagename) + { + echo sprintf(_("rename %s to %s"), $oldname, $pagename), " ..."; + if ($this->dbi->isWikiPage($oldname) and !$this->dbi->isWikiPage($pagename)) { + if ($this->dbi->_backend->rename_page($oldname, $pagename)) + echo _("OK"), " <br />\n"; + else + echo " <b><font color=\"red\">", _("FAILED"), "</font></b>", + " <br />\n"; + } else { + echo _(" Skipped"), " <br />\n"; + } } - } - function _rename_to_help_page($pagename) { - $newprefix = _("Help") . "/"; - if (substr($pagename,0,strlen($newprefix)) != $newprefix) return; - $oldname = substr($pagename,strlen($newprefix)); - $this->_rename_page_helper($oldname, $pagename); + function _rename_to_help_page($pagename) + { + $newprefix = _("Help") . "/"; + if (substr($pagename, 0, strlen($newprefix)) != $newprefix) return; + $oldname = substr($pagename, strlen($newprefix)); + $this->_rename_page_helper($oldname, $pagename); } /** @@ -213,26 +220,27 @@ * and create it. * Supported: mysql and generic SQL, for ADODB and PearDB. */ - function installTable($table, $backend_type) { - global $DBParams; - if (!$this->isSQL) return; - echo _("MISSING")," ... \n"; - $backend = &$this->dbi->_backend->_dbh; - /* - $schema = findFile("schemas/${backend_type}.sql"); - if (!$schema) { - echo " ",_("FAILED"),": ",sprintf(_("no schema %s found"), - "schemas/${backend_type}.sql")," ... <br />\n"; - return false; - } - */ - extract($this->dbi->_backend->_table_names); - $prefix = isset($DBParams['prefix']) ? $DBParams['prefix'] : ''; - switch ($table) { - case 'session': - assert($session_tbl); - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" + function installTable($table, $backend_type) + { + global $DBParams; + if (!$this->isSQL) return; + echo _("MISSING"), " ... \n"; + $backend = &$this->dbi->_backend->_dbh; + /* + $schema = findFile("schemas/${backend_type}.sql"); + if (!$schema) { + echo " ",_("FAILED"),": ",sprintf(_("no schema %s found"), + "schemas/${backend_type}.sql")," ... <br />\n"; + return false; + } + */ + extract($this->dbi->_backend->_table_names); + $prefix = isset($DBParams['prefix']) ? $DBParams['prefix'] : ''; + switch ($table) { + case 'session': + assert($session_tbl); + if ($backend_type == 'mysql') { + $this->dbi->genericSqlQuery(" CREATE TABLE $session_tbl ( sess_id CHAR(32) NOT NULL DEFAULT '', sess_data BLOB NOT NULL, @@ -241,63 +249,63 @@ PRIMARY KEY (sess_id), INDEX (sess_date) )"); - } else { - $this->dbi->genericSqlQuery(" + } else { + $this->dbi->genericSqlQuery(" CREATE TABLE $session_tbl ( sess_id CHAR(32) NOT NULL DEFAULT '', - sess_data ".($backend_type == 'pgsql'?'TEXT':'BLOB')." NOT NULL, + sess_data " . ($backend_type == 'pgsql' ? 'TEXT' : 'BLOB') . " NOT NULL, sess_date INT, sess_ip CHAR(15) NOT NULL )"); - $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX sess_id ON $session_tbl (sess_id)"); - } - $this->dbi->genericSqlQuery("CREATE INDEX sess_date on session (sess_date)"); - echo " ",_("CREATED"); - break; - case 'pref': - $pref_tbl = $prefix.'pref'; - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" + $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX sess_id ON $session_tbl (sess_id)"); + } + $this->dbi->genericSqlQuery("CREATE INDEX sess_date on session (sess_date)"); + echo " ", _("CREATED"); + break; + case 'pref': + $pref_tbl = $prefix . 'pref'; + if ($backend_type == 'mysql') { + $this->dbi->genericSqlQuery(" CREATE TABLE $pref_tbl ( userid CHAR(48) BINARY NOT NULL UNIQUE, prefs TEXT NULL DEFAULT '', PRIMARY KEY (userid) )"); - } else { - $this->dbi->genericSqlQuery(" + } else { + $this->dbi->genericSqlQuery(" CREATE TABLE $pref_tbl ( userid CHAR(48) NOT NULL, prefs TEXT NULL DEFAULT '' )"); - $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX userid ON $pref_tbl (userid)"); - } - echo " ",_("CREATED"); - break; - case 'member': - $member_tbl = $prefix.'member'; - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" + $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX userid ON $pref_tbl (userid)"); + } + echo " ", _("CREATED"); + break; + case 'member': + $member_tbl = $prefix . 'member'; + if ($backend_type == 'mysql') { + $this->dbi->genericSqlQuery(" CREATE TABLE $member_tbl ( userid CHAR(48) BINARY NOT NULL, groupname CHAR(48) BINARY NOT NULL DEFAULT 'users', INDEX (userid), INDEX (groupname) )"); - } else { - $this->dbi->genericSqlQuery(" + } else { + $this->dbi->genericSqlQuery(" CREATE TABLE $member_tbl ( userid CHAR(48) NOT NULL, groupname CHAR(48) NOT NULL DEFAULT 'users' )"); - $this->dbi->genericSqlQuery("CREATE INDEX userid ON $member_tbl (userid)"); - $this->dbi->genericSqlQuery("CREATE INDEX groupname ON $member_tbl (groupname)"); - } - echo " ",_("CREATED"); - break; - case 'rating': - $rating_tbl = $prefix.'rating'; - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" + $this->dbi->genericSqlQuery("CREATE INDEX userid ON $member_tbl (userid)"); + $this->dbi->genericSqlQuery("CREATE INDEX groupname ON $member_tbl (groupname)"); + } + echo " ", _("CREATED"); + break; + case 'rating': + $rating_tbl = $prefix . 'rating'; + if ($backend_type == 'mysql') { + $this->dbi->genericSqlQuery(" CREATE TABLE $rating_tbl ( dimension INT(4) NOT NULL, raterpage INT(11) NOT NULL, @@ -307,8 +315,8 @@ tstamp TIMESTAMP(14) NOT NULL, PRIMARY KEY (dimension, raterpage, rateepage) )"); - } else { - $this->dbi->genericSqlQuery(" + } else { + $this->dbi->genericSqlQuery(" CREATE TABLE $rating_tbl ( dimension INT(4) NOT NULL, raterpage INT(11) NOT NULL, @@ -317,38 +325,38 @@ rateeversion INT(11) NOT NULL, tstamp TIMESTAMP(14) NOT NULL )"); - $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX rating" - ." ON $rating_tbl (dimension, raterpage, rateepage)"); - } - echo " ",_("CREATED"); - break; - case 'accesslog': - $log_tbl = $prefix.'accesslog'; - // fields according to http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178 - /* - A User Agent agent varchar(255) Mozilla/4.0 (compat; MSIE 6.0; Windows) - a CGi request arguments request_args varchar(255) user=Smith&cart=1231&item=532 - b Bytes transfered bytes_sent int unsigned 32561 - c??? Text of cookie cookie varchar(255) Apache=sdyn.fooonline.net 1300102700823 - f Local filename requested request_file varchar(255) /var/www/html/books-cycroad.html - H HTTP request_protocol request_protocol varchar(10) HTTP/1.1 - h Name of remote host remote_host varchar(50) blah.foobar.com - I Request ID (from modd_unique_id) id char(19) POlFcUBRH30AAALdBG8 - l Ident user info remote_logname varcgar(50) bobby - M Machine ID??? machine_id varchar(25) web01 - m HTTP request method request_method varchar(10) GET - P httpd cchild PID child_pid smallint unsigned 3215 - p http port server_port smallint unsigned 80 - R Referer referer varchar(255) http://www.biglinks4u.com/linkpage.html - r Request in full form request_line varchar(255) GET /books-cycroad.html HTTP/1.1 - S Time of request in UNIX time_t format time_stamp int unsigned 1005598029 - T Seconds to service request request_duration smallint unsigned 2 - t Time of request in human format request_time char(28) [02/Dec/2001:15:01:26 -0800] - U Request in simple form request_uri varchar(255) /books-cycroad.html - u User info from HTTP auth remote_user varchar(50) bobby - v Virtual host servicing the request virtual_host varchar(255) - */ - $this->dbi->genericSqlQuery(" + $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX rating" + . " ON $rating_tbl (dimension, raterpage, rateepage)"); + } + echo " ", _("CREATED"); + break; + case 'accesslog': + $log_tbl = $prefix . 'accesslog'; + // fields according to http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178 + /* + A User Agent agent varchar(255) Mozilla/4.0 (compat; MSIE 6.0; Windows) + a CGi request arguments request_args varchar(255) user=Smith&cart=1231&item=532 + b Bytes transfered bytes_sent int unsigned 32561 + c??? Text of cookie cookie varchar(255) Apache=sdyn.fooonline.net 1300102700823 + f Local filename requested request_file varchar(255) /var/www/html/books-cycroad.html + H HTTP request_protocol request_protocol varchar(10) HTTP/1.1 + h Name of remote host remote_host varchar(50) blah.foobar.com + I Request ID (from modd_unique_id) id char(19) POlFcUBRH30AAALdBG8 + l Ident user info remote_logname varcgar(50) bobby + M Machine ID??? machine_id varchar(25) web01 + m HTTP request method request_method varchar(10) GET + P httpd cchild PID child_pid smallint unsigned 3215 + p http port server_port smallint unsigned 80 + R Referer referer varchar(255) http://www.biglinks4u.com/linkpage.html + r Request in full form request_line varchar(255) GET /books-cycroad.html HTTP/1.1 + S Time of request in UNIX time_t format time_stamp int unsigned 1005598029 + T Seconds to service request request_duration smallint unsigned 2 + t Time of request in human format request_time char(28) [02/Dec/2001:15:01:26 -0800] + U Request in simple form request_uri varchar(255) /books-cycroad.html + u User info from HTTP auth remote_user varchar(50) bobby + v Virtual host servicing the request virtual_host varchar(255) + */ + $this->dbi->genericSqlQuery(" CREATE TABLE $log_tbl ( time_stamp int unsigned, remote_host varchar(100), @@ -364,13 +372,13 @@ agent varchar(255), request_duration float )"); - $this->dbi->genericSqlQuery("CREATE INDEX log_time ON $log_tbl (time_stamp)"); - $this->dbi->genericSqlQuery("CREATE INDEX log_host ON $log_tbl (remote_host)"); - echo " ",_("CREATED"); - break; + $this->dbi->genericSqlQuery("CREATE INDEX log_time ON $log_tbl (time_stamp)"); + $this->dbi->genericSqlQuery("CREATE INDEX log_host ON $log_tbl (remote_host)"); + echo " ", _("CREATED"); + break; + } + echo "<br />\n"; } - echo "<br />\n"; - } /** * Update from ~1.3.4 to current. @@ -378,20 +386,21 @@ * jeffs-hacks database api (around 1.3.2) later: * people should export/import their pages if using that old versions. */ - function CheckDatabaseUpdate() { - global $DBAuthParams, $DBParams; + function CheckDatabaseUpdate() + { + global $DBAuthParams, $DBParams; - echo "<h3>",sprintf(_("Check for necessary %s updates"), - _("database")), - " - ", DATABASE_TYPE,"</h3>\n"; - $dbadmin = $this->request->getArg('dbadmin'); - if ($this->isSQL) { - $this->_db_init(); - if (isset($dbadmin['cancel'])) { - echo _("CANCEL")," <br />\n"; - return; + echo "<h2>", sprintf(_("Check for necessary %s updates"), + _("database")), + " - ", DATABASE_TYPE, "</h2>\n"; + $dbadmin = $this->request->getArg('dbadmin'); + if ($this->isSQL) { + $this->_db_init(); + if (isset($dbadmin['cancel'])) { + echo _("CANCEL"), " <br />\n"; + return; + } } - } echo "db version: we want ", $this->current_db_version, "\n<br />"; echo "db version: we have ", $this->db_version, "\n<br />"; if ($this->db_version >= $this->current_db_version) { @@ -399,301 +408,300 @@ return; } - $backend_type = $this->dbi->_backend->backendType(); - if ($this->isSQL) { - echo "<h4>",_("Backend type: "),$backend_type,"</h4>\n"; - $prefix = isset($DBParams['prefix']) ? $DBParams['prefix'] : ''; - $tables = $this->dbi->_backend->listOfTables(); - foreach (explode(':','session:pref:member') as $table) { - echo sprintf(_("Check for table %s"), $table)," ..."; - if (!in_array($prefix.$table, $tables)) { - $this->installTable($table, $backend_type); - } else { - echo _("OK")," <br />\n"; + $backend_type = $this->dbi->_backend->backendType(); + if ($this->isSQL) { + echo "<h4>", _("Backend type: "), $backend_type, "</h4>\n"; + $prefix = isset($DBParams['prefix']) ? $DBParams['prefix'] : ''; + $tables = $this->dbi->_backend->listOfTables(); + foreach (explode(':', 'session:pref:member') as $table) { + echo sprintf(_("Check for table %s"), $table), " ..."; + if (!in_array($prefix . $table, $tables)) { + $this->installTable($table, $backend_type); + } else { + echo _("OK"), " <br />\n"; + } + } } - } - } - if ($this->phpwiki_version >= 1030.12200612 and $this->db_version < 1030.13) { - if ($this->isSQL and preg_match("/(pgsql|postgres)/", $backend_type)) { - trigger_error("You need to upgrade to schema/psql-initialize.sql manually!", - E_USER_WARNING); - // $this->_upgrade_psql_tsearch2(); + if ($this->phpwiki_version >= 1030.12200612 and $this->db_version < 1030.13) { + if ($this->isSQL and preg_match("/(pgsql|postgres)/", $backend_type)) { + trigger_error("You need to upgrade to schema/psql-initialize.sql manually!", + E_USER_WARNING); + // $this->_upgrade_psql_tsearch2(); + } + $this->_upgrade_relation_links(); } - $this->_upgrade_relation_links(); - } - if (ACCESS_LOG_SQL and $this->isSQL) { - $table = "accesslog"; - echo sprintf(_("Check for table %s"), $table)," ..."; - if (!in_array($prefix.$table, $tables)) { - $this->installTable($table, $backend_type); - } else { - echo _("OK")," <br />\n"; + if (ACCESS_LOG_SQL and $this->isSQL) { + $table = "accesslog"; + echo sprintf(_("Check for table %s"), $table), " ..."; + if (!in_array($prefix . $table, $tables)) { + $this->installTable($table, $backend_type); + } else { + echo _("OK"), " <br />\n"; + } } - } - if ($this->isSQL and (class_exists("RatingsUserFactory") or $this->dbi->isWikiPage(_("RateIt")))) { - $table = "rating"; - echo sprintf(_("Check for table %s"), $table)," ..."; - if (!in_array($prefix.$table, $tables)) { - $this->installTable($table, $backend_type); - } else { - echo _("OK")," <br />\n"; + if ($this->isSQL and (class_exists("RatingsUserFactory") or $this->dbi->isWikiPage(_("RateIt")))) { + $table = "rating"; + echo sprintf(_("Check for table %s"), $table), " ..."; + if (!in_array($prefix . $table, $tables)) { + $this->installTable($table, $backend_type); + } else { + echo _("OK"), " <br />\n"; + } } - } - $backend = &$this->dbi->_backend->_dbh; - if ($this->isSQL) - extract($this->dbi->_backend->_table_names); + $backend = &$this->dbi->_backend->_dbh; + if ($this->isSQL) + extract($this->dbi->_backend->_table_names); - // 1.3.8 added session.sess_ip - if ($this->isSQL and $this->phpwiki_version >= 1030.08 and USE_DB_SESSION - and isset($this->request->_dbsession)) - { - echo _("Check for new session.sess_ip column")," ... "; - $database = $this->dbi->_backend->database(); - assert(!empty($DBParams['db_session_table'])); - $session_tbl = $prefix . $DBParams['db_session_table']; - $sess_fields = $this->dbi->_backend->listOfFields($database, $session_tbl); - if (!$sess_fields) { - echo _("SKIP"); - } elseif (!strstr(strtolower(join(':', $sess_fields)), "sess_ip")) { - // TODO: postgres test (should be able to add columns at the end, but not in between) - echo "<b>",_("ADDING"),"</b>"," ... "; - $this->dbi->genericSqlQuery("ALTER TABLE $session_tbl ADD sess_ip CHAR(15) NOT NULL"); - $this->dbi->genericSqlQuery("CREATE INDEX sess_date ON $session_tbl (sess_date)"); - } else { - echo _("OK"); - } - echo "<br />\n"; - if (substr($backend_type,0,5) == 'mysql') { - // upgrade to 4.1.8 destroyed my session table: - // sess_id => varchar(10), sess_data => varchar(5). For others obviously also. - echo _("Check for mysql session.sess_id sanity")," ... "; - $result = $this->dbi->genericSqlQuery("DESCRIBE $session_tbl"); - if (DATABASE_TYPE == 'SQL') { - $iter = new WikiDB_backend_PearDB_generic_iter($backend, $result); - } elseif (DATABASE_TYPE == 'ADODB') { - $iter = new WikiDB_backend_ADODB_generic_iter($backend, $result, - array("Field", "Type", "Null", "Key", "Default", "Extra")); - } elseif (DATABASE_TYPE == 'PDO') { - $iter = new WikiDB_backend_PDO_generic_iter($backend, $result); - } - while ($col = $iter->next()) { - if ($col["Field"] == 'sess_id' and !strstr(strtolower($col["Type"]), 'char(32)')) { - $this->dbi->genericSqlQuery("ALTER TABLE $session_tbl CHANGE sess_id" - ." sess_id CHAR(32) NOT NULL"); - echo "sess_id ", $col["Type"], " ", _("fixed"), " => CHAR(32) "; + // 1.3.8 added session.sess_ip + if ($this->isSQL and $this->phpwiki_version >= 1030.08 and USE_DB_SESSION + and isset($this->request->_dbsession) + ) { + echo _("Check for new session.sess_ip column"), " ... "; + $database = $this->dbi->_backend->database(); + assert(!empty($DBParams['db_session_table'])); + $session_tbl = $prefix . $DBParams['db_session_table']; + $sess_fields = $this->dbi->_backend->listOfFields($database, $session_tbl); + if (!$sess_fields) { + echo _("SKIP"); + } elseif (!strstr(strtolower(join(':', $sess_fields)), "sess_ip")) { + // TODO: postgres test (should be able to add columns at the end, but not in between) + echo "<b>", _("ADDING"), "</b>", " ... "; + $this->dbi->genericSqlQuery("ALTER TABLE $session_tbl ADD sess_ip CHAR(15) NOT NULL"); + $this->dbi->genericSqlQuery("CREATE INDEX sess_date ON $session_tbl (sess_date)"); + } else { + echo _("OK"); } - if ($col["Field"] == 'sess_ip' and !strstr(strtolower($col["Type"]), 'char(15)')) { - $this->dbi->genericSqlQuery("ALTER TABLE $session_tbl CHANGE sess_ip" - ." sess_ip CHAR(15) NOT NULL"); - echo "sess_ip ", $col["Type"], " ", _("fixed"), " => CHAR(15) "; + echo "<br />\n"; + if (substr($backend_type, 0, 5) == 'mysql') { + // upgrade to 4.1.8 destroyed my session table: + // sess_id => varchar(10), sess_data => varchar(5). For others obviously also. + echo _("Check for mysql session.sess_id sanity"), " ... "; + $result = $this->dbi->genericSqlQuery("DESCRIBE $session_tbl"); + if (DATABASE_TYPE == 'SQL') { + $iter = new WikiDB_backend_PearDB_generic_iter($backend, $result); + } elseif (DATABASE_TYPE == 'ADODB') { + $iter = new WikiDB_backend_ADODB_generic_iter($backend, $result, + array("Field", "Type", "Null", "Key", "Default", "Extra")); + } elseif (DATABASE_TYPE == 'PDO') { + $iter = new WikiDB_backend_PDO_generic_iter($backend, $result); + } + while ($col = $iter->next()) { + if ($col["Field"] == 'sess_id' and !strstr(strtolower($col["Type"]), 'char(32)')) { + $this->dbi->genericSqlQuery("ALTER TABLE $session_tbl CHANGE sess_id" + . " sess_id CHAR(32) NOT NULL"); + echo "sess_id ", $col["Type"], " ", _("fixed"), " => CHAR(32) "; + } + if ($col["Field"] == 'sess_ip' and !strstr(strtolower($col["Type"]), 'char(15)')) { + $this->dbi->genericSqlQuery("ALTER TABLE $session_tbl CHANGE sess_ip" + . " sess_ip CHAR(15) NOT NULL"); + echo "sess_ip ", $col["Type"], " ", _("fixed"), " => CHAR(15) "; + } + } + echo _("OK"), "<br />\n"; } } - echo _("OK"), "<br />\n"; - } - } - /* TODO: - ALTER TABLE link ADD relation INT DEFAULT 0; - CREATE INDEX linkrelation ON link (relation); - */ + /* TODO: + ALTER TABLE link ADD relation INT DEFAULT 0; + CREATE INDEX linkrelation ON link (relation); + */ - // mysql >= 4.0.4 requires LOCK TABLE privileges - if (substr($backend_type,0,5) == 'mysql') { - echo _("Check for mysql LOCK TABLE privilege")," ..."; - $mysql_version = $this->dbi->_backend->_serverinfo['version']; - if ($mysql_version > 400.40) { - if (!empty($this->dbi->_backend->_parsedDSN)) - $parseDSN = $this->dbi->_backend->_parsedDSN; - elseif (function_exists('parseDSN')) // ADODB or PDO - $parseDSN = parseDSN($DBParams['dsn']); - else // pear - $parseDSN = DB::parseDSN($DBParams['dsn']); - $username = $this->dbi->_backend->qstr($parseDSN['username']); - // on db level - $query = "SELECT lock_tables_priv FROM mysql.db WHERE user='$username'"; - //mysql_select_db("mysql", $this->dbi->_backend->connection()); - $db_fields = $this->dbi->_backend->listOfFields("mysql", "db"); - if (!strstr(strtolower(join(':', $db_fields)), "lock_tables_priv")) { - echo join(':', $db_fields); - die("lock_tables_priv missing. The DB Admin must run mysql_fix_privilege_tables"); - } - $row = $this->dbi->_backend->getRow($query); - if (isset($row[0]) and $row[0] == 'N') { - $this->dbi->genericSqlQuery("UPDATE mysql.db SET lock_tables_priv='Y'" - ." WHERE mysql.user='$username'"); - $this->dbi->genericSqlQuery("FLUSH PRIVILEGES"); - echo "mysql.db user='$username'", _("fixed"), "<br />\n"; - } elseif (!$row) { - // or on user level - $query = "SELECT lock_tables_priv FROM mysql.user WHERE user='$username'"; - $row = $this->dbi->_backend->getRow($query); - if ($row and $row[0] == 'N') { - $this->dbi->genericSqlQuery("UPDATE mysql.user SET lock_tables_priv='Y'" - ." WHERE mysql.user='$username'"); - $this->dbi->genericSqlQuery("FLUSH PRIVILEGES"); - echo "mysql.user user='$username'", _("fixed"), "<br />\n"; - } elseif (!$row) { - echo " <b><font color=\"red\">", _("FAILED"), "</font></b>: ", - "Neither mysql.db nor mysql.user has a user='$username'" - ." or the lock_tables_priv field", - "<br />\n"; + // mysql >= 4.0.4 requires LOCK TABLE privileges + if (substr($backend_type, 0, 5) == 'mysql') { + echo _("Check for mysql LOCK TABLE privilege"), " ..."; + $mysql_version = $this->dbi->_backend->_serverinfo['version']; + if ($mysql_version > 400.40) { + if (!empty($this->dbi->_backend->_parsedDSN)) + $parseDSN = $this->dbi->_backend->_parsedDSN; + elseif (function_exists('parseDSN')) // ADODB or PDO + $parseDSN = parseDSN($DBParams['dsn']); else // pear + $parseDSN = DB::parseDSN($DBParams['dsn']); + $username = $this->dbi->_backend->qstr($parseDSN['username']); + // on db level + $query = "SELECT lock_tables_priv FROM mysql.db WHERE user='$username'"; + //mysql_select_db("mysql", $this->dbi->_backend->connection()); + $db_fields = $this->dbi->_backend->listOfFields("mysql", "db"); + if (!strstr(strtolower(join(':', $db_fields)), "lock_tables_priv")) { + echo join(':', $db_fields); + die("lock_tables_priv missing. The DB Admin must run mysql_fix_privilege_tables"); + } + $row = $this->dbi->_backend->getRow($query); + if (isset($row[0]) and $row[0] == 'N') { + $this->dbi->genericSqlQuery("UPDATE mysql.db SET lock_tables_priv='Y'" + . " WHERE mysql.user='$username'"); + $this->dbi->genericSqlQuery("FLUSH PRIVILEGES"); + echo "mysql.db user='$username'", _("fixed"), "<br />\n"; + } elseif (!$row) { + // or on user level + $query = "SELECT lock_tables_priv FROM mysql.user WHERE user='$username'"; + $row = $this->dbi->_backend->getRow($query); + if ($row and $row[0] == 'N') { + $this->dbi->genericSqlQuery("UPDATE mysql.user SET lock_tables_priv='Y'" + . " WHERE mysql.user='$username'"); + $this->dbi->genericSqlQuery("FLUSH PRIVILEGES"); + echo "mysql.user user='$username'", _("fixed"), "<br />\n"; + } elseif (!$row) { + echo " <b><font color=\"red\">", _("FAILED"), "</font></b>: ", + "Neither mysql.db nor mysql.user has a user='$username'" + . " or the lock_tables_priv field", + "<br />\n"; + } else { + echo _("OK"), "<br />\n"; + } + } else { + echo _("OK"), "<br />\n"; + } + //mysql_select_db($this->dbi->_backend->database(), $this->dbi->_backend->connection()); } else { - echo _("OK"), "<br />\n"; + echo sprintf(_("version <em>%s</em> not affected"), $mysql_version), "<br />\n"; } - } else { - echo _("OK"), "<br />\n"; } - //mysql_select_db($this->dbi->_backend->database(), $this->dbi->_backend->connection()); - } else { - echo sprintf(_("version <em>%s</em> not affected"), $mysql_version),"<br />\n"; - } - } - // 1.3.10 mysql requires page.id auto_increment - // mysql, mysqli or mysqlt - if ($this->phpwiki_version >= 1030.099 and substr($backend_type,0,5) == 'mysql' - and DATABASE_TYPE != 'PDO') - { - echo _("Check for mysql page.id auto_increment flag")," ..."; - assert(!empty($page_tbl)); - $database = $this->dbi->_backend->database(); - $fields = mysql_list_fields($database, $page_tbl, $this->dbi->_backend->connection()); - $columns = mysql_num_fields($fields); - for ($i = 0; $i < $columns; $i++) { - if (mysql_field_name($fields, $i) == 'id') { - $flags = mysql_field_flags($fields, $i); - //DONE: something was wrong with ADODB here. - if (!strstr(strtolower($flags), "auto_increment")) { - echo "<b>",_("ADDING"),"</b>"," ... "; - // MODIFY col_def valid since mysql 3.22.16, - // older mysql's need CHANGE old_col col_def - $this->dbi->genericSqlQuery("ALTER TABLE $page_tbl CHANGE id" - ." id INT NOT NULL AUTO_INCREMENT"); - $fields = mysql_list_fields($database, $page_tbl); - if (!strstr(strtolower(mysql_field_flags($fields, $i)), "auto_increment")) - echo " <b><font color=\"red\">", _("FAILED"), "</font></b><br />\n"; - else - echo _("OK"), "<br />\n"; - } else { - echo _("OK"), "<br />\n"; + // 1.3.10 mysql requires page.id auto_increment + // mysql, mysqli or mysqlt + if ($this->phpwiki_version >= 1030.099 and substr($backend_type, 0, 5) == 'mysql' + and DATABASE_TYPE != 'PDO' + ) { + echo _("Check for mysql page.id auto_increment flag"), " ..."; + assert(!empty($page_tbl)); + $database = $this->dbi->_backend->database(); + $fields = mysql_list_fields($database, $page_tbl, $this->dbi->_backend->connection()); + $columns = mysql_num_fields($fields); + for ($i = 0; $i < $columns; $i++) { + if (mysql_field_name($fields, $i) == 'id') { + $flags = mysql_field_flags($fields, $i); + //DONE: something was wrong with ADODB here. + if (!strstr(strtolower($flags), "auto_increment")) { + echo "<b>", _("ADDING"), "</b>", " ... "; + // MODIFY col_def valid since mysql 3.22.16, + // older mysql's need CHANGE old_col col_def + $this->dbi->genericSqlQuery("ALTER TABLE $page_tbl CHANGE id" + . " id INT NOT NULL AUTO_INCREMENT"); + $fields = mysql_list_fields($database, $page_tbl); + if (!strstr(strtolower(mysql_field_flags($fields, $i)), "auto_increment")) + echo " <b><font color=\"red\">", _("FAILED"), "</font></b><br />\n"; + else + echo _("OK"), "<br />\n"; + } else { + echo _("OK"), "<br />\n"; + } + break; + } } - break; + mysql_free_result($fields); } - } - mysql_free_result($fields); - } - // Check for mysql 4.1.x/5.0.0a binary search problem. - // http://bugs.mysql.com/bug.php?id=4398 - // "select * from page where LOWER(pagename) like '%search%'" does not apply LOWER! - // Confirmed for 4.1.0alpha,4.1.3-beta,5.0.0a; not yet tested for 4.1.2alpha, - // On windows only, though utf8 would be useful elsewhere also. - // Illegal mix of collations (latin1_bin,IMPLICIT) and - // (utf8_general_ci, COERCIBLE) for operation '=']) - if (isWindows() and substr($backend_type,0,5) == 'mysql') { - echo _("Check for mysql 4.1.x/5.0.0 binary search on windows problem")," ..."; - $mysql_version = $this->dbi->_backend->_serverinfo['version']; - if ($mysql_version < 401.0) { - echo sprintf(_("version <em>%s</em>"), $mysql_version)," ", - _("not affected"),"<br />\n"; - } elseif ($mysql_version >= 401.6) { // FIXME: since which version? - $row = $this->dbi->_backend->getRow("SHOW CREATE TABLE $page_tbl"); - $result = join(" ", $row); - if (strstr(strtolower($result), "character set") - and strstr(strtolower($result), "collate")) - { - echo _("OK"), "<br />\n"; - } else { - //SET CHARACTER SET latin1 - $charset = CHARSET; - if ($charset == 'iso-8859-1') $charset = 'latin1'; - $this->dbi->genericSqlQuery("ALTER TABLE $page_tbl CHANGE pagename " - ."pagename VARCHAR(100) " - ."CHARACTER SET '$charset' COLLATE '$charset"."_bin' NOT NULL"); - echo sprintf(_("version <em>%s</em>"), $mysql_version), - " <b>",_("FIXED"),"</b>", - "<br />\n"; - } - } elseif (DATABASE_TYPE != 'PDO') { - // check if already fixed - extract($this->dbi->_backend->_table_names); - assert(!empty($page_tbl)); - $database = $this->dbi->_backend->database(); - $fields = mysql_list_fields($database, $page_tbl, $this->dbi->_backend->connection()); - $columns = mysql_num_fields($fields); - for ($i = 0; $i < $columns; $i++) { - if (mysql_field_name($fields, $i) == 'pagename') { - $flags = mysql_field_flags($fields, $i); - // I think it was fixed with 4.1.6, but I tested it only with 4.1.8 - if ($mysql_version > 401.0 and $mysql_version < 401.6) { - // remove the binary flag - if (strstr(strtolower($flags), "binary")) { - // FIXME: on duplicate pagenames this will fail! - $this->dbi->genericSqlQuery("ALTER TABLE $page_tbl CHANGE pagename" - ." pagename VARCHAR(100) NOT NULL"); - echo sprintf(_("version <em>%s</em>"), $mysql_version), - "<b>",_("FIXED"),"</b>" - ,"<br />\n"; + // Check for mysql 4.1.x/5.0.0a binary search problem. + // http://bugs.mysql.com/bug.php?id=4398 + // "select * from page where LOWER(pagename) like '%search%'" does not apply LOWER! + // Confirmed for 4.1.0alpha,4.1.3-beta,5.0.0a; not yet tested for 4.1.2alpha, + // On windows only, though utf8 would be useful elsewhere also. + // Illegal mix of collations (latin1_bin,IMPLICIT) and + // (utf8_general_ci, COERCIBLE) for operation '=']) + if (isWindows() and substr($backend_type, 0, 5) == 'mysql') { + echo _("Check for mysql 4.1.x/5.0.0 binary search on windows problem"), " ..."; + $mysql_version = $this->dbi->_backend->_serverinfo['version']; + if ($mysql_version < 401.0) { + echo sprintf(_("version <em>%s</em>"), $mysql_version), " ", + _("not affected"), "<br />\n"; + } elseif ($mysql_version >= 401.6) { // FIXME: since which version? + $row = $this->dbi->_backend->getRow("SHOW CREATE TABLE $page_tbl"); + $result = join(" ", $row); + if (strstr(strtolower($result), "character set") + and strstr(strtolower($result), "collate") + ) { + echo _("OK"), "<br />\n"; + } else { + //SET CHARACTER SET latin1 + $charset = CHARSET; + if ($charset == 'iso-8859-1') $charset = 'latin1'; + $this->dbi->genericSqlQuery("ALTER TABLE $page_tbl CHANGE pagename " + . "pagename VARCHAR(100) " + . "CHARACTER SET '$charset' COLLATE '$charset" . "_bin' NOT NULL"); + echo sprintf(_("version <em>%s</em>"), $mysql_version), + " <b>", _("FIXED"), "</b>", + "<br />\n"; } + } elseif (DATABASE_TYPE != 'PDO') { + // check if already fixed + extract($this->dbi->_backend->_table_names); + assert(!empty($page_tbl)); + $database = $this->dbi->_backend->database(); + $fields = mysql_list_fields($database, $page_tbl, $this->dbi->_backend->connection()); + $columns = mysql_num_fields($fields); + for ($i = 0; $i < $columns; $i++) { + if (mysql_field_name($fields, $i) == 'pagename') { + $flags = mysql_field_flags($fields, $i); + // I think it was fixed with 4.1.6, but I tested it only with 4.1.8 + if ($mysql_version > 401.0 and $mysql_version < 401.6) { + // remove the binary flag + if (strstr(strtolower($flags), "binary")) { + // FIXME: on duplicate pagenames this will fail! + $this->dbi->genericSqlQuery("ALTER TABLE $page_tbl CHANGE pagename" + . " pagename VARCHAR(100) NOT NULL"); + echo sprintf(_("version <em>%s</em>"), $mysql_version), + "<b>", _("FIXED"), "</b>" + , "<br />\n"; + } + } + break; + } + } } - break; + } + if ($this->isSQL and ACCESS_LOG_SQL & 2) { + echo _("Check for ACCESS_LOG_SQL passwords in POST requests"), " ..."; + // Don't display passwords in POST requests (up to 2005-02-04 12:03:20) + $res = $this->dbi->genericSqlIter("SELECT time_stamp, remote_host, " . + "request_args FROM ${prefix}accesslog WHERE request_args LIKE " . + "'%s:6:\"passwd\"%' AND request_args NOT LIKE '%s:6:\"passwd\";" . + "s:15:\"<not displayed>\"%'"); + $count = 0; + while ($row = $res->next()) { + $args = preg_replace("/(s:6:\"passwd\";s:15:\").*(\")/", + "$1<not displayed>$2", $row["request_args"]); + $ts = $row["time_stamp"]; + $rh = $row["remote_host"]; + $this->dbi->genericSqlQuery("UPDATE ${prefix}accesslog SET " . + "request_args='$args' WHERE time_stamp=$ts AND " . + "remote_host='$rh'"); + $count++; } - } - } - } - if ($this->isSQL and ACCESS_LOG_SQL & 2) { - echo _("Check for ACCESS_LOG_SQL passwords in POST requests")," ..."; - // Don't display passwords in POST requests (up to 2005-02-04 12:03:20) - $res = $this->dbi->genericSqlIter("SELECT time_stamp, remote_host, " . - "request_args FROM ${prefix}accesslog WHERE request_args LIKE " . - "'%s:6:\"passwd\"%' AND request_args NOT LIKE '%s:6:\"passwd\";" . - "s:15:\"<not displayed>\"%'"); - $count = 0; - while ($row = $res->next()) { - $args = preg_replace("/(s:6:\"passwd\";s:15:\").*(\")/", - "$1<not displayed>$2", $row["request_args"]); - $ts = $row["time_stamp"]; - $rh = $row["remote_host"]; - $this->dbi->genericSqlQuery("UPDATE ${prefix}accesslog SET " . - "request_args='$args' WHERE time_stamp=$ts AND " . - "remote_host='$rh'"); - $count++; - } - if ($count > 0) - echo "<b>",_("FIXED"),"</b>", "<br />\n"; - else - echo _("OK"),"<br />\n"; + if ($count > 0) + echo "<b>", _("FIXED"), "</b>", "<br />\n"; + else + echo _("OK"), "<br />\n"; - if ($this->phpwiki_version >= 1030.13) { - echo _("Check for ACCESS_LOG_SQL remote_host varchar(50)")," ..."; - $database = $this->dbi->_backend->database(); - $accesslog_tbl = $prefix . 'accesslog'; - $fields = $this->dbi->_backend->listOfFields($database, $accesslog_tbl); - if (!$fields) { - echo _("SKIP"); - } elseif (strstr(strtolower(join(':', $sess_fields)), "remote_host")) { - // TODO: how to check size, already done? - echo "<b>",_("FIXING"),"remote_host</b>"," ... "; - $this->dbi->genericSqlQuery("ALTER TABLE $accesslog_tbl CHANGE remote_host VARCHAR(100)"); - } else { - echo _("FAILED"); + if ($this->phpwiki_version >= 1030.13) { + echo _("Check for ACCESS_LOG_SQL remote_host varchar(50)"), " ..."; + $database = $this->dbi->_backend->database(); + $accesslog_tbl = $prefix . 'accesslog'; + $fields = $this->dbi->_backend->listOfFields($database, $accesslog_tbl); + if (!$fields) { + echo _("SKIP"); + } elseif (strstr(strtolower(join(':', $sess_fields)), "remote_host")) { + // TODO: how to check size, already done? + echo "<b>", _("FIXING"), "remote_host</b>", " ... "; + $this->dbi->genericSqlQuery("ALTER TABLE $accesslog_tbl CHANGE remote_host VARCHAR(100)"); + } else { + echo _("FAILED"); + } + echo "<br />\n"; + } } - echo "<br />\n"; - } - } - $this->_upgrade_cached_html(); + $this->_upgrade_cached_html(); - if ($this->db_version < $this->current_db_version) { - $this->dbi->set_db_version($this->current_db_version); - $this->db_version = $this->dbi->get_db_version(); - echo "db version: upgrade to ", $this->db_version," "; + if ($this->db_version < $this->current_db_version) { + $this->dbi->set_db_version($this->current_db_version); + $this->db_version = $this->dbi->get_db_version(); + echo "db version: upgrade to ", $this->db_version, " "; echo _("OK"), "<br />\n"; flush(); - } + } - return; + return; } /** @@ -703,100 +711,103 @@ * @see _is_false_error, ErrorManager * @access private */ - function _dbpermission_filter($err) { - if ( $err->isWarning() ) { - global $ErrorManager; - $this->error_caught = 1; - $ErrorManager->_postponed_errors[] = $err; - return true; + function _dbpermission_filter($err) + { + if ($err->isWarning()) { + global $ErrorManager; + $this->error_caught = 1; + $ErrorManager->_postponed_errors[] = $err; + return true; + } + return false; } - return false; - } - function _try_dbadmin_user ($user, $passwd) { - global $DBParams, $DBAuthParams; - $AdminParams = $DBParams; - if (DATABASE_TYPE == 'SQL') - $dsn = DB::parseDSN($AdminParams['dsn']); - else { - $dsn = parseDSN($AdminParams['dsn']); + function _try_dbadmin_user($user, $passwd) + { + global $DBParams, $DBAuthParams; + $AdminParams = $DBParams; + if (DATABASE_TYPE == 'SQL') + $dsn = DB::parseDSN($AdminParams['dsn']); + else { + $dsn = parseDSN($AdminParams['dsn']); + } + $AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", + $dsn['phptype'], + $user, + $passwd, + $dsn['hostspec'], + $dsn['database']); + $AdminParams['_tryroot_from_upgrade'] = 1; + // add error handler to warn about missing permissions for DBADMIN_USER + global $ErrorManager; + $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_dbpermission_filter')); + $this->error_caught = 0; + $this->dbi = WikiDB::open($AdminParams); + if (!$this->error_caught) return true; + // FAILED: redo our connection with the wikiuser + $this->dbi = WikiDB::open($DBParams); + $ErrorManager->flushPostponedErrors(); + $ErrorManager->popErrorHandler(); + return false; } - $AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", - $dsn['phptype'], - $user, - $passwd, - $dsn['hostspec'], - $dsn['database']); - $AdminParams['_tryroot_from_upgrade'] = 1; - // add error handler to warn about missing permissions for DBADMIN_USER - global $ErrorManager; - $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_dbpermission_filter')); - $this->error_caught = 0; - $this->dbi = WikiDB::open($AdminParams); - if (!$this->error_caught) return true; - // FAILED: redo our connection with the wikiuser - $this->dbi = WikiDB::open($DBParams); - $ErrorManager->flushPostponedErrors(); - $ErrorManager->popErrorHandler(); - return false; - } - function _db_init () { - if (!$this->isSQL) return; + function _db_init() + { + if (!$this->isSQL) return; - /* SQLite never needs admin params */ - $backend_type = $this->dbi->_backend->backendType(); - if (substr($backend_type,0,6)=="sqlite") { - return; - } - $dbadmin_user = 'root'; - if ($dbadmin = $this->request->getArg('dbadmin')) { - $dbadmin_user = $dbadmin['user']; - if (isset($dbadmin['cancel'])) { - return; - } elseif (!empty($dbadmin_user)) { - if ($this->_try_dbadmin_user($dbadmin['user'], $dbadmin['passwd'])) + /* SQLite never needs admin params */ + $backend_type = $this->dbi->_backend->backendType(); + if (substr($backend_type, 0, 6) == "sqlite") { return; } - } elseif (DBADMIN_USER) { - if ($this->_try_dbadmin_user(DBADMIN_USER, DBADMIN_PASSWD)) - return true; + $dbadmin_user = 'root'; + if ($dbadmin = $this->request->getArg('dbadmin')) { + $dbadmin_user = $dbadmin['user']; + if (isset($dbadmin['cancel'])) { + return; + } elseif (!empty($dbadmin_user)) { + if ($this->_try_dbadmin_user($dbadmin['user'], $dbadmin['passwd'])) + return; + } + } elseif (DBADMIN_USER) { + if ($this->_try_dbadmin_user(DBADMIN_USER, DBADMIN_PASSWD)) + return true; + } + // Check if the privileges are enough. Need CREATE and ALTER perms. + // And on windows: SELECT FROM mysql, possibly: UPDATE mysql. + $form = HTML::form(array("method" => "post", + "action" => $this->request->getPostURL(), + "accept-charset" => $GLOBALS['charset']), + HTML::p(_("Upgrade requir... [truncated message content] |
From: <var...@us...> - 2012-10-05 13:50:24
|
Revision: 8394 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8394&view=rev Author: vargenau Date: 2012-10-05 13:50:15 +0000 (Fri, 05 Oct 2012) Log Message: ----------- Be consistent in return Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-10-05 13:26:27 UTC (rev 8393) +++ trunk/lib/upgrade.php 2012-10-05 13:50:15 UTC (rev 8394) @@ -770,8 +770,9 @@ return; } } elseif (DBADMIN_USER) { - if ($this->_try_dbadmin_user(DBADMIN_USER, DBADMIN_PASSWD)) - return true; + if ($this->_try_dbadmin_user(DBADMIN_USER, DBADMIN_PASSWD)) { + return; + } } // Check if the privileges are enough. Need CREATE and ALTER perms. // And on windows: SELECT FROM mysql, possibly: UPDATE mysql. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-10-05 13:54:00
|
Revision: 8395 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8395&view=rev Author: vargenau Date: 2012-10-05 13:53:50 +0000 (Fri, 05 Oct 2012) Log Message: ----------- Be consistent in return Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-10-05 13:50:15 UTC (rev 8394) +++ trunk/lib/upgrade.php 2012-10-05 13:53:50 UTC (rev 8395) @@ -821,7 +821,7 @@ function _upgrade_cached_html($verbose = true) { global $DBParams; - if (!$this->isSQL) return; + if (!$this->isSQL) return 0; $count = 0; if ($this->phpwiki_version >= 1030.10) { if ($verbose) @@ -861,7 +861,7 @@ function _convert_cached_html() { global $DBParams; - if (!$this->isSQL) return; + if (!$this->isSQL) return 0; //if (!in_array(DATABASE_TYPE, array('SQL','ADODB'))) return; $pages = $this->dbi->getAllPages(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-10-05 14:17:09
|
Revision: 8396 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8396&view=rev Author: vargenau Date: 2012-10-05 14:17:00 +0000 (Fri, 05 Oct 2012) Log Message: ----------- Use CSS Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-10-05 13:53:50 UTC (rev 8395) +++ trunk/lib/upgrade.php 2012-10-05 14:17:00 UTC (rev 8396) @@ -197,11 +197,11 @@ { echo sprintf(_("rename %s to %s"), $oldname, $pagename), " ..."; if ($this->dbi->isWikiPage($oldname) and !$this->dbi->isWikiPage($pagename)) { - if ($this->dbi->_backend->rename_page($oldname, $pagename)) + if ($this->dbi->_backend->rename_page($oldname, $pagename)) { echo _("OK"), " <br />\n"; - else - echo " <b><font color=\"red\">", _("FAILED"), "</font></b>", - " <br />\n"; + } else { + echo ' <span style="color: red; font-weight: bold;">' . _("FAILED") . "</span><br />\n"; + } } else { echo _(" Skipped"), " <br />\n"; } @@ -543,8 +543,8 @@ $this->dbi->genericSqlQuery("FLUSH PRIVILEGES"); echo "mysql.user user='$username'", _("fixed"), "<br />\n"; } elseif (!$row) { - echo " <b><font color=\"red\">", _("FAILED"), "</font></b>: ", - "Neither mysql.db nor mysql.user has a user='$username'" + echo ' <span style="color: red; font-weight: bold;">' . _("FAILED") . "</span>" + . " Neither mysql.db nor mysql.user has a user='$username'" . " or the lock_tables_priv field", "<br />\n"; } else { @@ -581,7 +581,7 @@ . " id INT NOT NULL AUTO_INCREMENT"); $fields = mysql_list_fields($database, $page_tbl); if (!strstr(strtolower(mysql_field_flags($fields, $i)), "auto_increment")) - echo " <b><font color=\"red\">", _("FAILED"), "</font></b><br />\n"; + echo ' <span style="color: red; font-weight: bold;">' . _("FAILED") . "</span><br />\n"; else echo _("OK"), "<br />\n"; } else { @@ -1133,7 +1133,7 @@ function fail() { - echo " <b><font color=\"red\">", _("FAILED"), "</font></b>"; + echo '<span style="color: red; font-weight: bold; ">' . _("FAILED") . "</span>"; if (isset($this->reason)) echo _(": "), $this->reason; echo "<br />\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-27 13:51:30
|
Revision: 8555 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8555&view=rev Author: vargenau Date: 2012-11-27 13:51:21 +0000 (Tue, 27 Nov 2012) Log Message: ----------- No leading space in translation Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-11-27 10:53:42 UTC (rev 8554) +++ trunk/lib/upgrade.php 2012-11-27 13:51:21 UTC (rev 8555) @@ -73,8 +73,7 @@ or ($pagename == _("HomePage")) or ($pagename == "HomePage") ) { - echo "$path/$pagename: ", _("always skip the HomePage."), - _(" Skipped"), ".<br />\n"; + echo "$path/$pagename: " . _("always skip the HomePage.") . " " . _("Skipped."), "<br />\n"; return; } @@ -104,12 +103,10 @@ LoadAny($this->request, $path . "/" . $filename); echo "<br />\n"; } else { - echo "$path/$pagename: ", _("older than the existing page."), - _(" Skipped"), ".<br />\n"; + echo "$path/$pagename: " . _("older than the existing page.") . " " . _("Skipped."), "<br />\n"; } } else { - echo "$path/$pagename: ", _("unknown format."), - _(" Skipped"), ".<br />\n"; + echo "$path/$pagename: " . _("unknown format.") . " " . _("Skipped.") . "<br />\n"; } } else { echo sprintf(_("%s does not exist"), $pagename), "<br />\n"; @@ -120,8 +117,7 @@ function CheckActionPageUpdate() { - echo "<h2>", sprintf(_("Check for necessary %s updates"), - _("ActionPage")), "</h2>\n"; + echo "<h2>", sprintf(_("Check for necessary %s updates"), _("ActionPage")), "</h2>\n"; // 1.3.13 before we pull in all missing pages, we rename existing ones $this->_rename_page_helper(_("_AuthInfo"), _("DebugAuthInfo")); // this is in some templates. so we keep the old name @@ -203,7 +199,7 @@ echo ' <span style="color: red; font-weight: bold;">' . _("FAILED") . "</span><br />\n"; } } else { - echo _(" Skipped"), " <br />\n"; + echo " " . _("Skipped.") . "<br />\n"; } } @@ -1144,7 +1140,7 @@ function skip() { // not applicable if (isset($this->silent_skip)) return true; - echo _(" Skipped"), ".<br />\n"; + echo " " . _("Skipped.") . "<br />\n"; flush(); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-12 10:38:57
|
Revision: 8657 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8657&view=rev Author: vargenau Date: 2012-12-12 10:38:49 +0000 (Wed, 12 Dec 2012) Log Message: ----------- Initialize variable Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-12-11 17:46:32 UTC (rev 8656) +++ trunk/lib/upgrade.php 2012-12-12 10:38:49 UTC (rev 8657) @@ -885,6 +885,7 @@ if ($this->phpwiki_version >= 1030.12200610 and $this->isSQL) { echo _("Check for relation field in link table"), " ..."; $database = $this->dbi->_backend->database(); + $prefix = isset($DBParams['prefix']) ? $DBParams['prefix'] : ''; $link_tbl = $prefix . 'link'; $fields = $this->dbi->_backend->listOfFields($database, $link_tbl); if (!$fields) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-12 14:31:13
|
Revision: 8659 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8659&view=rev Author: vargenau Date: 2012-12-12 14:31:02 +0000 (Wed, 12 Dec 2012) Log Message: ----------- Translate ": " Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2012-12-12 14:28:54 UTC (rev 8658) +++ trunk/lib/upgrade.php 2012-12-12 14:31:02 UTC (rev 8659) @@ -95,15 +95,16 @@ if (!$new_mtime) $new_mtime = $stat[9]; if ($new_mtime > $page_mtime) { - echo "$path/$pagename: ", _("newer than the existing page."), - _(" replace "), "($new_mtime > $page_mtime)", "<br />\n"; + echo "$path/$pagename" . _(": ") . _("newer than the existing page.") + . " " . _("Replace") . " " . "($new_mtime > $page_mtime)" . "<br />\n"; LoadAny($this->request, $path . "/" . $filename); echo "<br />\n"; } else { - echo "$path/$pagename: " . _("older than the existing page.") . " " . _("Skipped."), "<br />\n"; + echo "$path/$pagename" . _(": ") . _("older than the existing page.") + . " " . _("Skipped."), "<br />\n"; } } else { - echo "$path/$pagename: " . _("unknown format.") . " " . _("Skipped.") . "<br />\n"; + echo "$path/$pagename" . _(": ") . _("unknown format.") . " " . _("Skipped.") . "<br />\n"; } } else { echo sprintf(_("%s does not exist"), $pagename), "<br />\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-28 12:17:56
|
Revision: 9014 http://sourceforge.net/p/phpwiki/code/9014 Author: vargenau Date: 2014-07-28 12:17:49 +0000 (Mon, 28 Jul 2014) Log Message: ----------- private function _dbpermission_filter --> public function _dbpermission_filter Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-07-28 12:06:26 UTC (rev 9013) +++ trunk/lib/upgrade.php 2014-07-28 12:17:49 UTC (rev 9014) @@ -702,7 +702,7 @@ * A wrong DBADMIN user will not be able to connect * @see _is_false_error, ErrorManager */ - private function _dbpermission_filter($err) + public function _dbpermission_filter($err) { if ($err->isWarning()) { global $ErrorManager; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-28 15:28:26
|
Revision: 9019 http://sourceforge.net/p/phpwiki/code/9019 Author: vargenau Date: 2014-07-28 15:28:17 +0000 (Mon, 28 Jul 2014) Log Message: ----------- Add some pages renaming in update Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-07-28 14:00:58 UTC (rev 9018) +++ trunk/lib/upgrade.php 2014-07-28 15:28:17 UTC (rev 9019) @@ -118,6 +118,13 @@ echo "<h2>", sprintf(_("Check for necessary %s updates"), _("ActionPage")), "</h2>\n"; // 1.3.13 before we pull in all missing pages, we rename existing ones $this->_rename_page_helper(_("_AuthInfo"), _("DebugAuthInfo")); + $this->_rename_page_helper(_("Help/_AuthInfoPlugin"), _("Help/DebugAuthInfoPlugin")); + $this->_rename_page_helper(_("_GroupInfo"), _("DebugGroupInfo")); + $this->_rename_page_helper(_("Help/_GroupInfoPlugin"), _("Help/DebugGroupInfoPlugin")); + $this->_rename_page_helper(_("_BackendInfo"), _("DebugBackendInfo")); + $this->_rename_page_helper(_("Help/_BackendInfoPlugin"), _("Help/DebugBackendInfoPlugin")); + $this->_rename_page_helper(_("Help/_WikiTranslationPlugin"), _("Help/WikiTranslationPlugin")); + $this->_rename_page_helper(_("Help/Advice Mediawiki users"), _("Help/Advice for Mediawiki users")); // this is in some templates. so we keep the old name //$this->_rename_page_helper($this->dbi, _("DebugInfo"), _("DebugBackendInfo")); $this->_rename_page_helper(_("_GroupInfo"), _("GroupAuthInfo")); //never officially existed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-29 08:40:42
|
Revision: 9023 http://sourceforge.net/p/phpwiki/code/9023 Author: vargenau Date: 2014-07-29 08:40:35 +0000 (Tue, 29 Jul 2014) Log Message: ----------- No need to translate this Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-07-29 08:40:10 UTC (rev 9022) +++ trunk/lib/upgrade.php 2014-07-29 08:40:35 UTC (rev 9023) @@ -117,17 +117,17 @@ { echo "<h2>", sprintf(_("Check for necessary %s updates"), _("ActionPage")), "</h2>\n"; // 1.3.13 before we pull in all missing pages, we rename existing ones - $this->_rename_page_helper(_("_AuthInfo"), _("DebugAuthInfo")); - $this->_rename_page_helper(_("Help/_AuthInfoPlugin"), _("Help/DebugAuthInfoPlugin")); - $this->_rename_page_helper(_("_GroupInfo"), _("DebugGroupInfo")); - $this->_rename_page_helper(_("Help/_GroupInfoPlugin"), _("Help/DebugGroupInfoPlugin")); - $this->_rename_page_helper(_("_BackendInfo"), _("DebugBackendInfo")); - $this->_rename_page_helper(_("Help/_BackendInfoPlugin"), _("Help/DebugBackendInfoPlugin")); - $this->_rename_page_helper(_("Help/_WikiTranslationPlugin"), _("Help/WikiTranslationPlugin")); - $this->_rename_page_helper(_("Help/Advice Mediawiki users"), _("Help/Advice for Mediawiki users")); + $this->_rename_page_helper("_AuthInfo", "DebugAuthInfo"); + $this->_rename_page_helper("Help/_AuthInfoPlugin", "Help/DebugAuthInfoPlugin"); + $this->_rename_page_helper("_GroupInfo", "DebugGroupInfo"); + $this->_rename_page_helper("Help/_GroupInfoPlugin", "Help/DebugGroupInfoPlugin"); + $this->_rename_page_helper("_BackendInfo", "DebugBackendInfo"); + $this->_rename_page_helper("Help/_BackendInfoPlugin", "Help/DebugBackendInfoPlugin"); + $this->_rename_page_helper("Help/_WikiTranslationPlugin", "Help/WikiTranslationPlugin"); + $this->_rename_page_helper("Help/Advice Mediawiki users", "Help/Advice for Mediawiki users"); // this is in some templates. so we keep the old name //$this->_rename_page_helper($this->dbi, _("DebugInfo"), _("DebugBackendInfo")); - $this->_rename_page_helper(_("_GroupInfo"), _("GroupAuthInfo")); //never officially existed + $this->_rename_page_helper("_GroupInfo", "GroupAuthInfo"); //never officially existed $this->_rename_page_helper("InterWikiKarte", "InterWikiListe"); // german only $path = FindFile('pgsrc'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-05 14:55:34
|
Revision: 9426 http://sourceforge.net/p/phpwiki/code/9426 Author: vargenau Date: 2014-12-05 14:55:30 +0000 (Fri, 05 Dec 2014) Log Message: ----------- ActionPage --> Action Pages Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-12-05 14:54:07 UTC (rev 9425) +++ trunk/lib/upgrade.php 2014-12-05 14:55:30 UTC (rev 9426) @@ -115,7 +115,7 @@ function CheckActionPageUpdate() { - echo "<h2>", sprintf(_("Check for necessary %s updates"), _("ActionPage")), "</h2>\n"; + echo "<h2>", sprintf(_("Check for necessary %s updates"), _("Action Pages")), "</h2>\n"; // 1.3.13 before we pull in all missing pages, we rename existing ones $this->_rename_page_helper("_AuthInfo", "DebugAuthInfo"); $this->_rename_page_helper("Help/_AuthInfoPlugin", "Help/DebugAuthInfoPlugin"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-08 09:38:03
|
Revision: 9428 http://sourceforge.net/p/phpwiki/code/9428 Author: vargenau Date: 2014-12-08 09:37:54 +0000 (Mon, 08 Dec 2014) Log Message: ----------- Add class variables Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-12-05 15:00:35 UTC (rev 9427) +++ trunk/lib/upgrade.php 2014-12-08 09:37:54 UTC (rev 9428) @@ -51,8 +51,12 @@ class Upgrade { + public $current_db_version; + public $error_caught; + public $_configUpdates; + public $check_args; - function Upgrade(&$request) + function __construct(&$request) { $this->request =& $request; $this->dbi =& $request->_dbi; // no reference for dbadmin ? @@ -226,7 +230,6 @@ global $DBParams; if (!$this->isSQL) return; echo _("MISSING"), " ... \n"; - $backend = &$this->dbi->_backend->_dbh; /* $schema = findFile("schemas/${backend_type}.sql"); if (!$schema) { @@ -389,7 +392,7 @@ */ function CheckDatabaseUpdate() { - global $DBAuthParams, $DBParams; + global $DBParams; echo "<h2>", sprintf(_("Check for necessary %s updates"), _("database")), @@ -722,7 +725,7 @@ function _try_dbadmin_user($user, $passwd) { - global $DBParams, $DBAuthParams; + global $DBParams; $AdminParams = $DBParams; if (DATABASE_TYPE == 'SQL') $dsn = DB::parseDSN($AdminParams['dsn']); @@ -818,7 +821,6 @@ */ function _upgrade_cached_html($verbose = true) { - global $DBParams; if (!$this->isSQL) return 0; $count = 0; if ($this->phpwiki_version >= 1030.10) { @@ -858,7 +860,6 @@ */ function _convert_cached_html() { - global $DBParams; if (!$this->isSQL) return 0; //if (!in_array(DATABASE_TYPE, array('SQL','ADODB'))) return; @@ -885,7 +886,7 @@ /** * upgrade to 1.3.13 link structure. */ - function _upgrade_relation_links($verbose = true) + function _upgrade_relation_links() { if ($this->phpwiki_version >= 1030.12200610 and $this->isSQL) { echo _("Check for relation field in link table"), " ..."; @@ -945,7 +946,7 @@ if (empty($this->_configUpdates)) return; foreach ($this->_configUpdates as $update) { - $pages = $this->dbi->fullSearch($this->check_args[0]); + $allpages = $this->dbi->fullSearch($this->check_args[0]); while ($page = $allpages->next()) { $current = $page->getCurrentRevision(); $pagetext = $current->getPackedContent(); @@ -1055,13 +1056,20 @@ class UpgradeEntry { + public $applicable_cb; + public $header; + public $fixed_with; + public $method_cb; + public $check_cb; + public $reason; + /** * Add an upgrade item to be checked. * * @param object $parent The parent Upgrade class to inherit the version properties * @param array $params */ - function UpgradeEntry(&$parent, $params) + function __construct(&$parent, $params) { $this->parent =& $parent; // get the properties db_version foreach (array('key' => 'required', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-08 10:50:53
|
Revision: 9429 http://sourceforge.net/p/phpwiki/code/9429 Author: vargenau Date: 2014-12-08 10:50:45 +0000 (Mon, 08 Dec 2014) Log Message: ----------- Allow upgrading pages with non-English locale Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-12-08 09:37:54 UTC (rev 9428) +++ trunk/lib/upgrade.php 2014-12-08 10:50:45 UTC (rev 9429) @@ -143,7 +143,7 @@ if (substr($filename, -5, 5) == '.orig') continue; $pagename = urldecode($filename); if (isActionPage($pagename)) { - $translation = gettext($pagename); + $translation = __($pagename); if ($translation == $pagename) $this->doPgsrcUpdate($pagename, $path, $filename); elseif (FindLocalizedFile('pgsrc/' . urlencode($translation), 1)) @@ -180,7 +180,12 @@ if ($this->db_version < 1030.12200612) { echo "<h4>", _("rename to Help: pages"), "</h4>\n"; } - $path = FindLocalizedFile(WIKI_PGSRC); + $translation = __("HomePage"); + if ($translation == "HomePage") { + $path = FindFile(WIKI_PGSRC); + } else { + $path = FindLocalizedFile(WIKI_PGSRC); + } $pgsrc = new fileSet($path); // fixme: verification, ... foreach ($pgsrc->getFiles() as $filename) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-08 14:19:29
|
Revision: 9430 http://sourceforge.net/p/phpwiki/code/9430 Author: vargenau Date: 2014-12-08 14:19:26 +0000 (Mon, 08 Dec 2014) Log Message: ----------- Add public/private; remove unused code Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-12-08 10:50:45 UTC (rev 9429) +++ trunk/lib/upgrade.php 2014-12-08 14:19:26 UTC (rev 9430) @@ -67,7 +67,7 @@ $this->isSQL = $this->dbi->_backend->isSQL(); } - function doPgsrcUpdate($pagename, $path, $filename) + private function doPgsrcUpdate($pagename, $path, $filename) { // don't ever update the HomePage if ((defined(HOME_PAGE) and ($pagename == HOME_PAGE)) @@ -117,7 +117,7 @@ } } - function CheckActionPageUpdate() + public function CheckActionPageUpdate() { echo "<h2>", sprintf(_("Check for necessary %s updates"), _("Action Pages")), "</h2>\n"; // 1.3.13 before we pull in all missing pages, we rename existing ones @@ -154,7 +154,7 @@ } // see loadsave.php for saving new pages. - function CheckPgsrcUpdate() + public function CheckPgsrcUpdate() { // Check some theme specific pgsrc files (blog, wikilens, fusionforge, custom). // We check theme specific pgsrc first in case the page is present in both @@ -203,7 +203,7 @@ } } - function _rename_page_helper($oldname, $pagename) + 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)) { @@ -217,7 +217,7 @@ } } - function _rename_to_help_page($pagename) + private function _rename_to_help_page($pagename) { $newprefix = _("Help") . "/"; if (substr($pagename, 0, strlen($newprefix)) != $newprefix) return; @@ -230,7 +230,7 @@ * and create it. * Supported: mysql and generic SQL, for ADODB and PearDB. */ - function installTable($table, $backend_type) + private function installTable($table, $backend_type) { global $DBParams; if (!$this->isSQL) return; @@ -395,7 +395,7 @@ * jeffs-hacks database api (around 1.3.2) later: * people should export/import their pages if using that old versions. */ - function CheckDatabaseUpdate() + public function CheckDatabaseUpdate() { global $DBParams; @@ -728,7 +728,7 @@ return false; } - function _try_dbadmin_user($user, $passwd) + private function _try_dbadmin_user($user, $passwd) { global $DBParams; $AdminParams = $DBParams; @@ -757,7 +757,7 @@ return false; } - function _db_init() + private function _db_init() { if (!$this->isSQL) return; @@ -822,9 +822,9 @@ * not into the huge serialized string. * * It is only rarelely needed: for current page only, if-not-modified, - * but was extracetd for every simple page iteration. + * but was extracted for every simple page iteration. */ - function _upgrade_cached_html($verbose = true) + private function _upgrade_cached_html($verbose = true) { if (!$this->isSQL) return 0; $count = 0; @@ -848,7 +848,7 @@ $this->dbi->genericSqlQuery("ALTER TABLE $page_tbl ADD cached_html BLOB"); if ($verbose) echo "<b>", _("CONVERTING"), "</b>", " ... "; - $count = _convert_cached_html(); + $count = $this->_convert_cached_html(); if ($verbose) echo $count, " ", _("OK"), "<br />\n"; } else { @@ -863,7 +863,7 @@ * move _cached_html for all pages from pagedata into a new separate blob. * decoupled from action=upgrade, so that it can be used by a WikiAdminUtils button also. */ - function _convert_cached_html() + private function _convert_cached_html() { if (!$this->isSQL) return 0; //if (!in_array(DATABASE_TYPE, array('SQL','ADODB'))) return; @@ -891,7 +891,7 @@ /** * upgrade to 1.3.13 link structure. */ - function _upgrade_relation_links() + private function _upgrade_relation_links() { if ($this->phpwiki_version >= 1030.12200610 and $this->isSQL) { echo _("Check for relation field in link table"), " ..."; @@ -926,49 +926,11 @@ } } - function CheckPluginUpdate() - { - echo "<h2>", sprintf(_("Check for necessary %s updates"), - _("plugin argument")), "</h2>\n"; - - $this->_configUpdates = array(); - $this->_configUpdates[] = new UpgradePluginEntry - ($this, array('key' => 'plugin_randompage_numpages', - 'fixed_with' => 1012.0, - //'header' => _("change RandomPage pages => numpages"), - //'notice' =>_("found RandomPage plugin"), - 'check_args' => array("plugin RandomPage pages", - "/(<\?\s*plugin\s+ RandomPage\s+)pages/", - "\\1numpages"))); - $this->_configUpdates[] = new UpgradePluginEntry - ($this, array('key' => 'plugin_createtoc_position', - 'fixed_with' => 1013.0, - //'header' => _("change CreateToc align => position"), - //'notice' =>_("found CreateToc plugin"), - 'check_args' => array("plugin CreateToc align", - "/(<\?\s*plugin\s+ CreateToc[^\?]+)align/", - "\\1position"))); - - if (empty($this->_configUpdates)) return; - foreach ($this->_configUpdates as $update) { - $allpages = $this->dbi->fullSearch($this->check_args[0]); - while ($page = $allpages->next()) { - $current = $page->getCurrentRevision(); - $pagetext = $current->getPackedContent(); - $update->check($this->check_args[1], $this->check_args[2], $pagetext, $page, $current); - } - } - free($allpages); - unset($pagetext); - unset($current); - unset($page); - } - /** * preg_replace over local file. * Only line-orientated matches possible. */ - function fixLocalFile($match, $replace, $filename) + public function fixLocalFile($match, $replace, $filename) { $o_filename = $filename; if (!file_exists($filename)) @@ -1016,7 +978,7 @@ } } - function CheckConfigUpdate() + public function CheckConfigUpdate() { echo "<h2>", sprintf(_("Check for necessary %s updates"), "config.ini"), "</h2>\n"; @@ -1105,12 +1067,12 @@ } /* needed ? */ - function setApplicableCb($object) + public function setApplicableCb($object) { $this->applicable_cb =& $object; } - function _check_if_already_fixed() + private function _check_if_already_fixed() { // not yet fixed? if (!isset($this->upgrade['name'])) return false; @@ -1122,7 +1084,7 @@ return false; } - function pass() + public function pass() { // store in db no to fix again $this->upgrade['name'] = $this->parent->phpwiki_version; @@ -1135,7 +1097,7 @@ return true; } - function fail() + public function fail() { echo '<span style="color: red; font-weight: bold; ">' . _("FAILED") . "</span>"; if (isset($this->reason)) @@ -1145,7 +1107,7 @@ return false; } - function skip() + private function skip() { // not applicable if (isset($this->silent_skip)) return true; echo " " . _("Skipped.") . "<br />\n"; @@ -1153,7 +1115,7 @@ return true; } - function check($args = null) + public function check($args = null) { if ($this->header) echo $this->header, ' ... '; if ($when = $this->_check_if_already_fixed()) { @@ -1187,18 +1149,18 @@ class UpgradeConfigEntry extends UpgradeEntry { - function _applicable_defined() + public function _applicable_defined() { return (boolean)defined($this->applicable_args[0]); } - function _applicable_defined_and_empty() + public function _applicable_defined_and_empty() { $const = $this->applicable_args[0]; return (boolean)(defined($const) and !constant($const)); } - function default_method($args) + public function default_method($args) { $match = $args[0]; $replace = $args[1]; @@ -1206,87 +1168,6 @@ } } // class UpdateConfigEntry -/* This is different */ -class UpgradePluginEntry extends UpgradeEntry -{ - - /** - * check all pages for a plugin match - */ - public $silent_skip = 1; - - function default_method(&$args) - { - $match = $args[0]; - $replace = $args[1]; - $pagetext =& $args[2]; - $page =& $args[3]; - $current =& $args[4]; - if (preg_match($match, $pagetext)) { - echo $page->getName(), " ", $this->notice, " ... "; - if ($newtext = preg_replace($match, $replace, $pagetext)) { - $meta = $current->_data; - $meta['summary'] = "upgrade: " . $this->header; - $page->save($newtext, $current->getVersion() + 1, $meta); - $this->pass(); - } else { - $this->fail(); - } - } - } -} // class UpdatePluginEntry - -/** - * fix custom themes which are not in our distribution - * this should be optional - */ -class UpgradeThemeEntry extends UpgradeEntry -{ - - function default_method(&$args) - { - $match = $args[0]; - $replace = $args[1]; - $template = $args[2]; - } - - function fixThemeTemplate($match, $new, $template) - { - // for all custom themes - $ourthemes = explode(":", "blog:Crao:default:Hawaiian:MacOSX:MonoBook:Portland:shamino_com:SpaceWiki:wikilens:Wordpress"); - $themedir = NormalizeLocalFileName("themes"); - $dh = opendir($themedir); - while ($r = readdir($dh)) { - if (filetype($r) == 'dir' and $r[0] != '.' and !is_array($r, $ourthemes)) - $customthemes[] = $r; - } - $success = true; - $errors = ''; - foreach ($customthemes as $customtheme) { - $template = FindFile("themes/$customtheme/templates/$template"); - $do = $this->parent->fixLocalFile($match, $new, template); - if (!$do[0]) { - $success = false; - $errors .= $do[1] . " "; - echo $do[1]; - } - } - return array($success, $errors); - } -} - -/** - * TODO: - * - * Upgrade: Base class for multipage worksteps - * identify, validate, display options, next step - */ -/* -*/ - -// TODO: At which step are we? -// validate and do it again or go on with next step. - /** entry function from lib/main.php */ function DoUpgrade(&$request) @@ -1303,8 +1184,6 @@ @ini_set("implicit_flush", true); StartLoadDump($request, _("Upgrading this PhpWiki")); $upgrade = new Upgrade($request); - //if (!$request->getArg('noindex')) - // CheckOldIndexUpdate($request); // index.php => config.ini to upgrade from < 1.3.10 if (!$request->getArg('nodb')) { $upgrade->CheckDatabaseUpdate($request); // first check cached_html and friends } @@ -1312,15 +1191,9 @@ $upgrade->CheckPgsrcUpdate($request); $upgrade->CheckActionPageUpdate($request); } - // if (!$request->getArg('noplugin')) { - // $upgrade->CheckPluginUpdate($request); - // } if (!$request->getArg('noconfig')) { $upgrade->CheckConfigUpdate($request); } - // This is optional and should be linked. In EndLoadDump or PhpWikiAdministration? - //if ($request->getArg('theme')) - // $upgrade->CheckThemeUpdate($request); EndLoadDump($request); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-08 14:32:05
|
Revision: 9431 http://sourceforge.net/p/phpwiki/code/9431 Author: vargenau Date: 2014-12-08 14:31:53 +0000 (Mon, 08 Dec 2014) Log Message: ----------- Indent Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-12-08 14:19:26 UTC (rev 9430) +++ trunk/lib/upgrade.php 2014-12-08 14:31:53 UTC (rev 9431) @@ -220,7 +220,8 @@ private function _rename_to_help_page($pagename) { $newprefix = _("Help") . "/"; - if (substr($pagename, 0, strlen($newprefix)) != $newprefix) return; + if (substr($pagename, 0, strlen($newprefix)) != $newprefix) + return; $oldname = substr($pagename, strlen($newprefix)); $this->_rename_page_helper($oldname, $pagename); } @@ -233,7 +234,8 @@ private function installTable($table, $backend_type) { global $DBParams; - if (!$this->isSQL) return; + if (!$this->isSQL) + return; echo _("MISSING"), " ... \n"; /* $schema = findFile("schemas/${backend_type}.sql"); @@ -707,8 +709,6 @@ echo _("OK"), "<br />\n"; flush(); } - - return; } /** @@ -749,7 +749,8 @@ $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_dbpermission_filter')); $this->error_caught = 0; $this->dbi = WikiDB::open($AdminParams); - if (!$this->error_caught) return true; + if (!$this->error_caught) + return true; // FAILED: redo our connection with the wikiuser $this->dbi = WikiDB::open($DBParams); $ErrorManager->flushPostponedErrors(); @@ -759,7 +760,8 @@ private function _db_init() { - if (!$this->isSQL) return; + if (!$this->isSQL) + return; /* SQLite never needs admin params */ $backend_type = $this->dbi->_backend->backendType(); @@ -826,7 +828,8 @@ */ private function _upgrade_cached_html($verbose = true) { - if (!$this->isSQL) return 0; + if (!$this->isSQL) + return 0; $count = 0; if ($this->phpwiki_version >= 1030.10) { if ($verbose) @@ -865,8 +868,8 @@ */ private function _convert_cached_html() { - if (!$this->isSQL) return 0; - //if (!in_array(DATABASE_TYPE, array('SQL','ADODB'))) return; + if (!$this->isSQL) + return 0; $pages = $this->dbi->getAllPages(); $cache =& $this->dbi->_cache; @@ -1013,7 +1016,8 @@ $this->_configUpdates[] = $entry; // TODO: find extra file updates - if (empty($this->_configUpdates)) return; + if (empty($this->_configUpdates)) + return; foreach ($this->_configUpdates as $update) { $update->check(); } @@ -1075,11 +1079,14 @@ private function _check_if_already_fixed() { // not yet fixed? - if (!isset($this->upgrade['name'])) return false; + if (!isset($this->upgrade['name'])) + return false; // override with force? - if ($this->parent->request->getArg('force')) return false; + 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']; + if ($this->upgrade['name'] >= $this->fixed_with) + return $this->upgrade['name']; // already fixed but with an older version. do it again. return false; } @@ -1109,7 +1116,8 @@ private function skip() { // not applicable - if (isset($this->silent_skip)) return true; + if (isset($this->silent_skip)) + return true; echo " " . _("Skipped.") . "<br />\n"; flush(); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-08 17:29:40
|
Revision: 9436 http://sourceforge.net/p/phpwiki/code/9436 Author: vargenau Date: 2014-12-08 17:29:32 +0000 (Mon, 08 Dec 2014) Log Message: ----------- Do not update page if already present in theme pgsrc Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2014-12-08 17:28:47 UTC (rev 9435) +++ trunk/lib/upgrade.php 2014-12-08 17:29:32 UTC (rev 9436) @@ -163,6 +163,7 @@ $path = $WikiTheme->file("pgsrc"); // TBD: the call to fileSet prints a warning: // Notice: Unable to open directory 'themes/MonoBook/pgsrc' for reading + $themepgsrc = array(); $pgsrc = new fileSet($path); if ($pgsrc->getFiles()) { echo "<h2>", sprintf(_("Check for necessary theme %s updates"), @@ -171,6 +172,7 @@ if (substr($filename, -1, 1) == '~') continue; if (substr($filename, -5, 5) == '.orig') continue; $pagename = urldecode($filename); + $themepgsrc[] = $pagename; $this->doPgsrcUpdate($pagename, $path, $filename); } } @@ -198,7 +200,11 @@ if ($this->db_version < 1030.12200612) { $this->_rename_to_help_page($pagename); } - $this->doPgsrcUpdate($pagename, $path, $filename); + if (in_array($pagename, $themepgsrc)) { + echo sprintf(_('%s already checked in theme pgsrc.'), $pagename).' '._('Skipped.').'<br />'; + } else { + $this->doPgsrcUpdate($pagename, $path, $filename); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |