collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Persistent Whois cache with out-of-bot upgrading  (Read 76684 times)

0 Members and 6 Guests are viewing this topic.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #105 on: October 26, 2006, 01:09:20 pm »
Updated lookup function with optional second parameter $nolookup, as per Wolfbiter's idea.
If you got some lookups that are don't need to check for updated information because they aren't that important do $lookup($name, true), and the cache won't try to get new information of the FC site even if the cached one is out-of-date.

Removed all references to get_tablename, get_setting and define_tablename functions, there is now one global parameter for the name of the whois table. Adapt that to your needs, it's supposed to be global over all bots anyways.
This should make it easier for new user to install the whois-cache, as no modifications to the Bot.php are needed anymore. Only the modules that use lookups have to be modified still.

Links in first post point to current updated files.

Offline buff

  • BeBot User
  • **
  • Posts: 36
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #106 on: November 08, 2006, 09:25:21 am »
after applied the new whoiscache, i get this msg everytime a ppl log on or any tower attacks ;X

[2006-11-08 08:21:31]   [GROUP] [MSG]   [All Towers] 0: Wocci (CLAN, Komodo) attacked Outer Circle (OMNI) at Belial Forest, 521x350.
MySQL error (# 0) on query: UPDATED whois SET firstname = 'Me', lastname = 'Crush', level = '140', gender = 'Neuter', breed = 'Atrox', faction = 'Clan', profess
ion = 'Shade', defender_rank = 'Student', defender_rank_id = '6', org_id = '569345', org_name = 'Komodo', org_rank = 'Applicant', org_rank_id = '4', updated = '1162974092' WHERE nickname = 'Wocci'

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #107 on: November 08, 2006, 10:42:16 am »
If you had an older version of the cache running, did you modifiy the table scheme as mentioned in this post?

Offline buff

  • BeBot User
  • **
  • Posts: 36
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #108 on: November 10, 2006, 07:49:15 am »
Error Code : 1060
Duplicate column name 'ID'
(0 ms taken)

Error Code : 1054
Unknown column 'name' in 'whois'
(0 ms taken)

Error Code : 1060
Duplicate column name 'pictureurl'
(0 ms taken)

(1 row(s) affected)
(0 ms taken)

(1 row(s) affected)
(0 ms taken)


Get this error msgs when I applied the SQL codes :/
If i remove the table and reboot bot to recreate the table, it will work till next time i reboot bot then it will give me the same errors again :(

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #109 on: November 10, 2006, 10:12:27 am »
Sorry, was an error in the code (UPDATED instead of the correct UPDATE).

Just redownload the file in first post, or edit the line manually. All you have to do then is remove the D at the end.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #110 on: November 15, 2006, 11:47:26 pm »
Added updated version of the WhoisCache file in the 0.3 branche. The following updates or fixes were applied:

  • Added optional $nolookup parameter to the function call. If $nolookup == true then no xml lookup will be done, even if the data is outdated or not existing.
  • mysql_escape_string() and stripslashes() added to prevent errors with strange signs in names.
  • Check for empty ids added, those will be set to '0' to prevent errors in some mysql setups.

File is also linked to in first post.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #111 on: November 16, 2006, 05:32:34 pm »
Updated the table structure. Main change is extensive use of enums instead of varchars where only a limited number of choices exist. Main effect is a reduction in the size of the database.

Updated files in first post, the working of the cache hasn't changed in any way.

To convert old tables to the updated structure use the following SQL code:
Code: [Select]
ALTER IGNORE TABLE whois
CHANGE ID ID int(15) NOT NULL default '0',
CHANGE nickname nickname varchar(15) NOT NULL default '',
CHANGE firstname firstname varchar(20) NOT NULL default '',
CHANGE lastname lastname varchar(20) NOT NULL default '',
CHANGE level level tinyint(3) unsigned NOT NULL default '1',
CHANGE gender gender enum('Female','Male','Neuter') NOT NULL default 'Female',
CHANGE breed breed enum('Atrox','Nano','Opifex','Solitus') NOT NULL default 'Atrox',
CHANGE faction faction enum('Clan','N/A','Neutral','Omni') NOT NULL default 'Clan',
CHANGE profession profession enum('Adventurer','Agent','Bureaucrat','Doctor','Enforcer','Engineer','Fixer','Keeper','Martial Artist','Meta-Physicist','Nano-Technician','Shade','Soldier','Trader') NOT NULL default 'Adventurer',
CHANGE defender_rank defender_rank enum('Able','Accomplished','Adept','Amateur','Backer','Beginner','Challenger','Champ','Common','Competent','Defender','Fair','Fledgling','Guardian','Hero','Intermediate','Medalist','Mediocre','Newcomer','None','Patron','Protector','Qualified','Starter','Student','Suited','Supporter','Talented','Trustworthy','Vanquisher','Vindicator') NOT NULL default 'Able',
CHANGE defender_rank_id defender_rank_id enum('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30') NOT NULL default '0',
CHANGE org_id org_id bigint(10) NOT NULL default '0',
CHANGE org_name org_name varchar(50) NOT NULL default '',
CHANGE org_rank org_rank varchar(20) NOT NULL default '',
CHANGE org_rank_id org_rank_id enum('0','1','2','3','4','5','6','7','8','9','10') NOT NULL default '0',
CHANGE pictureurl pictureurl varchar(100) NOT NULL default '',
CHANGE used used bigint(25) NOT NULL default '0',
CHANGE updated updated int(10) NOT NULL default '0'

Change whois to the name of your cache table.

Offline boogyman

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #112 on: November 21, 2006, 03:55:46 am »
forgive me......but I have been looking at this thread for the past couple of days.......and have not been able to get this to work.....is there a step by step install guide???  or can I see/get a list of all the files that need changing to get this to work???  I am currently using 0.2.9 with PHP 5.2.0 install.

thanks

bOogY

Offline neongen

  • BeBot User
  • **
  • Posts: 64
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #113 on: November 21, 2006, 03:58:17 pm »
i'm starting to get an error again.

PHP Notice: Undefined offset: 1 in C:\php\w_update.php on line 22

that line

$tmp = explode("</" . $tag . ">", $tmp[1]);

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #114 on: November 21, 2006, 04:08:19 pm »
i'm starting to get an error again.

PHP Notice: Undefined offset: 1 in C:\php\w_update.php on line 22

that line

$tmp = explode("</" . $tag . ">", $tmp[1]);
It's prolly producing this when trying to parse a missing org or player information.
It whouldn't produce any errors though, just empty return strings as the array used doesn't contain a second element.
The notice is nice if you have to find some out-of-bound array index, but in this case it won't produce any wrong behaviour, empty information is checked after the parsing.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #115 on: November 21, 2006, 04:11:19 pm »
forgive me......but I have been looking at this thread for the past couple of days.......and have not been able to get this to work.....is there a step by step install guide???  or can I see/get a list of all the files that need changing to get this to work???  I am currently using 0.2.9 with PHP 5.2.0 install.
Basically you have to edit every module that uses get_site to read character information of FC.
Code: [Select]
$this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $dimension . "/name/" . $user . "/bio.xml");That's every line similar to the one above.

Out of my head modules that need to be edited are:
  • whois
  • tower-alert
  • teams
  • online
  • logon

I could have missed a couple still.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #116 on: November 25, 2006, 02:41:42 pm »
SVN contains a newer version of this module for the 0.3 branch, which Glarawyn has extended to offer an additional fallback to AUNO if FC doesn't offer valid information. Everyone testing the 0.3 branch should grab that module!

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #117 on: December 14, 2006, 07:56:15 am »
As posted here I am using a cache for all whois entries.

Link not working. ^^

Edit: no, wait, I think I figured it out. Nvm.
Luuv  Bot-Keeper of Vengeance ^^*

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #118 on: December 14, 2006, 08:15:41 am »
Link corrected anyways :)

Offline ilon

  • BeBot User
  • **
  • Posts: 22
  • Karma: +0/-0
Re: Persistent Whois cache with out-of-bot upgrading
« Reply #119 on: December 27, 2006, 02:34:09 pm »
Ok, trying to get this to work on my bot, but when i try to fetch the db (when running php4 whois-update.php) i get the error:
"Query failed : Table 'aodb.whois' doesn't exist"

my database is called aodb, but it dosnt seems like the script adds any tables to it when i run it... anyone got any idea of what might be wrong?

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 200
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal