Some one tried to Config Reset [1377] ?

Posts from previous Beta sessions

Some one tried to Config Reset [1377] ?

Postby tuigii » Mon Oct 08, 2007 9:08 am

By using the Admin => Config Reset function ?

It blew me a SQL error in the face.....

I'll make a SQL backup, and I'll detail some more afterwards...
(I'll put up a backup roster - start it up - fill it with some chars... and try arround).

Anyway, nothing wrong with deleting the tables, uploading the install.php - deleting the conf.php - that will do just fine for a reset :wink:

[edit] Even an empty roster - without any addon's installed gives the same error.

Here is "The error":
Code: Select all
Database Error
1062: Duplicate entry '4' for key 1
SQL:
INSERT INTO `XXrostertest_config` VALUES (4, 'version', '', 'display', 'master')
File: lib/dbal/mysql.php
Line: 203
Backtrace (most recent call last):
lib/functions.lib.php
Line: 236
Function Called: backtrace
lib/dbal/mysql.php
Line: 203
Function Called: die_quietly
Arguments:
1062: Duplicate entry '4' for key 1
Database Error
/home.10.14/papyteam/www/roster_test/lib/dbal/mysql.php
203
INSERT INTO `XXrostertest_config` VALUES (4, 'version', '', 'display', 'master')
admin/config_reset.php
Line: 42
Function Called: query
Arguments:
INSERT INTO `XXrostertest_config` VALUES (4, 'version', '', 'display', 'master')
pages/rostercp.php
Line: 96
Function Called: require_once
Arguments:
/home.10.14/papyteam/www/roster_test/admin/config_reset.php
index.php
Line: 67
Function Called: require
Arguments:
/home.10.14/papyteam/www/roster_test/pages/rostercp.php 
Last edited by tuigii on Mon Oct 08, 2007 4:53 pm, edited 2 times in total.
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

Re: Some one tried to Config Reset [1377] ?

Postby tuigii » Tue Oct 09, 2007 1:47 am

Ok - I found it.

Open admin/roster_reset.php - goto line 28
Code: Select all
    $query "TRUNCATE `roster_config`;"

THis just does the trick:
Code: Select all
    $query "TRUNCATE  ".$roster->db->prefix ."_config;"


Now, the main roster config file is being truncated, and only that one.

But, things aren't done yet.
A couple of line later on, the mysql_data.sql file is being read and parsed.
And fed with to SQL, line by line afterwards.
The entire file is being treaded.
But the last two chapters are also being fed to SQL:
Code: Select all
### Menu table entries
....
### Menu Button entries
....
Or, if the INSERT's would work out (they don't :wink: ) the menu settings and menu button settings would be wiped out.
That's no good.

[hacking mode on]
Filtring out
$roster->db->prefix."menu" and $roster->db->prefix."menu_button"
Modfied function function parse_sql(&$roster, $sql, $delim)
Code: Select all
function parse_sql(&$roster$sql$delim)
{
 if ( 
$sql == '' )
 {
  die(
'Could not obtain SQL structure/data');
 }
 
 
$retval     = array();
 
$statements explode($delim$sql);
 unset(
$sql);

 
$linecount count($statements);
 for ( 
$i 0$i $linecount$i++ )
 {
  if ( (
$i != $linecount 1) || (strlen($statements[$i]) > 0) )
  {
   
$statements[$i] = trim($statements[$i]);
   if ((
strpos($statements[$i], $roster->db->prefix."menu")===false// new
    
&& (strpos($statements[$i], $roster->db->prefix."menu_button")===false)) // new
   
// new
    
$statements[$i] = str_replace("\r\n"''$statements[$i]) . "\n";

    
// Remove 2 or more spaces
    
$statements[$i] = preg_replace('#\s{2,}#'' '$statements[$i]);
    
$retval[] = trim($statements[$i]);
   } 
// new
  
}
 }
 unset(
$statements);

 return 
$retval;
}
 


Change also the calling part :
Code: Select all
    $sql parse_sql($roster,$sql';'); 


Anyway, you get the picture.... :wink:

Config Reset works now with this kinds of workarounds.
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

Re: Some one tried to Config Reset [1377] ?

Postby tuigii » Tue Oct 09, 2007 2:14 pm

More cleaner work arround
Uses an array with table(s) to include in the reset process.
Attachments
config_reset.zip
admin/config_reset.php - be carefull with it - it WILL reset your roster settings.
(1.82 KiB) Downloaded 252 times
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

Some one tried to Config Reset [1377] ?

Postby zanix » Wed Nov 21, 2007 2:27 am

Fixed svn[1447]
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: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US


Return to Archived

Who is online

Users browsing this forum: No registered users and 1 guest

cron