public function deleteSelection($actionName, &$httpVars, $filesVars) { $init = $this->initDirAndSelection($httpVars, array(), true); if (isset($init["RECYCLE"]) && isset($init["RECYCLE"]["action"]) && $init["RECYCLE"]["action"] != "delete") { $httpVars["dest"] = SystemTextEncoding::fromUTF8($init["RECYCLE"]["dest"]); $this->copyOrMoveSelection("move", $httpVars, $filesVars); $userSelection = $init["ORIGINAL_SELECTION"]; $files = $userSelection->getFiles(); if ($actionName == "delete") { foreach ($files as $file) { RecycleBinManager::fileToRecycle($file); } } else { if ($actionName == "restore") { foreach ($files as $file) { RecycleBinManager::deleteFromRecycle($file); } } } $this->commitChanges($actionName, array("dir" => RecycleBinManager::getRelativeRecycle()), $filesVars); return; } foreach ($init["SELECTION"] as $selectedFile) { $res = ExecSvnCmd('svn delete', $selectedFile, '--force'); } $this->commitMessageParams = "[" . implode(",", $init["SELECTION"]) . "]"; $this->commitChanges($actionName, $httpVars, $filesVars); $this->logInfo("Delete (svn delegate)", array("files" => $init["SELECTION"])); AJXP_XMLWriter::header(); AJXP_XMLWriter::sendMessage("The selected files/folders have been deleted (by SVN)", null); AJXP_XMLWriter::reloadDataNode(); AJXP_XMLWriter::close(); }
function deldir($location) { if (is_dir($location)) { $all = opendir($location); while ($file = readdir($all)) { if (is_dir("{$location}/{$file}") && $file != ".." && $file != ".") { $this->deldir("{$location}/{$file}"); if (file_exists("{$location}/{$file}")) { rmdir("{$location}/{$file}"); } unset($file); } elseif (!is_dir("{$location}/{$file}")) { if (file_exists("{$location}/{$file}")) { unlink("{$location}/{$file}"); } unset($file); } } closedir($all); rmdir($location); } else { if (file_exists("{$location}")) { $test = @unlink("{$location}"); if (!$test) { throw new Exception("Cannot delete file " . $location); } } } if (basename(dirname($location)) == $this->repository->getOption("RECYCLE_BIN")) { // DELETING FROM RECYCLE RecycleBinManager::deleteFromRecycle($location); } }
public function deldir($location, $repoData) { if (is_dir($location)) { $dirsToRecurse = array(); $all = opendir($location); while ($file = readdir($all)) { if (is_dir("{$location}/{$file}") && $file != ".." && $file != ".") { $dirsToRecurse[] = "{$location}/{$file}"; } elseif (!is_dir("{$location}/{$file}")) { if (file_exists("{$location}/{$file}")) { unlink("{$location}/{$file}"); } unset($file); } } closedir($all); foreach ($dirsToRecurse as $recurse) { $this->deldir($recurse, $repoData); } rmdir($location); } else { if (file_exists("{$location}")) { $test = @unlink("{$location}"); if (!$test) { throw new Exception("Cannot delete file " . $location); } } } if (isset($repoData["recycle"]) && basename(dirname($location)) == $repoData["recycle"]) { // DELETING FROM RECYCLE RecycleBinManager::deleteFromRecycle($location); } }
/** * @param $location * @param $repoData * @throws Exception */ protected function deldir($location, $repoData) { if (is_dir($location)) { AJXP_Controller::applyHook("node.before_path_change", array(new AJXP_Node($location))); $all = opendir($location); while ($file = readdir($all)) { if (is_dir("{$location}/{$file}") && $file != ".." && $file != ".") { $this->deldir("{$location}/{$file}", $repoData); if (file_exists("{$location}/{$file}")) { rmdir("{$location}/{$file}"); } unset($file); } elseif (!is_dir("{$location}/{$file}")) { if (file_exists("{$location}/{$file}")) { unlink("{$location}/{$file}"); } unset($file); } } closedir($all); rmdir($location); } else { if (file_exists("{$location}")) { AJXP_Controller::applyHook("node.before_path_change", array(new AJXP_Node($location))); $test = @unlink("{$location}"); if (!$test) { throw new Exception("Cannot delete file " . $location); } } } if (isset($repoData["recycle"]) && basename(dirname($location)) == $repoData["recycle"]) { // DELETING FROM RECYCLE RecycleBinManager::deleteFromRecycle($location); } }
function delete($selectedFiles, &$logMessages, $dir = "") { $mess = ConfService::getMessages(); $result = $this->listing($this->secureFtpPath($this->getPath() . $dir)); foreach ($selectedFiles as $selectedFile) { $data = ""; $selectedFile = basename($selectedFile); if ($selectedFile == "" || $selectedFile == DIRECTORY_SEPARATOR) { return $mess[120]; } if (array_key_exists($selectedFile, $result[0])) { $data = $result[0][$selectedFile]; $this->deldir($data['name'], $dir, $data['isDir']); if ($data['isDir']) { $logMessages[] = "{$mess['38']} " . SystemTextEncoding::toUTF8($selectedFile) . " {$mess['44']}."; } else { $logMessages[] = "{$mess['34']} " . SystemTextEncoding::toUTF8($selectedFile) . " {$mess['44']}."; } if (RecycleBinManager::currentLocationIsRecycle($dir)) { RecycleBinManager::deleteFromRecycle($selectedFile); } } else { $logMessages[] = $mess[100] . " " . SystemTextEncoding::toUTF8($selectedFile); continue; } } return null; }