public function cleanup() { wpbdp_rrmdir($this->working_dir); }
/** * 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); }
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); } } }