예제 #1
0
function _rmdir($pid)
{
    return _deleteDirectory($pid);
}
예제 #2
0
function kfm_deleteDirectory($id, $recursive = 0)
{
    include_once KFM_BASE_PATH . 'includes/directories.php';
    return _deleteDirectory($id, $recursive);
}
예제 #3
0
/**
 *		deleteFile
 *
 *				Delete a file.
 *
 *	@param	filePath				File path string
 *	@param	rootDir					Root directory
 *	@param	args						HTTP QUERY-STRING arguments decoded.
 *	@param	status					Receives the final result (200, 204 or 404).
 *
 *	@return		An array of FILE_INFO objects or NULL in case no match was found.
 **/
function deleteFile($filePath, $rootDir, $args, &$status)
{
    if (file_exists($filePath)) {
        $status = HTTP_V_OK;
        $files = array();
        $uri = parsePath($filePath, $rootDir);
        $fileInfo = fileToStruct($uri->dirPath, $rootDir, $uri->filename, $args);
        if (is_dir($filePath)) {
            $files = _deleteDirectory($filePath, $rootDir, $args, $stat);
            $result = rmdir($filePath);
        } else {
            chmod($filePath, 0666);
            $result = unlink($filePath);
        }
        if ($result) {
            $files[] = $fileInfo;
        } else {
            $status = HTTP_V_UNAUTHORIZED;
        }
        return $files;
    }
    $status = HTTP_V_NOT_FOUND;
    return null;
}