Opened 11 years ago
Closed 11 years ago
#25762 closed enhancement (fixed)
Make it easier to customize the install process
Reported by: | Denis-de-Bernardy | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | minor | Version: | 3.7 |
Component: | Upgrade/Install | Keywords: | has-patch |
Focuses: | Cc: |
Description
It's currently possible to override a couple of functions in a wp-content/install.php file, namely:
- wp_install() - top level install function
- wp_install_defaults() - Installs default post, page, links, cat, etc.
- wp_new_blog_notification() - Sends the new blog email.
- wp_upgrade() - Top level upgrade function.
However, they severely lack plugin hooks, which would allow developers to simply hack in there accordingly without needing to keep install functions in sync with core when they want to tweak them.
I'd like to suggest adding hooks named after those functions at the end of each of them.
Attachments (11)
Change History (29)
#4
follow-up:
↓ 5
@
11 years ago
- Component changed from General to Upgrade/Install
- Milestone changed from Awaiting Review to Future Release
- Type changed from feature request to enhancement
Would definitely like more hooks here.
#5
in reply to:
↑ 4
;
follow-up:
↓ 6
@
11 years ago
Replying to nacin:
Would definitely like more hooks here.
Will a patch make it into the next WP version if supplied, or does it need a crazy amount of discussion before getting checked in?
#6
in reply to:
↑ 5
@
11 years ago
- Milestone changed from Future Release to 3.9
Replying to Denis-de-Bernardy:
Will a patch make it into the next WP version if supplied, or does it need a crazy amount of discussion before getting checked in?
The original suggestion seem straightforward enough to me:
I'd like to suggest adding hooks named after those functions at the end of each of them.
I wouldn't be surprised if there are additional opportunities for well-placed actions or filters, but one per function would certainly be a good start. Would be happy to check in a patch this week.
#7
@
11 years ago
- Keywords has-patch added
Replying to nacin:
I wouldn't be surprised if there are additional opportunities for well-placed actions or filters, but one per function would certainly be a good start. Would be happy to check in a patch this week.
I stuck to two hooks, seeing that those two would have been more than enough for use-cases that I've run into over the years:
- one at the very end of wp_install, that passes user_id
- another at the very end of wp_upgrade, that passes the new and old database version
The second patch should be svn-compatible (generated using git diff --noprefix).
#8
@
11 years ago
- Keywords needs-docs added
We'll need docs for these hooks, wherever they land per the Inline Docs standards.
This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.
11 years ago
#11
follow-up:
↓ 12
@
11 years ago
This looks great. Some little things:
- These are actual doc blocks, they need
/**
- 3.9.0 versus 3.9
Also, you put the wp_upgrade hook in upgrade_all(), not wp_upgrade(). Intentional? Looks like wp_upgrade() is indeed the right place for it, as your comment above suggested.
#12
in reply to:
↑ 11
;
follow-up:
↓ 13
@
11 years ago
Replying to nacin:
This looks great. Some little things:
- These are actual doc blocks, they need
/**
- 3.9.0 versus 3.9
Looks like you did that in your amended patch.
Also, you put the wp_upgrade hook in upgrade_all(), not wp_upgrade(). Intentional? Looks like wp_upgrade() is indeed the right place for it, as your comment above suggested.
It was in the wrong function, ya. *tired*… I see you fixed that too.
#13
in reply to:
↑ 12
@
11 years ago
Replying to Denis-de-Bernardy:
It was in the wrong function, ya. *tired*… I see you fixed that too.
All good, just wanted to double-check!
#14
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 27045:
#15
@
11 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
The wp_install hook never gets called in a multisite environment. Placing it in wp_install_defaults was in fact correct.
+1 for adding these hooks.