Plugin Directory

Changeset 647784


Ignore:
Timestamp:
01/04/2013 09:45:10 AM (13 years ago)
Author:
ti2m
Message:

empty directory remove fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • edge-suite/trunk/includes/edge-suite-general.php

    r632663 r647784  
    145145  $files = list_files($dir);
    146146  $matching_files = array();
    147   foreach ($files as $file) {
    148     if (preg_match($pattern, $file)) {
    149       $matching_files[] = $file;
     147  if($files !== FALSE){
     148    foreach ($files as $file) {
     149      if (preg_match($pattern, $file)) {
     150        $matching_files[] = $file;
     151      }
    150152    }
    151153  }
     
    154156
    155157function rmdir_recursive($dir) {
    156   //global $wp_filesystem;
    157   foreach(glob($dir . '/*') as $file) {
    158     if(@is_dir($file))
    159       rmdir_recursive($file);
    160     else
    161       @unlink($file);
     158  $files = glob($dir . '/*');
     159  if($files !== FALSE){
     160    foreach($files as $file) {
     161      if(@is_dir($file))
     162        rmdir_recursive($file);
     163      else
     164        @unlink($file);
     165    }
    162166  }
    163167  @rmdir($dir);
Note: See TracChangeset for help on using the changeset viewer.