[wp-trac] [WordPress Trac] #44083: Add action to wp_mkdir_p() when directory is created successfully

WordPress Trac noreply at wordpress.org
Mon Feb 12 22:06:59 UTC 2024


#44083: Add action to wp_mkdir_p() when directory is created successfully
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:
                                                 |  SergeyBiryukov
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Filesystem API                       |     Version:  2.0.1
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch has-unit-   |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by hellofromTonya):

 @costdev pinged me for review.

 The original proposal was to add one action hook to `wp_mkdir_p()` to fire
 "when directory is created successfully". This is accomplished with
 `'after_create_directory'`.

 I understand the need for adding another for when it fails:
 `'create_directory_failed'`.

 But why is `before_create_directory` needed? What benefits does it
 provide?

 Performance:
 There will be a performance hit with firing 3 new hooks and processing all
 of the hooked callbacks. Are there any performance concerns? I assume no
 and that the performance hit is acceptable given this function's recursive
 tasks and the frequency a new directory is created (likely infrequently).
 Noting performance here as a consideration, i.e. just in case there may be
 a concern I'm not aware of.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44083#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list