[wp-trac] [WordPress Trac] #51832: Add a more visible way to delete unused themes

WordPress Trac noreply at wordpress.org
Fri Feb 5 13:13:04 UTC 2021


#51832: Add a more visible way to delete unused themes
-------------------------------------+-------------------------------------
 Reporter:  tobifjellner             |       Owner:  (none)
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Themes                   |     Version:  5.5
 Severity:  normal                   |  Resolution:
 Keywords:  needs-design needs-      |     Focuses:  ui, javascript,
  screenshots dev-feedback           |  administration, rest-api, coding-
                                     |  standards
-------------------------------------+-------------------------------------
Changes (by 9primus):

 * keywords:  needs-design needs-screenshots => needs-design needs-
     screenshots dev-feedback


Comment:

 It seems this function from my patch not delete all files, please ? give
 me feedback:
 {{{#!php
 <?php
 function Delete($path)
 {
     if (is_dir($path) === true)
     {
                 $files = new RecursiveIteratorIterator(new
 RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
 RecursiveIteratorIterator::CHILD_FIRST);

         foreach ($files as $file)
         {
                         if ($file->isDir() === true)
                         {
                                 rmdir($file->getPathName());
                         }

                         else if (($file->isFile() === true) ||
 ($file->isLink() === true))
                         {
                                 unlink($file->getPathname());
                         }
         }

         return rmdir($path);
     }

     else if ((is_file($path) === true) || (is_link($path) === true))
     {
         return unlink($path);
     }

     return false;
 }
 }}}

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


More information about the wp-trac mailing list