#37584 closed feature request (wontfix)
Add SHORTINIT Options
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.5.3 |
Component: | Bootstrap/Load | Keywords: | has-patch |
Focuses: | administration, performance | Cc: |
Description
The existing SHORTINIT variable is useful for loading a minimal WP environment, but it is far too limited for a lot of scenarios. There should be some more advanced shortinit options such as SHORTINIT_WITH_SESSION to allow access to the user session.
To give some context on where this could be useful, I built an ajax heavy WP plugin that was far too slow because of it's use of admin-ajax. To fix this I built my own ajax implementation that loads WP manually and uses SHORTINIT to do so. This removes access to user data though which removed all authentication for ajax requests. In my case this was not an option so I manually loaded in those parts of WP. This works excellently (ajax load times were cut at least in half), but I am dreading maintaining this.
This would also make it easier to implement #33252.
I'll gladly take this and build it myself if this request is approved.
Attachments (2)
Change History (10)
#2
in reply to:
↑ 1
@
9 years ago
Replying to SergeyBiryukov:
Related/duplicate: #26806
Thanks for the reference Sergey, I had seen that ticket and while it is helpful in this regard, a significant difference in the approach of the mentioned ticket and this ticket is that while the mentioned ticket makes it easier to build your own ad-hoc WP loading scripts to run in addition to the SHORTINIT load, it does not fix the plugin maintainability issue I mentioned. Essentially #26806 makes it easier to build patch-work hacks on top of WP while this ticket would add several constants in addition to SHORTINIT that would tell the core what to load making plugins using the feature much more maintainable.
I should add that I do like what is proposed in #26806, and I am not trying to say that it is not a good request. It is just designed for a very different purpose than this patch.
#3
@
9 years ago
- Keywords has-patch added
Just another thought, would a wp_load_user_session() function be a better approach? This function would be called regularly by wp_load.php after hitting the SHORT_INIT qualifier. This would allow the SHORT_INIT constant to function as it does currently, and plugin authors could simply call wp_load_user_session() manually after loading wp_load with SHORTINIT.
#4
@
9 years ago
I much prefer the second approach. Any feedback would be appreciated.
Usage example:
/** Load WordPress Bootstrap */ define( 'SHORTINIT', true ); require_once( '../../../wp-load.php' ); wp_load_utils(); wp_load_session();
This ticket was mentioned in Slack in #core by jorbin. View the logs.
9 years ago
#6
follow-up:
↓ 8
@
9 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
So many files in WordPress are cross dependent that an autoloader is the best way to ensure things get loaded. Once that is in place, custom SHORTINIT
such as just handling sessions will be much more possible. #36335 is the best route for this.
#8
in reply to:
↑ 6
@
7 years ago
Replying to jorbin:
So many files in WordPress are cross dependent that an autoloader is the best way to ensure things get loaded. Once that is in place, custom
SHORTINIT
such as just handling sessions will be much more possible. #36335 is the best route for this.
sorry for replying on closed topic, but can you (anyone) tell me that a bit simpler - is that possible to use SHORTINIT, but also load ONLY user/session-functions , i.e. to check for current_user_can("manage_options")
is that possible? i cant understand that linked ticket well.
Related/duplicate: #26806