Adding phpbb prefix to functions

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: Adding phpbb prefix to functions

Post by imkingdavid »

I suppose if all call sites are going to have to be changed anyway, it wouldn't hurt. But in the case of an optional parameter being added at the end, that does not count because not all call sites would have to be changed.
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.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Adding phpbb prefix to functions

Post by callumacrae »

Oleg wrote:We are not going to be changing all functions. This involves too much work and will break everything because we don't have 100% test coverage, not to mention political unrest.

Can we keep on topic please? The case we are discussing changes required parameters which necessitates all call sites to be edited regardless of whether prefix is added or not.
Any decent IDE can change a function name and all calls.
Made by developers, for developers!
My blog

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1905
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Adding phpbb prefix to functions

Post by DavidIQ »

callumacrae wrote:
Oleg wrote:We are not going to be changing all functions. This involves too much work and will break everything because we don't have 100% test coverage, not to mention political unrest.

Can we keep on topic please? The case we are discussing changes required parameters which necessitates all call sites to be edited regardless of whether prefix is added or not.
Any decent IDE can change a function name and all calls.
Yep...and break almost every single MOD out there even if it had a chance it would still work in 3.1.
Image

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

Re: Adding phpbb prefix to functions

Post by MichaelC »

DavidIQ wrote:
callumacrae wrote:
Oleg wrote:We are not going to be changing all functions. This involves too much work and will break everything because we don't have 100% test coverage, not to mention political unrest.

Can we keep on topic please? The case we are discussing changes required parameters which necessitates all call sites to be edited regardless of whether prefix is added or not.
Any decent IDE can change a function name and all calls.
Yep...and break almost every single MOD out there even if it had a chance it would still work in 3.1.
Hence the reason we don't plan to change functions un-necessarily.
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
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Adding phpbb prefix to functions

Post by brunoais »

DavidIQ wrote:
callumacrae wrote:
Oleg wrote:We are not going to be changing all functions. This involves too much work and will break everything because we don't have 100% test coverage, not to mention political unrest.

Can we keep on topic please? The case we are discussing changes required parameters which necessitates all call sites to be edited regardless of whether prefix is added or not.
Any decent IDE can change a function name and all calls.
Yep...and break almost every single MOD out there even if it had a chance it would still work in 3.1.
How about if we use that in conjunction to what I proposed?

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

Re: Adding phpbb prefix to functions

Post by MichaelC »

brunoais wrote:How about if we use that in conjunction to what I proposed?
Then it adds a lot of overhead with little rewards/advantage.
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
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: Adding phpbb prefix to functions

Post by bantu »

Considering that most of phpBB's functions are not prefixed, how about this:
  1. Get rid of global statements in all functions for dependency injection (changing parameter list)
  2. Add phpbb_ prefix to all function names
  3. Create 3.1 to 3.0 compatibility file with wrappers basically as per https://area51.phpbb.com/phpBB/viewtopi ... 53#p249253 importing variables from global space
Result: Dependency Injection + Easier/Better Unit Testing

3.0 modifications can then either
  • be ported to 3.1 extensions (best)
  • be ported to 3.1 modifications (updating function calls)
  • include the compatibility file (basically saying "I just want this to work for now")
The compatibility file is not loaded by phpBB itself.

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

Re: Adding phpbb prefix to functions

Post by Oleg »

That is very agreeable.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: Adding phpbb prefix to functions

Post by EXreaction »

I would agree to that except for requiring that mods include a compatibility file. This would require them to update anyways to include the file, so it would not be of benefit.

I would be good with one of the following:
1. Just include the compatibility file
2. Create a constant in the config file for new installs (PHPBB_COMPATIBILITY_MODE, set to false). If this constant is not set or is true, include the file, else do not.

Both options would preserve compatibility for upgrades, but the second option, for fresh installs, having it disabled would require administrators to enable it if they want to attempt to install old modifications.

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

Re: Adding phpbb prefix to functions

Post by MichaelC »

EXreaction wrote:I would agree to that except for requiring that mods include a compatibility file. This would require them to update anyways to include the file, so it would not be of benefit.

I would be good with one of the following:
1. Just include the compatibility file
2. Create a constant in the config file for new installs (PHPBB_COMPATIBILITY_MODE, set to false). If this constant is not set or is true, include the file, else do not.

Both options would preserve compatibility for upgrades, but the second option, for fresh installs, having it disabled would require administrators to enable it if they want to attempt to install old modifications.
+1
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.

Post Reply