Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6870 closed enhancement (fixed)

All classes should be in their own files

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc: slaFFik, espellcaste@…

Description

#6083 started the process of moving classes to their own files. But it only touched files that were in the bp-{$component}-classes.php files. There are still miscellaneous classes all over the place. Let's move them.

This will help to increase the benefits of autoloading. See #6853.

Attachments (1)

6870.diff (261.0 KB) - added by boonebgorges 9 years ago.

Download all attachments as: .zip

Change History (24)

@boonebgorges
9 years ago

#1 @boonebgorges
9 years ago

  • Type changed from defect (bug) to enhancement

6870.diff sketches how this might be done for the Activity component, which is pretty representative of the other components. Beware: it's a large diff. Here are the important points:

  • All files (not in /classes/) that include a class are moved via svn cp to /classes/. This preserves SVN history.
  • The class-{$classname}.php convention is kept, for compliance with the autoload technique proposed in #6853. This means that we have a file named bp-activity/classes/class-bp-akismet.php. The autoloader will need to have a special entry for classes like this.
  • Where the class previously appeared in the bp-activity-*.php file, it's been replaced with a require command. This ensures 100% backward compatibility with anyone who may be loading these files directly (may Providence have mercy on their Souls). When autoloading is introduced, these require statements can be wrapped in a do_autoload check.

Does the approach look correct to everyone? It will be an absolute blast to walk through the process for each component (NOT!!1!! LOL) but am volunteering myself for the job, if everyone's in agreement.

#2 @slaFFik
9 years ago

  • Cc slaFFik added

#3 @DJPaul
9 years ago

I guess it feels a little weird to see the main loader classes moved in such a way, but those *are* classes, so... make it so!

#4 @espellcaste
9 years ago

  • Cc espellcaste@… added

This ticket was mentioned in Slack in #buddypress by boone. View the logs.


9 years ago

#6 @boonebgorges
9 years ago

In 10516:

Move bp-activity classes to their own files.

See #6870.

#7 @boonebgorges
9 years ago

In 10517:

Move bp-blogs classes to their own files.

See #6870.

#8 @boonebgorges
9 years ago

In 10518:

Move bp-core classes to their own files.

See #6870.

#9 @boonebgorges
9 years ago

In 10519:

Move bp-friends classes to their own files.

See #6870.

#10 @boonebgorges
9 years ago

In 10520:

Move bp-groups classes to their own files.

See #6870.

#11 @boonebgorges
9 years ago

In 10521:

Move bp-members classes to their own files.

See #6870.

#12 @boonebgorges
9 years ago

In 10522:

Move bp-messages classes to their own files.

See #6870.

#13 @boonebgorges
9 years ago

In 10523:

Move bp-notifications classes to their own files.

See #6870.

#14 @boonebgorges
9 years ago

In 10524:

Move bp-settings class to its own file.

See #6870.

#15 @boonebgorges
9 years ago

In 10525:

Move bp-xprofile classes to their own files.

See #6870.

#16 @boonebgorges
9 years ago

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

I've finished the moves for all components.

I don't expect that these will be the final resting places for all of the files. A number of the classes in bp-members/classes/ that once lived in bp-core should probably go back there, to simplify our autoloader. And it's likely that we'll eventually want to do some proper testing to see if it's possible to move/consolidate the inline require statements that have resulted from these changes. But for now, I've tried to be as conservative as possible - no functional changes, even for people who are including files manually.

I'm going to mark this resolved and continue work on autoloading over at #6853.

#17 @boonebgorges
9 years ago

In 10526:

Fix misnamed BP_Component class file name.

Introduced in [10518].

See #6870.

#18 @boonebgorges
9 years ago

In 10527:

Fix broken require statement after [10526].

See #6870.

#19 @boonebgorges
9 years ago

In 10528:

Fix incorrect file name for BP_Theme_Compat class.

Introduced in [10518].

See #6870.

#20 @boonebgorges
9 years ago

In 10529:

Fix misnamed file for BP_Core_Friends_Widget class.

Introduced in [10519].

See #6870.

#21 @boonebgorges
9 years ago

In 10530:

Rename BP_Walker_Category_Checklist file.

The filename should match the class- standard, for easier loading.

See #6870, #6853.

#22 @boonebgorges
9 years ago

In 10531:

Fix misnamed file for BP_Groups_Membership_Requests_Template.

Introduced in [10520].

See #6870.

#23 @DJPaul
9 years ago

  • Component changed from API to Core
Note: See TracTickets for help on using tickets.