Re: MySQL Errors upgrading to PhpWiki 1.3.14

Morgan Aldridge <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.talk
Message-ID <[email protected]>
On Oct 9, 2007, at 12:54 PM, Morgan Aldridge wrote:

> On Oct 9, 2007, at 10:30 AM, Reini Urban wrote:
>
>> Try to add the missing tables manually from schemas/mysql-
>> initialize.sql and
>> continue then with ?action=upgrade.
>>
>> CREATE TABLE session (
>>     	sess_id 	CHAR(32) NOT NULL DEFAULT '',
>>     	sess_data 	BLOB NOT NULL,
>>     	sess_date 	INT UNSIGNED NOT NULL,
>>     	sess_ip 	CHAR(40) NOT NULL,
>>     	PRIMARY KEY (sess_id),
>> 	INDEX (sess_date)
>> );
>> and so on.
>>
>> The error you get is a php problem, $session_tbl is empty and should
>> be "session".
>
> Interestingly enough, I actually already have a table named
> 'wwn_session' which MySQL's 'DESCRIBE TABLE' shows matches the format
> of the above 'CREATE TABLE' command. Looking at the config/config.ini
> file it appears the I do have 'DATABASE_PREFIX = wwn_' set.
>
> I checked config/config-dist.ini and the comments seem to imply that
> DATABASE_PREFIX is still the correct setting to modify. Is there an
> issue with the database prefix not being correctly applied in 1.3.14?

In continuing my investigation, I noticed the following comment on  
line 465 of lib/upgrade.php:

	// 1.3.8 added session.sess_ip

Now, my 'wwn_session' table does (as it matches the format of the  
'CREATE TABLE' SQL query) have a sess_ip column. Does that mean my  
installation (although unversioned) is probably 1.3.8 or later?

Also discovered in lib/upgrade.php is that $session_tbl is  
initialized on line 472 as follows:

	$session_tbl = $prefix . $DBParams['db_session_table'];

But that's the only place it's initialized in the entire file and  
that's inside the condition that one is running PhpWiki 1030.08 or  
later.

In the switch statement starting on line 248, specifically in the  
'session' case starting on line 249, $session_tbl doesn't seem to  
have been initialized before being used on lines 253 & 263 while all  
the other cases initialize their $<table>_tbl variables (e.g.  
$pref_tbl, $member_tbl, etc.) in a similar manner as mentioned  
previously. Here are examples of the $pref_tbl & $member_tbl  
initialization statements:

	$pref_tbl = $prefix.'pref';
	
	$member_tbl = $prefix.'member';

This makes sense since the errors I'm getting include "Notice:  
'Undefined variable: session_tbl'" as well as a 'CREATE TABLE' SQL  
query that contains no table name, as follows:

---

lib/WikiDB/backend/PearDB.php:1059 Error:  
wikidb_backend_peardb_mysql: fatal database error

DB Error: syntax error
(
CREATE TABLE (
sess_id CHAR(32) NOT NULL DEFAULT '',
sess_data BLOB NOT NULL,
sess_date INT UNSIGNED NOT NULL,
sess_ip CHAR(15) NOT NULL,
PRIMARY KEY (sess_id),
INDEX (sess_date)
) [nativecode=1064 ** You have an error in your SQL syntax; check the  
manual that corresponds to your MySQL server version for the right  
syntax to use near '(
sess_id CHAR(32) NOT NULL DEFAULT '',
sess_data BLOB NOT NULL,
' at line 1])
Notice: "Undefined variable: session_tbl"

---

So, should the following be inserted between lines 250 & 251 of lib/ 
upgrade.php?

	$session_tbl = $prefix.'session';

Morgan Aldridge
--
[email protected]
http://www.makkintosshu.com/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.