[wp-trac] [WordPress Trac] #40070: Cannot remove theme with Javascript if folder name contains periods

WordPress Trac noreply at wordpress.org
Tue Mar 14 11:54:07 UTC 2017


#40070: Cannot remove theme with Javascript if folder name contains periods
-------------------------------------+-------------------------
 Reporter:  svanlooy                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  4.8
Component:  Themes                   |     Version:  4.7.3
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  javascript
-------------------------------------+-------------------------

Comment (by subrataemfluence):

 Further investigation tells me that a theme folder (may be a plugin folder
 as well, but I did not test it) by default gets readonly status for some
 reason if it has a period in its name. To test status of a theme folder I
 used the following code snippet in `delete_theme` function of `theme.php`.

 {{{#!php
 $themes_dir = trailingslashit( $themes_dir );
 $theme_dir = trailingslashit( $themes_dir . $stylesheet );

 // Snippet to check readonly status of a theme folder...

 if(wp_is_writable($theme_dir)) {
     return new WP_Error("writable_status", sprintf(__('%s is writable'),
 $theme_dir));
 } else {
     return new WP_Error("writable_status", sprintf(__('%s is readonly'),
 $theme_dir));
 }
 }}}

 When I tried to delete a theme (ex. theme.period or customizr-child) the
 above snippet always enters the `else` part and outputs
 `/var/www/html/tourplanner/wp-content/themes/customizr-child/ is readonly`
 whereas when I tried to delete a theme like 'noperiod' I get a message
 like `/var/www/html/tourplanner/wp-content/themes/period/ is writable`.

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


More information about the wp-trac mailing list