1
Bender
Need help on tables: Converting e-xoops 1.05 to Xoops
  • 2005/1/11 21:02

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


I am just about to convert a website from E-Xoops 1.05 to Xoops. Encountering several changed tables i am not sure how far i get but i will try it anyway

(I need the users(only 20) and the forum content(~400 threads). The rest can go down the drain)


Problem 1: User conversion

Table group_users in E-Xoops:
CREATE TABLE `ex_groups_users_link` (
  `
groupidmediumint(8unsigned NOT NULL default '0',
  `
uidmediumint(8unsigned NOT NULL default '0'
TYPE=MyISAM;


Table group_users in Xoops:
CREATE TABLE `xoops_groups_users_link` (
  `
linkidmediumint(8unsigned NOT NULL auto_increment,
  `
groupidsmallint(5unsigned NOT NULL default '0',
  `
uidmediumint(8unsigned NOT NULL default '0',
  
PRIMARY KEY  (`linkid`),
  
KEY `groupid_uid` (`groupid`,`uid`)
TYPE=MyISAM;


What does the value linkid do? It seems to be some sort of counter but it´s not completely linear in the database ...

2
Dave_L
Re: Need help on tables: Converting e-xoops 1.05 to Xoops
  • 2005/1/11 21:52

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I don't think you have to worry about linkid. It's an auto-increment column. When you insert rows in the table, just leave it unspecified or zero, and linkid will get automatically assigned a value. If you're changing that existing table rather than inserting rows in a new table, assign linkid consecutive values starting with 1: 1,2,3,...

3
Bender
Re: Need help on tables: Converting e-xoops 1.05 to Xoops
  • 2005/1/11 22:00

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


Thanks Dave!
Actually due to lack of coding and MySQL skills mostly i am working my way through editing the sql dump. So i will just number them from 1...20.

4
Bender
Re: Need help on tables: Converting e-xoops 1.05 to Xoops
  • 2005/1/12 18:19

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


Problem 2:

Feeling most stupid i already fail at the beginning of my next task. I now need to convert the tables that contain the actual posting. I dumped the table, stripped the MySQL commands and now have a file containing lines like this:

2,0,2,1,1046827677,2,'217.0.240.67','topic string here','post text here',0,1,1,'user','icon25.gif',0


i thought i just read everything into strings so i can later echo the ones i need to the screen and then just copy & paste them into a file.

Example:
$a would become "2",
$b would become "0",
and so on.

Damn thing is my script fails right at the beginning. I just wrote the very first step:

- open file for read
- define $a as empty ''
- read char from file and add it to $a
- repeat the last step until it hits a ,
- then just view the string on the screen

It´s soooo simple but everything it does stall forever and output nothing on screen :( So it must be an awfull simple problem.

$a='';

$fp fopen("test.sql"'r');

while (!
feof($fp)) {

$char fgetc($fp);
  while (
$char != ',')
  {
$tmp $a.$char;
   
$a=$tmp;}

print 
"$a,
"
;
}
?>


Someone in the mood to point out my stupidity to me?

5
ejuden01
Re: Need help on tables: Converting e-xoops 1.05 to Xoops
  • 2005/1/12 18:41

  • ejuden01

  • Not too shy to talk

  • Posts: 121

  • Since: 2004/4/5 1


Give this a try:
    $a='';
    
    
$fp fopen("test.sql"'r');
    
    while (!
feof($fp)) {
        
$char fgetc($fp);
        while (
$char != ',') {
            
$a .= $char;
            
$char fgetc($fp);
        }
        print 
"$a,
"
;
    }
?>


Basically, the inside while loop needs to move to the next character. Otherwise, the condition is never true and a never-ending loop occurs.

6
Bender
Re: Need help on tables: Converting e-xoops 1.05 to Xoops
  • 2005/1/12 21:23

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


Thanks ejuden, that worked.

however i ran in a timeout with the silly amount of 3 lines when doing it that way so i had to find something completely different.

----------------------------------------------------------


Well to sum it up i am really p.... now. I am at the point to use "explode" now but it f.... up the array as the comma "," is not only used to separate the data but also exists within the post_text fielddata. And right at that moment all the data gets splattered throughout the array whenever it contains a comma.

I did not expect to learn php in 60 minutes but messing five hours into this i could have saved me the trouble and hand edit all tables. This whole things sucks so much and i am about to kill whoever changed tables in e-xoops fork. Maybe i kill the guy first who installed e-xoops on that site ...

Life would be so easy if i could tell phpmyadmin to use some other char of my choice instead of the comma for separation.
I could use something uncommon and use that for "explode" function.

Damn it to hell ...


(uuuuhh ... no good post but i just had to vent some pressure)

Login

Who's Online

307 user(s) are online (274 user(s) are browsing Support Forums)


Members: 0


Guests: 307


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits