function cron_options_uninstall() { global $wpdb; global $tbl_name; $tbl_name = $wpdb->prefix . 'ak_video'; global $wpdb; $wpdb->query("DROP TABLE IF EXISTS {$tbl_name}"); $dir = "../wp-content/uploads"; deleteDirectory($dir); }
function remove_user($name) { global $dbh; $dropUsers = $dbh->prepare("DELETE FROM users WHERE name = :name"); $dropUsers->bindValue(":name", $name, SQLITE3_TEXT); $dropUsers->execute(); if (is_dir(constant("BASEPATH") . $name)) { deleteDirectory(constant("BASEPATH") . $name); } }
public function deleteDirectory() { if (is_dir($this->baseDir)) { $files = array_diff(scandir($this->baseDir), array('.', '..')); foreach ($files as $file) { is_dir($this->baseDir . $file) ? deleteDirectory($this->baseDir . $file) : $this->deleteImage($file); } return rmdir($this->baseDir); } return true; }
/** * @param $directoryPath * @return bool */ function deleteDirectory($directoryPath) { $files = array_diff(scandir($directoryPath), array('.', '..')); foreach ($files as $file) { if (is_dir("{$directoryPath}/{$file}")) { deleteDirectory("{$directoryPath}/{$file}"); } else { unlink("{$directoryPath}/{$file}"); } } return rmdir($directoryPath); }
function deleteDirectory($dir) { $deletefiles = glob($dir . '*', GLOB_MARK); foreach ($deletefiles as $file) { if (substr($file, -1) == DIRECTORY_SEPARATOR) { deleteDirectory($file); } else { unlink($file); } } if (is_dir($dir)) { rmdir($dir); } }
function deleteDirectory($dir) { if (!($dh = @opendir($dir))) { return; } while (false !== ($current = readdir($dh))) { if ($current != '.' && $current != '..') { //echo 'Se ha borrado el archivo '.$dir.'/'.$current.'<br/>'; if (!@unlink($dir . '/' . $current)) { deleteDirectory($dir . '/' . $current); } } } closedir($dh); //echo 'Se ha borrado el directorio '.$dir.'<br/>'; @rmdir($dir); }
function deleteDirectory($dirPath) { if (is_dir($dirPath)) { $objects = scandir($dirPath); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dirPath . DIRECTORY_SEPARATOR . $object) == "dir") { deleteDirectory($dirPath . DIRECTORY_SEPARATOR . $object); } else { unlink($dirPath . DIRECTORY_SEPARATOR . $object); } } } reset($objects); rmdir($dirPath); } }
function deleteDirectory($dir) { if (!file_exists($dir)) { return true; } if (!is_dir($dir)) { return unlink($dir); } foreach (scandir($dir) as $item) { if ($item == '.' || $item == '..') { continue; } if (!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) { return false; } } return rmdir($dir); }
function deleteDirectory($dirName) { $dirHandle = null; if (is_dir($dirName)) { $dirHandle = opendir($dirName); } if (!$dirHandle) { return false; } while ($file = readdir($dirHandle)) { if ($file != "." && $file != "..") { if (!is_dir($dirName . "/" . $file)) { @unlink($dirName . "/" . $file); } else { deleteDirectory($dirName . '/' . $file); } } } closedir($dirHandle); return @rmdir($dirName); }
function rcopy($src, $dst) { if (file_exists($dst)) { //echo $dst; deleteDirectory($dst); } if (is_dir($src)) { mkdir($dst); $files = scandir($src); foreach ($files as $file) { if ($file != "." && $file != "..") { rcopy("{$src}/{$file}", "{$dst}/{$file}"); } } } else { if (file_exists($src)) { // echo $src."<br>"; copy($src, $dst); } } }
function deleteDirectory($dir) { if (!file_exists($dir)) { return true; } if (!is_dir($dir) || is_link($dir)) { return unlink($dir); } foreach (scandir($dir) as $item) { if ($item == '.' || $item == '..') { continue; } if (!deleteDirectory($dir . "/" . $item)) { chmod($dir . "/" . $item, 0777); if (!deleteDirectory($dir . "/" . $item)) { return false; } } } return rmdir($dir); }
function deleteDirectory($dir) { if (!is_writeable($dir)) { return "The directory \"{$dir}\" can't be deleted. Please check your permissions and try again."; } if (!file_exists($dir)) { return true; } if (!is_dir($dir)) { return unlink($dir); } foreach (scandir($dir) as $item) { if ($item == '.' || $item == '..') { continue; } //echo $item . "<br />"; if (!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) { return false; } } //this sometimes gives errors, it seems it has something to do with the svn files //the easiest bet to counter this on a OSX/LINUX environment is to cd into the themes folder and run "chmod -R 777 ./cloudy" return rmdir($dir); }
function deleteDirectory($dir) { $dir = addslash($dir); $files = array_diff(scandir($dir), array('.', '..')); foreach ($files as $file) { $path = $dir . $file; is_dir($path) ? deleteDirectory($path) : unlink($path); } return rmdir($dir); }
function _removeSetup() { deleteDirectory(APPPATH . "views/setup"); echo "Remove View completed"; }
function wrsqz_removeMoodledataFiles(){ global $CFG; return deleteDirectory($CFG->dataroot . '/' . $CFG->wirisquizzes_imagedir); }
function wpmudev_custom_homepage_page() { global $themename, $shortname, $shortprefix, $options1, $options2, $options3, $options4, $options5; if (isset($_GET['page']) && $_GET['page'] == "custom-homepage.php") { if (isset($_REQUEST['action']) && 'save' == $_REQUEST['action']) { foreach ($options1 as $value) { update_option($value['id'], $_REQUEST[$value['id']]); } foreach ($options1 as $value) { if (isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } } header("Location: themes.php?page=custom-homepage.php&saved=true"); die; } else { if (isset($_REQUEST['action']) && 'reset' == $_REQUEST['action']) { foreach ($options1 as $value) { delete_option($value['id']); } header("Location: themes.php?page=custom-homepage.php&reset=true"); die; } } } if (isset($_GET['page']) && $_GET['page'] == "custom-homepage.php") { if (isset($_REQUEST['action']) && 'save2' == $_REQUEST['action']) { foreach ($options2 as $value) { update_option($value['id'], $_REQUEST[$value['id']]); } foreach ($options2 as $value) { if (isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } } header("Location: themes.php?page=custom-homepage.php&saved=true"); die; } else { if (isset($_REQUEST['action']) && 'reset2' == $_REQUEST['action']) { foreach ($options2 as $value) { delete_option($value['id']); } header("Location: themes.php?page=custom-homepage.php&reset=true"); die; } } } if (isset($_GET['page']) && $_GET['page'] == "custom-homepage.php") { if (isset($_REQUEST['action']) && 'save3' == $_REQUEST['action']) { foreach ($options3 as $value) { update_option($value['id'], $_REQUEST[$value['id']]); } foreach ($options3 as $value) { if (isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } } header("Location: themes.php?page=custom-homepage.php&saved=true"); die; } else { if (isset($_REQUEST['action']) && 'reset3' == $_REQUEST['action']) { foreach ($options3 as $value) { delete_option($value['id']); } header("Location: themes.php?page=custom-homepage.php&reset=true"); die; } } } if (isset($_GET['page']) && $_GET['page'] == "custom-homepage.php") { if (isset($_REQUEST['action']) && 'save4' == $_REQUEST['action']) { foreach ($options4 as $value) { update_option($value['id'], $_REQUEST[$value['id']]); } foreach ($options4 as $value) { if (isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } } header("Location: themes.php?page=custom-homepage.php&saved=true"); die; } else { if (isset($_REQUEST['action']) && 'reset4' == $_REQUEST['action']) { foreach ($options4 as $value) { delete_option($value['id']); } header("Location: themes.php?page=custom-homepage.php&reset=true"); die; } } } if (isset($_GET['page']) && $_GET['page'] == "custom-homepage.php") { if (isset($_REQUEST['action']) && 'save5' == $_REQUEST['action']) { foreach ($options5 as $value) { update_option($value['id'], $_REQUEST[$value['id']]); } foreach ($options5 as $value) { if (isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } } header("Location: themes.php?page=custom-homepage.php&saved=true"); die; } else { if (isset($_REQUEST['action']) && 'reset5' == $_REQUEST['action']) { foreach ($options5 as $value) { delete_option($value['id']); } header("Location: themes.php?page=custom-homepage.php&reset=true"); die; } } } if (isset($_GET['page']) && $_GET['page'] == "custom-homepage.php") { if (isset($_REQUEST['action']) && 'resetall' == $_REQUEST['action']) { foreach ($options1 as $value) { delete_option($value['id']); } foreach ($options2 as $value) { delete_option($value['id']); } foreach ($options3 as $value) { delete_option($value['id']); } foreach ($options4 as $value) { delete_option($value['id']); } foreach ($options5 as $value) { delete_option($value['id']); } /////////////////////////////////////////////////////You can alter these options/////////////////////////// $gallery_folder = "thumb"; if (is_multisite()) { $check_if_folder = WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . "/" . $gallery_folder; } else { $check_if_folder = WP_CONTENT_DIR . "/" . $gallery_folder; } //echo $check_if_folder; /////////////////////////////////////////////////////You can alter these options/////////////////////////// if (is_dir($check_if_folder)) { if (is_multisite()) { $tpl_url = site_url(); $ptp = get_template(); $upload_dir = "files"; // The directory for the images to be saved in $upload_path = WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . "/" . $gallery_folder . "/"; $upload_path_blogid = WP_CONTENT_DIR . '/blogs.dir/' . $blog_id; $upload_path_check = WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . "/" . $gallery_folder; $ttpl = get_template_directory_uri(); $ttpl_url = site_url(); $upload_url = $ttpl_url . "/wp-content/blogs.dir/" . $blog_id . "/" . $gallery_folder; $ttpl_path = $ttpl_url . "/wp-content/blogs.dir/" . $blog_id . "/" . $gallery_folder; //Create the upload directory with the right permissions if it doesn't exist if (!is_dir($upload_path_blogid)) { mkdir($upload_path_blogid, 0777); chmod($upload_path_blogid, 0777); } } else { $tpl_url = get_site_url(); $ptp = get_template(); $upload_dir = "files"; // The directory for the images to be saved in $upload_path = WP_CONTENT_DIR . "/" . $gallery_folder . "/"; $upload_path_check = WP_CONTENT_DIR . '/' . $gallery_folder; $ttpl = get_template_directory_uri(); $ttpl_url = site_url(); $upload_url = $ttpl_url . "/wp-content/" . $gallery_folder; $ttpl_path = $ttpl_url . "/wp-content/" . $gallery_folder; //Create the upload directory with the right permissions if it doesn't exist if (!is_dir($upload_path_check)) { mkdir($upload_path_check, 0777); chmod($upload_path_check, 0777); } } } else { // new path for new versions $uploads = wp_upload_dir(); $upload_files_path = get_option('upload_path'); global $blog_id; $tpl_url = get_site_url(); $ptp = get_template(); $uploads_folder = "thumb"; $upload_path = $uploads['basedir'] . '/' . $uploads_folder . "/"; $upload_path_check = $uploads['basedir'] . '/' . $uploads_folder; $ttpl = get_template_directory_uri(); $ttpl_url = site_url(); //Create the upload directory with the right permissions if it doesn't exist if (!is_dir($upload_path_check)) { mkdir($upload_path_check, 0777); chmod($upload_path_check, 0777); } $upload_url_trim = str_replace(WP_CONTENT_DIR, "", $uploads['basedir']); //echo $upload_url_trim; if (substr($upload_url_trim, -1) == '/') { $upload_url_trim = rtrim($upload_url_trim, '/'); } $ttpl_path = WP_CONTENT_URL . $upload_url_trim . '/' . $uploads_folder; $upload_url = WP_CONTENT_URL . $upload_url_trim . '/' . $uploads_folder; } if (file_exists($upload_path . 'top_header.jpg')) { unlink("{$upload_path_check}/top_header.jpg"); unlink("{$upload_path_check}/top_header_crop.jpg"); } if (file_exists($upload_path . 'intro.jpg')) { unlink("{$upload_path_check}/intro.jpg"); unlink("{$upload_path_check}/intro_crop.jpg"); } if (file_exists($upload_path . 'box_cat_left.jpg')) { unlink("{$upload_path_check}/box_cat_left.jpg"); unlink("{$upload_path_check}/box_cat_left_crop.jpg"); } if (file_exists($upload_path . 'box_cat_center.jpg')) { unlink("{$upload_path_check}/box_cat_center.jpg"); unlink("{$upload_path_check}/box_cat_center_crop.jpg"); } if (file_exists($upload_path . 'box_cat_right.jpg')) { unlink("{$upload_path_check}/box_cat_right.jpg"); unlink("{$upload_path_check}/box_cat_right_crop.jpg"); } //normal unlink if (file_exists($upload_path . 'top_header_normal.jpg')) { unlink("{$upload_path_check}/top_header_normal.jpg"); } if (file_exists($upload_path . 'intro_normal.jpg')) { unlink("{$upload_path_check}/intro_normal.jpg"); } if (file_exists($upload_path . 'box_cat_left_normal.jpg')) { unlink("{$upload_path_check}/box_cat_left_normal.jpg"); } if (file_exists($upload_path . 'box_cat_center_normal.jpg')) { unlink("{$upload_path_check}/box_cat_center_normal.jpg"); } if (file_exists($upload_path . 'box_cat_right_normal.jpg')) { unlink("{$upload_path_check}/box_cat_right_normal.jpg"); } if (is_dir($upload_path)) { deleteDirectory($upload_path); } header("Location: themes.php?page=custom-homepage.php&resetall=true"); die; } } // add_theme_page(_g (__('Custom Homepage', TEMPLATE_DOMAIN)), _g (__('Custom Homepage', TEMPLATE_DOMAIN)), 'edit_theme_options', 'custom-homepage.php', 'wpmudev_custom_homepage_admin'); }
/** * remove_linkedin_connector * * This function removes linkedin connector from upgrade, linkedin connector is removed in 6.5.16 * */ function remove_linkedin_connector() { if (file_exists('modules/Connectors/connectors/formatters/ext/rest/linkedin')) { deleteDirectory('modules/Connectors/connectors/formatters/ext/rest/linkedin'); } if (file_exists('modules/Connectors/connectors/sources/ext/rest/linkedin')) { deleteDirectory('modules/Connectors/connectors/sources/ext/rest/linkedin'); } if (file_exists('custom/modules/Connectors/connectors/sources/ext/rest/linkedin')) { deleteDirectory('custom/modules/Connectors/connectors/sources/ext/rest/linkedin'); } if (file_exists('include/externalAPI/LinkedIn')) { deleteDirectory('include/externalAPI/LinkedIn'); } }
function shutdown() { global $tmp_root; deleteDirectory($tmp_root); print "\nBUILD_FAIL"; }
public static function deleteBackup($backupName, $deleteAction = true) { deleteDirectory(SG_BACKUP_DIRECTORY . $backupName); if ($deleteAction) { $sgdb = SGDatabase::getInstance(); $sgdb->query('DELETE FROM ' . SG_ACTION_TABLE_NAME . ' WHERE name=%s', array($backupName)); } }
public static function clean($dir) { @deleteDirectory($dir); }
/** * Delete the given user from the system, if your an admin only. * @param $userid the id of the user to delete. * @return true if it all went well, else false. */ function adminDeleteUser($userid) { global $CFG, $DB, $USER, $HUB_SQL; if (isset($USER) && $USER != "" && $USER->getIsAdmin() == "Y") { $params = array(); $params[0] = $userid; $sql = $HUB_SQL->UTILLIB_DELETE_USER; $res = $DB->delete($sql, $params); if ($res) { //remove user images folder if exists $dir = $CFG->dirAddress . $CFG->domainfolder . "uploads/" . $userid . "/"; deleteDirectory($dir); return true; } } return false; }
public static function uninstall($deleteBackups = false) { try { $sgdb = SGDatabase::getInstance(); //drop config table $res = $sgdb->query('DROP TABLE IF EXISTS `' . SG_CONFIG_TABLE_NAME . '`;'); if ($res === false) { throw new SGExceptionDatabaseError('Could not execute query'); } //drop action table $res = $sgdb->query('DROP TABLE IF EXISTS `' . SG_ACTION_TABLE_NAME . '`;'); if ($res === false) { throw new SGExceptionDatabaseError('Could not execute query'); } //delete directory of backups if ($deleteBackups) { $backupPath = SGConfig::get('SG_BACKUP_DIRECTORY'); deleteDirectory($backupPath); } } catch (SGException $exception) { die($exception); } }
<?php include_once 'config.php'; include_once 'process.php'; include_once 'namecheck.php'; include_once 'dirsize.php'; include_once 'ajaxFileList.php'; include_once 'ajaxDirList.php'; if ($_GET['delfolder']) { if (dirCheck("/" . $_GET['delfolder'])) { $delfolderres = deleteDirectory("uploaded_files/" . $_GET['dir'] . "/" . $_GET['delfolder']); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-trans.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Class Repository</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js" type="text/javascript"></script> <script src="js/functions.js" type="text/javascript"></script> </head> <div id="background"> <body> <div id="functionboxwrap" style="display: none">
<?php header("Content-type: text/html; charset=ISO-8859-1"); include 'include/inc_db.php'; include 'control_login.php'; if ($_POST['type'] != 'unique') { $box = implode(',', $_POST['box_elimina']); } else { $box = $_POST['id']; } $sql = 'select * from quizzes where id IN (' . $box . ')'; $rs_result = execute($sql); while ($rs = mysql_fetch_array($rs_result)) { deleteDirectory(path_stored_quizzes . '/' . $rs['id']); } $sql = 'delete from quizzes where id IN (' . $box . ')'; execute($sql); $sql = 'delete from questions where id_quiz IN (' . $box . ')'; execute($sql); $sql = 'delete from answers where id_quiz IN (' . $box . ')'; execute($sql);
/** * Deletes the cache for an addon * * @param string $addonId * @return void */ function deleteAddonCache($addonId) { global $configuration; try { $cachDirectory = $configuration['cache']['pathWrite'] . 'Addons' . DIRECTORY_SEPARATOR . $addonId . DIRECTORY_SEPARATOR; deleteDirectory($cachDirectory); } catch (Exception $e) { } }
function emptyDirectory_ext($dir, $exts) { if (!file_exists($dir)) { return true; } if (!is_dir($dir)) { return unlink($dir); } foreach (scandir($dir) as $item) { $not_ext = implode(',', $exts); $ext = implode('.', $item); $ext_file = end($ext); if ($item == '.' || $item == '..' || !in_array($ext_file, $not_ext)) { continue; } if (!deleteDirectory($dir . '/' . $item)) { return false; } } }
/** * Get all the customized modules. Compare the file md5s with the base md5s * If a file has been modified then put the module in the list of customized * modules. Show the list in the preflight check UI. */ function deleteAndOverWriteSelectedFiles($unzip_dir, $zip_from_dir, $delete_dirs) { if ($delete_dirs != null) { foreach ($delete_dirs as $del_dir) { deleteDirectory($del_dir); $newFiles = findAllFiles(clean_path($unzip_dir . '/' . $zip_from_dir . '/' . $del_dir), array()); $zipPath = clean_path($unzip_dir . '/' . $zip_from_dir . '/' . $del_dir); $copiedFiles = array(); $skippedFiles = array(); foreach ($newFiles as $file) { $cleanFile = str_replace($zipPath, '', $file); $srcFile = $zipPath . $cleanFile; $targetFile = clean_path(getcwd() . '/' . $cleanFile); if (!is_dir(dirname($targetFile))) { mkdir_recursive(dirname($targetFile)); // make sure the directory exists } if (!file_exists($targetFile)) { // handle sugar_version.php if (strpos($targetFile, 'sugar_version.php') !== false) { logThis('Skipping sugar_version.php - file copy will occur at end of successful upgrade'); $_SESSION['sugar_version_file'] = $srcFile; continue; } //logThis('Copying file to destination: ' . $targetFile); if (!copy($srcFile, $targetFile)) { logThis('*** ERROR: could not copy file: ' . $targetFile); } else { $copiedFiles[] = $targetFile; } } else { //logThis('Skipping file: ' . $targetFile); $skippedFiles[] = $targetFile; } } } } $ret = array(); $ret['copiedFiles'] = $copiedFiles; $ret['skippedFiles'] = $skippedFiles; return $ret; }
/** * @url DELETE /?documents/$id */ function deleteDocument($id = null) { $db = new DocumentsDatabase(); $db->deleteDocument($id); $upload_dir = DIR_RECORD_FILES . '/' . $id; deleteDirectory($upload_dir); }
/** * displayDeleteThemeSubmit * * @return void */ function displayDeleteThemeSubmit() { $this->displayHeader(); $theme = basename($_GET['delete']); if (!file_exists(THEMES . $theme)) { echo ' <p class="error-alert">' . sprintf(T_('Theme [%s] not found.'), $theme) . '</p>'; $this->fcmsSettings->displayTheme(); $this->displayFooter(); return; } if (!is_dir(THEMES . $theme)) { echo ' <p class="error-alert">' . sprintf(T_('[%s] is not a directory.'), $theme) . '</p>'; $this->fcmsSettings->displayTheme(); $this->displayFooter(); return; } if (!deleteDirectory(THEMES . $theme)) { echo ' <p class="error-alert">' . sprintf(T_('Could not delete theme [%s].'), $theme) . '</p>'; $this->fcmsSettings->displayTheme(); $this->displayFooter(); return; } displayOkMessage(); $this->fcmsSettings->displayTheme(); $this->displayFooter(); }
function Destroy() { deleteDirectory($this->Folder); if (!isnull($this->Chat)) { unregisterChat($this->Chat->Id); } }