Problem with Addons not in DB

Support and feedback for UniAdmin

Problem with Addons not in DB

Postby DreadPickle » Thu Jul 13, 2006 3:58 am

Hello,

I upgraded to UniAdmin 0.6.1 when I upgraded to Roster 1.7 (and changed guilds, but that's another story) and that seems to be when the problem started.

I've logged into UA and uploaded 5 addons for our guild. The problem is that none of them showed up on the 'Addons Management' page in UA.

Curious, I checked the web server through my shell access and they were there. Next I checked the database and the addon table was empty!

The settings table contains all the changes I've made through UA so I know that the config file is correct and UA can read/write the database. It seems limited to the Addon Management.

I have not changed any files. I'm using a default install plus the ettings changes I've made so far.

I looked through the source to see if there were debug strings and I tried looking at the php code to see what I could see. No joy.

I haven't tried UU yet because I'm fairly certain that with an empty table it won't get any addons.

Any Ideas? I will gladly create a temp user for Admins trying to help
Last edited by DreadPickle on Fri Jul 14, 2006 10:39 pm, edited 1 time in total.
User avatar
DreadPickle
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 33
Joined: Sat Jul 08, 2006 6:23 am

Problem with Addons not in DB

Postby DreadPickle » Fri Jul 14, 2006 10:37 pm

OK. I figured it out. I am using a non-standard table prefix, so i can have more than one guild site in the same database. The following fixed it for me.

In adons.php in the "function processUploadedAddon()" close to lines 201 & 207 you'll find this:
Code: Select all
$sql = "SELECT * FROM `uniadmin_addons` WHERE `name` LIKE '".addslashes($addonName)."';";

change it BOTH places TO:
Code: Select all
$sql = "SELECT * FROM `".$config['db_tables_addons']."` WHERE `name` LIKE '".addslashes($addonName)."';";


Then close to line 221 you'll find this:
Code: Select all
   if ($homepage != "") {
      $sql = "INSERT INTO `uniadmin_addons` ( `id` , `time_uploaded` , `version` , `enabled` , `name`, `dl_url`, `homepage` )VALUES (
        '', '".time()."', '".addslashes($version)."', '1', '".addslashes($addonName)."', '".addslashes($downloadLocation)."', '".addslashes($homepage)."');";
   }
   else {
      $sql = "INSERT INTO `uniadmin_addons` ( `id` , `time_uploaded` , `version` , `enabled` , `name`, `dl_url` )VALUES (
        '', '".time()."', '".addslashes($version)."', '1', '".addslashes($addonName)."', '".addslashes($downloadLocation)."');";
   }

change it to this:
Code: Select all
   if ($homepage != "") {
      $sql = "INSERT INTO `".$config['db_tables_addons']."` ( `id` , `time_uploaded` , `version` , `enabled` , `name`, `dl_url`, `homepage` )VALUES (
        '', '".time()."', '".addslashes($version)."', '1', '".addslashes($addonName)."', '".addslashes($downloadLocation)."', '".addslashes($homepage)."');";
   }
   else {
      $sql = "INSERT INTO `".$config['db_tables_addons']."` ( `id` , `time_uploaded` , `version` , `enabled` , `name`, `dl_url` )VALUES (
        '', '".time()."', '".addslashes($version)."', '1', '".addslashes($addonName)."', '".addslashes($downloadLocation)."');";
   }


Essentially, if you're comfortable with it, globally replace all instances of
Code: Select all
`uniadmin_addons`
with
Code: Select all
`".$config['db_tables_addons']."`
.
User avatar
DreadPickle
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 33
Joined: Sat Jul 08, 2006 6:23 am

Problem with Addons not in DB

Postby MattM » Sat Aug 05, 2006 11:31 pm

this should go into the cvs guys
MattM
UA/UU Developer
UA/UU Developer
Gimpy Developer
Gimpy Developer
 
Posts: 886
Joined: Tue Jul 04, 2006 9:53 pm
Location: USA

Problem with Addons not in DB

Postby zanix » Tue Aug 08, 2006 6:36 am

I have found a few more places that use a hard coded db table name


addons.php

Line 215
Find
Code: Select all
        $sql "SELECT * FROM `uniadmin_addons` WHERE `name` LIKE '".addslashes($addonName)."';"

Replace with
Code: Select all
        $sql "SELECT * FROM `".$config['db_tables_addons']."` WHERE `name` LIKE '".addslashes($addonName)."';"


Line 221
Find
Code: Select all
        $sql "SELECT * FROM `uniadmin_addons` WHERE `name` LIKE '".addslashes($addonName)."';"

Replace with
Code: Select all
        $sql "SELECT * FROM `".$config['db_tables_addons']."` WHERE `name` LIKE '".addslashes($addonName)."';"


Line 291
Find
Code: Select all
    $sql "INSERT INTO `uniadmin_addons` ( `id` , `time_uploaded` , `version` , `enabled` , `name`, `dl_url`, `homepage`, `toc`, `required` )VALUES (

Replace with
Code: Select all
    $sql "INSERT INTO `".$config['db_tables_addons']."` ( `id` , `time_uploaded` , `version` , `enabled` , `name`, `dl_url`, `homepage`, `toc`, `required` )VALUES (



interface.php

Line 45
Find
Code: Select all
    $sql "SELECT * FROM `uniadmin_svlist`"

Replace with
Code: Select all
    $sql "SELECT * FROM `".$config['db_tables_svlist']."`"



view.php

Line 42
Find
Code: Select all
    $sql "SELECT * FROM `uniadmin_addons` ORDER BY `name`"

Replace with
Code: Select all
    $sql "SELECT * FROM `".$config['db_tables_addons']."` ORDER BY `name`"


Line 47
Find
Code: Select all
        $sql "SELECT * FROM `uniadmin_files` WHERE `addon_name` = '".addslashes($row['name'])."'"

Replace with
Code: Select all
        $sql "SELECT * FROM `".$config['db_tables_files']."` WHERE `addon_name` = '".addslashes($row['name'])."'"



These fixes are now in the SVN as well
Thanks DreadPickle
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US


Return to UniAdmin

Who is online

Users browsing this forum: No registered users and 0 guests

cron