MU Advanced: Issues and Discussion
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • July 31, 2010, 05:50:22 PM
Home Forums Contact Tags FAQ Links News Login Register
* *
Navigation Menu
Search

Random Quotes
I saw a werewolf with a Chinese menu in his hand, his hair was perfect.
- Warren Zevon
Pages: [1]   Go Down
  Print  
Author Topic: The load order of plugins  (Read 1275 times)
0 Members and 1 Guest are viewing this topic.
drmike
Gate Keeper
*****

Karma: 3
Offline Offline

Posts: 2228



View Profile WWW
« on: October 18, 2008, 03:53:57 PM »

Just checking.  Plugins load in alphabetical order, correct?  Just want to make sure.

Thanks,
-drmike
Logged

Andrea_R
Key Master
*****

Karma: 5
Offline Offline

Posts: 1626


The spiky-haired mistress of homeschooling. (R)


View Profile WWW
« Reply #1 on: October 18, 2008, 04:38:12 PM »

The code may load in that order, but I believe if the plugin calls a function call somewhere in the template, it loads in the order in which it appears on the template.
Logged

Am I the only one with a sig?
Ah well, might as well read my blog for lols.
drmike
Gate Keeper
*****

Karma: 3
Offline Offline

Posts: 2228



View Profile WWW
« Reply #2 on: October 18, 2008, 05:35:55 PM »

Thanks
Logged

Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #3 on: October 19, 2008, 07:14:31 AM »

Mu-plugins are actually loaded in the order they come in on disk, or something stupid like that.

It changed at the 1.5 interval, and has on occasion been known to not load some plugins.
Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
drmike
Gate Keeper
*****

Karma: 3
Offline Offline

Posts: 2228



View Profile WWW
« Reply #4 on: October 19, 2008, 12:28:12 PM »

Hmmm, only time I never saw a plugin load from mu was when it was within a subdirectory under the mu subdirectory.

Maybe I',m just lucky.
Logged

Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #5 on: October 20, 2008, 10:31:27 AM »

Could be. I fought with it a few times right after 1.5, and then a time or two recently as well.

Since then, I've pretty much moved to a single file in mu-plugins. It has 3 sections, that check for the admin area, not admin area, and then all the time. From there, it includes files from two of the 3 directories. Either admin or public, and then the "all the time" directory.

Cuts out all the problems that way, as the main mu-plugins dir only has to include one file, which never changes.

Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
Andrea_R
Key Master
*****

Karma: 5
Offline Offline

Posts: 1626


The spiky-haired mistress of homeschooling. (R)


View Profile WWW
« Reply #6 on: October 20, 2008, 12:54:58 PM »

Dude, that;s a sweet idea.
Logged

Am I the only one with a sig?
Ah well, might as well read my blog for lols.
drmike
Gate Keeper
*****

Karma: 3
Offline Offline

Posts: 2228



View Profile WWW
« Reply #7 on: October 20, 2008, 01:38:14 PM »

That came up before.  For us, it seems like most of the mu-plugins we have are both public and admin so it wouldn't do much good.  wp-shortstat comes to mind as an example.  While you see the output on the admin side, something also loads on the public side.

I do have planned moving the widgets over to the own plugin file like edublogs has where folks have to activate it to get the additional widgets.

And all the css from the plugins and what not are in their own file.  Not sure if that's sped things up but our headers look a lot more organized.
Logged

ron_r
Key Master
*****

Karma: 4
Offline Offline

Posts: 1143



View Profile WWW
« Reply #8 on: October 21, 2008, 08:29:14 AM »

You would have to split plugins into 2 or 3 files. If I'm writing a plugin of any size I use separate files anyway partly looking down the road to doing what Luke has done.
Logged

The key to problem solving is identifying the problem.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #9 on: October 22, 2008, 09:58:01 AM »

For me, the less in mu-plugins the better. But we've all beat that horse to death.

99% of plugins can be put in the normal plugins directory, and if someone wants it, they can turn it on. If they can't be bothered, they probably aren't worth having as a user.

I'm in the process of building a niche site, and the mu-plugins directory will be practically empty. Then again, some things will be hacked in that would have been there, but that's beside the point.

Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #10 on: October 28, 2008, 12:13:38 PM »

btw, here's what we're doing these days.

1) we have a mu-plugin that loads "plugins" from directories inside of the mu-plugin directory just like regular plugins. So that means, it scans the comment and looks for "Plugin Name" and only loads the php if that comment exists. This doesn't effect the behavior of files in the mu-plugin directory, only those in subdirectories of mu-plugin.

2) we cache this list of files, and only regenerated it if a siteadmin goes to a special admin page and reloads the plugin list.

Inside of our plugins we've adopted the following design pattern:

a) plugin-name-min.php - this is a super small file which exposes only the minimum APIs and callbacks needed for the plugin to "load" but it doesn't contain the body of the code.

b) plugin-name-min.php will check for is_admin() and other state functions to determine which other helper files it may or may not need.

c) inside of an API call, where something actually needs to be done, it will do an include of plugin-name.php and then call the actual implementation function.

======

The effect of this design pattern is that the *-min.php files load, parse, and execute quickly, because they have very little code.

If and only if the plugin is actually needed does it even load, and parse the main implementation file.

We're pleased with how this is working for us.


Logged

Yep, that's me... riding my bike 204 miles in one day.
Tags:

Pages: [1]   Go Up
  Print  
 
Jump to:  


Login
 
 
Recent Posts
Recent Topics
No new topics.
Hot Tags
Whos Online
8 Guests, 0 Users
Home Forums Contact Tags FAQ Links News Login Register