logo       

CVS: phpwiki/lib upgrade.php,1.38,1.39: msg#00194

web.wiki.phpwiki.checkins

Subject: CVS: phpwiki/lib upgrade.php,1.38,1.39

Update of /cvsroot/phpwiki/phpwiki/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18663

Modified Files:
upgrade.php
Log Message:
sanify session fields

Index: upgrade.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/upgrade.php,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -2 -b -p -d -r1.38 -r1.39
--- upgrade.php 25 Jan 2005 07:57:02 -0000 1.38
+++ upgrade.php 30 Jan 2005 23:09:17 -0000 1.39
@@ -410,4 +410,27 @@ function CheckDatabaseUpdate(&$request)
}
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 new session.sess_id sanity")," ... ";
+ $result = $dbh->genericSqlQuery("DESCRIBE $session_tbl");
+ if ($DBParams['dbtype'] == 'SQL') {
+ $iter = new WikiDB_backend_PearDB_generic_iter($backend,
$result);
+ } else {
+ $iter = new WikiDB_backend_ADODB_generic_iter($backend,
$result,
+ array("Field", "Type", "Null", "Key",
"Default", "Extra"));
+ }
+ while ($col = $iter->next()) {
+ if ($col["Field"] == 'sess_id' and
!strstr(strtolower($col["Type"]), 'char(32)')) {
+ $dbh->genericSqlQuery("ALTER TABLE $session_tbl CHANGE
sess_id sess_id CHAR(32) NOT NULL");
+ echo "sess_id ", $col["Type"], " ", _("fixed"), " =&gt;
CHAR(32) ";
+ }
+ if ($col["Field"] == 'sess_ip' and
!strstr(strtolower($col["Type"]), 'char(15)')) {
+ $dbh->genericSqlQuery("ALTER TABLE $session_tbl CHANGE
sess_ip sess_ip CHAR(15) NOT NULL");
+ echo "sess_ip ", $col["Type"], " ", _("fixed"), " =&gt;
CHAR(15) ";
+ }
+ }
+ echo "<br />\n";
+ }
}

@@ -811,4 +834,7 @@ function DoUpgrade($request) {
/*
$Log$
+ 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)



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise