* @version 1.0.3 * @link http://aidanlister.com/repos/v/function.rmdirr.php * @param string $dirname Directory to delete * @return bool Returns TRUE on success, FALSE on failure */ function soapclient_rmdirr($dirname) { // Sanity check if (!file_exists($dirname)) { return false; } // Simple delete for a file if (is_file($dirname) || is_link($dirname)) { return unlink($dirname); } // Loop through the folder $dir = dir($dirname); while (false !== $entry = $dir->read()) { // Skip pointers if ($entry == '.' || $entry == '..') { continue; } // Recurse rmdirr($dirname . DIRECTORY_SEPARATOR . $entry); } // Clean up $dir->close(); return rmdir($dirname); } /** * issue: http://drupal.org/node/408362 * Directory structure is not correct. This upgrade removes the old files. */ function soapclient_update_6001() { $ret = array(); //get current module directory and try to delete old files. $root_dir = drupal_get_path('module', 'soapclient'); //Leave 'soapclient/modules' folder untouched it may contain other files. $old_dir = $root . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'soapclient'; //Only operate if the user has not removed the old directory if (file_exists($old_dir) && !soapclient_rmdirr($old_dir)) { drupal_set_message('Files from a previous installation of the Soap Client module were not deleted from the system. You should manually remove the folder: @folder . Please read @url for further information in this update.', array('@folder' => realpath($old_dir), '@url' => "http://drupal.org/node/408362"), 'error'); } return $ret; }