Roxen.git / server / modules / filesystems / filesystem.pike

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1:   // This is a roxen module. Copyright © 1996 - 2001, Roxen IS.      // This is a virtual "file-system".   // It will be located somewhere in the name-space of the server.   // Also inherited by some of the other filesystems.      inherit "module";   inherit "socket";    - constant cvs_version= "$Id: filesystem.pike,v 1.126 2004/04/20 21:10:46 mast Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.127 2004/05/05 21:24:38 mast Exp $";   constant thread_safe=1;      #include <module.h>   #include <roxen.h>   #include <stat.h>   #include <request_trace.h>         //<locale-token project="mod_filesystem">LOCALE</locale-token>   #define LOCALE(X,Y) _DEF_LOCALE("mod_filesystem",X,Y)
Roxen.git/server/modules/filesystems/filesystem.pike:399:       dir = Array.filter(dir, dir_filter_function, id);       if (!id->misc->internal_get)    foreach (internal_files, string globstr)    dir -= glob (globstr, dir);       return dir;   }    - static MultiStatus recursive_rm(string real_dir, string relative_dir, -  RequestID id, MultiStatus|void result) + void recursive_rm(string real_dir, string virt_dir, +  RequestID id)   {    TRACE_ENTER(sprintf("Deleting all files in directory %O...", real_dir),    this_object());    foreach(get_dir(real_dir) || ({}), string fname) {    string real_fname = combine_path(real_dir, fname); -  string relative_fname = combine_path(relative_dir, fname); +  string virt_fname = virt_dir + "/" + fname;    Stat stat = file_stat(real_fname);    TRACE_ENTER(sprintf("Deleting file %O.", real_fname),    this_object());    if (!stat) { -  if (!result) { -  result = MultiStatus()->prefix(query_location()); -  } -  result->add_response(relative_fname, XMLStatusNode(404)); +  id->set_status_for_path(virt_fname, 404);    TRACE_LEAVE("File not found.");    continue;    }    if (stat->isdir) { -  result = recursive_rm(real_fname, relative_fname, id, result); +  recursive_rm(real_fname, virt_fname, id);    }       /* Clear the stat-cache for this file */    if (stat_cache) {    cache_set("stat_cache", real_fname, 0);    }       if (!rm(real_fname)) {   #if constant(System.EEXIST)    if (errno() != System.EEXIST)   #endif    { -  if (!result) { -  result = MultiStatus()->prefix(query_location()); -  } -  result->add_response(relative_fname, XMLStatusNode(403)); +  id->set_status_for_path(virt_fname, 403);    TRACE_LEAVE("Deletion failed.");    }   #if constant(System.EEXIST)    else {    TRACE_LEAVE("Directory not empty.");    }   #endif    } else {    deletes++;       if (id->misc->quota_obj && stat->isreg()) { -  id->misc->quota_obj->deallocate(combine_path(query_location(), -  relative_fname), +  id->misc->quota_obj->deallocate(virt_fname,    stat->size());    }    TRACE_LEAVE("Ok.");    }    }    TRACE_LEAVE("Done."); -  return result; +    }      mapping putting = ([]);      void done_with_put( array(object|string|int) id_arr )   {   // werror("Done with put.\n");    object to;    object from;    object id;
Roxen.git/server/modules/filesystems/filesystem.pike:1317:    return http_low_answer(400, "<h2>Unsupported depth.</h2>");    }       if (size < 0) {    report_notice(LOCALE(64,"DELETING the directory %s.\n"), f);       accesses++;       SETUID_TRACE("Deleting directory", 0);    -  MultiStatus result = recursive_rm(f, oldf, id); +  int start_ms_size = id->multi_status_size(); +  recursive_rm(f, query_location() + oldf, id);       if (!rm(f)) { -  if (result) { +  if (id->multi_status_size() > start_ms_size) {   #if constant(system.EEXIST)    if (errno() != system.EEXIST)   #endif    { -  result->add_response(oldf, XMLStatusNode(403)); +  id->set_status_for_path(query_location() + oldf, 403);    }    } else {    TRACE_LEAVE("DELETE: Failed to delete directory.");    return http_low_answer(403, "<h2>Failed to delete directory.</h2>");    }    }    -  if (result) { +  if (id->multi_status_size() > start_ms_size) {    TRACE_LEAVE("DELETE: Partial failure."); -  return result->http_answer(); +  return ([]);    }    } else {    report_notice(LOCALE(49,"DELETING the file %s.\n"),f);       accesses++;       SETUID_TRACE("Deleting file", 0);       /* Clear the stat-cache for this file */    if (stat_cache) {