[RFC|Merged] General Hook Architecture of phpBB3.1

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Post Reply
User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by brunoais »

@ nickvergessen
I like it.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by Oleg »

The doc proposal looks great.

Anyone familiar with whatever documentation system we do or can use to automatically extract it?

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by nickvergessen »

EXreaction wrote:This should be in a wiki page of hook guidelines for future reference :)
As mentioned, it will be put into the wiki once the post is confirmed.
EXreaction wrote:Also, instead of core.group_remove_user, would core.group.remove_user make more sense?
we decided to use only one dot for the main prefix. everything else should use underscores
Member of the Development-TeamNo Support via PM

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by nickvergessen »

Should events be wrapped with if ($phpbb_dispatcher != null) to avoid problems in all the functions, if the dispatcher is not set up (f.e. in tests or external usage)
Member of the Development-TeamNo Support via PM

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by MichaelC »

nickvergessen wrote:Should events be wrapped with if ($phpbb_dispatcher != null) to avoid problems in all the functions, if the dispatcher is not set up (f.e. in tests or external usage)
I'd say no. The dispatcher should always be setup (this DIC will make this easier).
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by naderman »

You need to do that if you write code that allows $phpbb_dispatcher to be null. So basically it's a case by case decision, ideally if the dispatcher is passed as an argument it's defined by whether or not you add "= null" as a default as null will not be allowed otherwise. In cases where you still use it as a global variable, i guess it's really just a matter of whether you see a reasonable use case of calling the function without a dispatcher.

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by imkingdavid »

Why not instead of null check to see if it's a proper object...

Code: Select all

if ($phpbb_dispatcher instanceof phpbb_event_dispatcher)
{
    // Event code here
} 
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by igorw »

IMO we should create a null dispatcher (or a mock) and pass that one instead.

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by MichaelC »

Shouldn't this be marked as merged and a separate RFC created for template events?
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] General Hook Architecture of phpBB3.1

Post by Oleg »

If someone creates a new RFC for template events this RFC can be merged.

Post Reply