L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 12:52:39 AM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Support > Support for older versions > BeBot 0.3 support > Topic: Core Modules Depending on Other Core modules
Pages: [1]   Go Down
« previous next »
Print
Author Topic: Core Modules Depending on Other Core modules  (Read 475 times)
0 Members and 1 Guest are viewing this topic.
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Core Modules Depending on Other Core modules
« on: June 13, 2007, 10:51:30 AM »

I've run into this a few times now, so perhaps we should do a check on core module interdependency. If a core module depends on another core module, we need to make sure that dependencies are satisfied before loading other modules. We are using require_once, so we don't have to worry about calling require_once("../core/Security.php") multiple times, so loading modules before the foreach loop that loads alll modules won't hurt.

So far I've hit these dependencies:
Many core modules depend on Security.php
Many core modules depend on Settings.php
BotHelp.php depends on AccessControl.php*

Ohter core modules could depend on AccessControl.php as well, but BotHelp.php is the one that generated an error for me.
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Core Modules Depending on Other Core modules
« Reply #1 on: June 13, 2007, 11:36:13 AM »

AccessControl.php, FlexibleSecurity.php, OnlineDB.php, PlayerNotes.php, StringFilter.php, User.php depend on Settings.php.
 
BotHelp.php depends on AccessControl.php.

I think that's it.
Logged
Ebag333
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 132


Re: Core Modules Depending on Other Core modules
« Reply #2 on: June 13, 2007, 11:53:42 AM »

It seems that there's a situation where many modules can rely on many modules (and do), but you never really know what requires what.

In my (feeble) mind there are a few options.

1) Hard code it so we load them in the order in which we need.

2) Somehow make loading functions dynamic so that when we load the module, and that function doesn't exist, we don't get an error (not sure if this is possible).

3) Specify what the modules require in each module that has dependancies, and then dynamically load them in order that we need. (Possible to get loops of dependancies this way...)

4) Change it so that we load essentially all modules at once (well, once for core once for modules, once for custom, etc), maybe via include, or something similar, or perhaps one is built on runtime...hmm...then you could easily enable/disable modules via settings inside the bot rather than having to manually enable/disable them.  You could even have it actually start using the module dynamically rather than requiring a reboot (I would see 3 options, On, Off, and Disabled.  On means just that, Off means it's loaded but not actually used, Disabled means we completely ignore it and in order to enable it you have to turn it to on/off then restart the bot).



Dunno if any of these are useful at all or not.  Just throwing out suggestions. Smiley
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Core Modules Depending on Other Core modules
« Reply #3 on: June 13, 2007, 12:58:02 PM »

If a module calls $this -> bot -> something -> function() in it's constructor, and something is not aoc or db, then that module is depending on something being loaded. The Bot, aoc, and db classes are needed to start the bot so they are already loaded when modules load.

I dug through all the core modules and found only Settings and AccessControl being called from core module constructors, so I think hard coding the Security, Settings, and AccessControl modules to load before the other core modules works fine.
Logged
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Core Modules Depending on Other Core modules
« Reply #4 on: June 14, 2007, 01:23:44 PM »

I know I have posted about this somewhere already... why not just put a "require" with all the core modules a module needs into it? That sounds a bit confusing... what I mean is, that if a core module needs Security to run, just put a require_once("security.php") into it. If Security has already been loaded, nothing happens. If not, it is loaded now. Then the load order of the modules no longer matters, or rather, it sorts out itself.
Logged

Luuv  Bot-Keeper of Vengeance ^^*
Ebag333
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 132


Re: Core Modules Depending on Other Core modules
« Reply #5 on: June 14, 2007, 02:41:51 PM »

Quote from: Glarawyn on June 13, 2007, 12:58:02 PM
I dug through all the core modules and found only Settings and AccessControl being called from core module constructors, so I think hard coding the Security, Settings, and AccessControl modules to load before the other core modules works fine.

At what point do we move modules out of Core and into Sources?  Smiley

Seems that Settings and AccessControl are becoming more than just "core" modules and actually moving into the realm of being required to even run the bot.  (Obviously they're not quite there yet, just seems they're headed in that direction.)
Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Core Modules Depending on Other Core modules
« Reply #6 on: June 14, 2007, 07:42:22 PM »

Agreed. Settings and AccessControl are pretty much an integral part of the bot now, and cannot really be removed without breaking just about everything.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Support > Support for older versions > BeBot 0.3 support > Topic: Core Modules Depending on Other Core modules
« previous next »
 
Jump to:  

Recent
[request] Raid timers
by Elesar1
[December 01, 2008, 04:41:09 PM]

Shared DB online list
by Temar
[December 01, 2008, 01:55:47 AM]

relay colors
by Temar
[December 01, 2008, 01:54:56 AM]

BeBot v0.6.0 released
by Alreadythere
[November 30, 2008, 05:32:00 PM]

Change to Bid.php
by Temar
[November 30, 2008, 11:41:44 AM]

OnlineOrg
by Jiheld
[November 29, 2008, 12:44:27 PM]

Silly Newbie Question.
by Temar
[November 29, 2008, 12:00:02 PM]

massive_pvp_time_table 1
by gerborg
[November 29, 2008, 06:55:35 AM]

Bot not see Guild Chat
by Delvar
[November 28, 2008, 08:30:34 AM]

Starting Bot
by Allisande
[November 28, 2008, 07:08:21 AM]
Stats
Members
Total Members: 1243
Latest: Whackoeng
Stats
Total Posts: 11144
Total Topics: 1505
Online Today: 21
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 1
Guests: 17
Total: 18
Temar

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.247 seconds with 29 queries. (Pretty URLs adds 0.027s, 4q)
Loading...