Change the inclusion of 'plugins.php' to require_once
|Reported by:||jorbin||Owned by:||jorbin|
This grew out of a twitter conversation between @andy and I.
Right now, there are a small number of cases where access to the plugins API before the bootstrap process makes sense. WP-CLI is one of these, and when auto-prepended files are needed. Right now, that means directly interacting with the plugin global variables. If we switch to require_once,
Common wisdom says that require is faster than require_once. But common wisdom can be wrong, so I tested it.
The time difference between require and require_once seems to be about 0.01 milliseconds. I think this slight slowdown is worth the flexibility that is gained. Local testing with an opcache enabled showed that there is essentially no difference with an opcache.
Change History (11)
- Owner set to jorbin
- Resolution set to fixed
- Status changed from new to closed