WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#16764 closed enhancement (maybelater)

PHP5-port - wpdb class

Reported by: hakre Owned by:
Milestone: Priority: lowest
Severity: normal Version: 3.1
Component: Database Keywords: has-patch close
Focuses: Cc:

Description

The wpdb class can benefit from porting the code to PHP5.

Related: #16756; #16757, #16571 (#16760), #16762

Attachments (3)

16764.patch (38.6 KB) - added by hakre 4 years ago.
wpdb with interface and base class
16764.2.patch (27.5 KB) - added by hakre 4 years ago.
wpdb with interface, no base class, variables sorted by access-type, single file
16764.3.patch (21.3 KB) - added by hakre 4 years ago.
Simplified version, visibility mainly, constructor and small adds only

Download all attachments as: .zip

Change History (10)

@hakre4 years ago

wpdb with interface and base class

@hakre4 years ago

wpdb with interface, no base class, variables sorted by access-type, single file

@hakre4 years ago

Simplified version, visibility mainly, constructor and small adds only

comment:1 @westi4 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Priority changed from normal to lowest
  • Type changed from defect (bug) to feature request

This change is going to create a lot of unnecessary churn in the code.

The whole point to me of requiring PHP5 is not to then rewrite the whole of WordPress using a different paradigm but to be able to use PHP5 functionality more freely when adding new features or making incremental improvements.

comment:2 @hakre4 years ago

  • Type changed from feature request to enhancement

I beg your pardon westi, wpdb is one of the classes that get's replaced more often. This can benefit from visiblity and interface. It's not introducing a different paradigm at least the changes suggested here were not intended to do so.

The opposite is the case, it's a try to only do minimal changes so that overall code can benefit without introducing too much new things, e.g. a factory for wpdb or similar. The ticket here is just a very lightweight refactoring suggestion.

However, you're totally right that PHP 5 is backwards comptabile with classes that do not make use of interfaces and visibility. The downside is, that you can only program against concrete classes and all methods and members are public.

Wpdb has been designed with private members in mind and thanks to PHP 5, that paradigm can now be reflected even in code and not only in documentation. That's far away from a feature request.

comment:3 @hakre4 years ago

Related: #12257

comment:5 @pento3 years ago

  • Resolution set to maybelater
  • Status changed from new to closed

Per nacin's link, there is no need to refactor wpdb at this time.

comment:6 @SergeyBiryukov3 years ago

  • Milestone Future Release deleted

comment:7 @Mamaduka3 years ago

  • Cc georgemamadashvili@… added
Note: See TracTickets for help on using tickets.