Ejemplo n.º 1
0
 public function cleanup()
 {
     wpbdp_rrmdir($this->working_dir);
 }
Ejemplo n.º 2
0
/**
 * Recursively deletes a directory.
 * @param string $path a directory.
 * @since 3.3
 */
function wpbdp_rrmdir($path)
{
    if (!is_dir($path)) {
        return;
    }
    $files = wpbdp_scandir($path);
    foreach ($files as &$f) {
        $filepath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($f, DIRECTORY_SEPARATOR);
        if (is_dir($filepath)) {
            wpbdp_rrmdir($filepath);
        } else {
            unlink($filepath);
        }
    }
    rmdir($path);
}
Ejemplo n.º 3
0
 public function cleanup()
 {
     $upload_dir = wp_upload_dir();
     wpbdp_rrmdir($this->workingdir);
     if (!$upload_dir['error']) {
         $csvexportsdir = rtrim($upload_dir['basedir'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'wpbdp-csv-exports';
         $contents = wpbdp_scandir($csvexportsdir);
         if (!$contents) {
             wpbdp_rrmdir($csvexportsdir);
         }
     }
 }