Forums / Cotonti / Bugs / Archive / Fix: DB table name change gives errors

GHengeveld
#1 2009-02-02 18:05
On my local installation I renamed all database tables in config.php from sed_something to cot_something. I also edited the SQL to suit these names before importing it.

Most of the site works fine but I have found at least one case of the code requesting access to a table named sed_forum_structure, which occurred when opening admin.php?m=forums

To fix this, open system/core/admin/admin.forums.inc.php
On line 159, you should find:
$sqla = sed_sql_query("SELECT s.fs_id, s.fs_title, s.fs_category FROM $db_forum_sections AS s LEFT JOIN sed_forum_structure AS n ON n.fn_code=s.fs_category WHERE fs_id<>$id AND fs_masterid<1 AND fs_category='".$fs_category."' ORDER by fn_path ASC, fs_order ASC");
Replace with:
$sqla = sed_sql_query("SELECT s.fs_id, s.fs_title, s.fs_category FROM $db_forum_sections AS s LEFT JOIN $db_forum_structure AS n ON n.fn_code=s.fs_category WHERE fs_id<>$id AND fs_masterid<1 AND fs_category='".$fs_category."' ORDER by fn_path ASC, fs_order ASC");
On line 386 you should find:
$sqla = sed_sql_query("SELECT s.fs_id, s.fs_title, s.fs_category FROM $db_forum_sections AS s LEFT JOIN sed_forum_structure AS n ON n.fn_code=s.fs_category WHERE fs_masterid<1 ORDER by fn_path ASC, fs_order ASC");
Replace with:
$sqla = sed_sql_query("SELECT s.fs_id, s.fs_title, s.fs_category FROM $db_forum_sections AS s LEFT JOIN $db_forum_structure AS n ON n.fn_code=s.fs_category WHERE fs_masterid<1 ORDER by fn_path ASC, fs_order ASC");
Kilandor
#2 2009-02-02 18:09
Thanks, nice catch :) I will fix this in the svn.
GHengeveld
#3 2009-02-02 19:01
Something I did with my local installation is replace every instance of 'sed' with 'cot', including all functions, database table names and comments/copyright. I've tested a bit and it seems to work just fine. Here's what I did:

- Make a backup of your Cotonti files
- In Dreamweaver, setup a 'website' with your cotonti directory as base dir
- Without opening any file, hit CTRL-F to open the search dialog (you may have to select a file in the File dialog, just dont open it)
- Select 'Entire Current Local Site' in the 'Find in' dropdown menu

- Find: sed_
- Replace: cot_
- Options: Match case ON, the rest OFF
- Replace all (will take a while as it modifies all your Cotonti files)

- Find: _sed
- Replace all: _cot

- Find: SED_
- Replace all: COT_

- Find: _SED
- Replace all: _COT

- Find: Seditio
- Replace all: Cotonti

- Find: Copyright Neocrome
- Replace all: Copyright Cotonti Team

- Find: http://www.neocrome.net
- Replace all: http://www.cotonti.com
Kilandor
#4 2009-02-02 19:09
Yes this will be all handled and changed for 0.1.0, but thanks for that interesting info you have tried it with no ill effects :)