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

WordPress Trac noreply at wordpress.org
Thu Jun 28 14:18:54 UTC 2018


#44083: Add action to wp_mkdir_p() when directory is created successfully
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Filesystem API                       |     Version:  2.0.1
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch needs-      |     Focuses:
  refresh                                        |
-------------------------------------------------+-------------------------
Changes (by desrosj):

 * keywords:  good-first-bug has-patch => good-first-bug has-patch needs-
     refresh


Comment:

 @seusmaniqbal this is looking good.

 - Can we tweak the action names a bit more. How about
 `before_create_directory` / `after_create_directory`.
 - The `@since` docblock tags don't need a description when it indicates
 the function is being introduced. Only when changes are made do these need
 notes.
 - Can we change the doclbock descriptions a bit? Thinking "Fires before
 the directory is created." and "Fires after the directory is created and
 the permissions are set." sound a bit better.
 - For the after action, the `$target` parameter should not say attempt
 because it only fires if the directory is created. How about "Full path to
 the created directory."?
 - Please add spaces between the opening and closing parentheses and the
 contents of the actions to [https://make.wordpress.org/core/handbook/best-
 practices/coding-standards/php/#space-usage adhere to the coding
 standards].
 - I think we could include the `$dir_permissions` as a second optional
 filter parameter. Might be useful for plugins to be able to match
 permissions or perform actions only when the directory has a certain
 permission level.
 - Can we move the after action below the `if()` statement? This way, if
 the permissions need to be reset because of the presence of a umask, the
 action can reasonably expect the permissions on the directory to be
 correct.

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


More information about the wp-trac mailing list