Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:832:   //! any above @[path]. (This is appropriate to use to get the   //! list of locks that need to be unlocked on DELETE.)   //!   //! @param exclude_shared   //! If @expr{1@} do not return shared locks that are held by users   //! other than the one the request is authenticated as. (This is   //! appropriate to get the list of locks that would conflict if the   //! current user were to make a shared lock.)   //!   //! @returns - //! Returns a multiset containing all applicable locks in + //! Returns a mapping containing all applicable locks in   //! this location module, or @expr{0@} (zero) if there are none.   //!   //! @note   //! @[DAVLock] objects may be created if the filesystem has some   //! persistent storage of them. The default implementation does not   //! store locks persistently.   //!   //! @note   //! The default implementation only handles the @expr{"DAV:write"@}   //! lock type. - multiset(DAVLock) find_locks(string path, + mapping(string:DAVLock) find_locks(string path,    int(-1..1) recursive,    int(0..1) exclude_shared,    RequestID id)   {    // Common case.    if (!sizeof(file_locks) && !sizeof(prefix_locks)) return 0;       TRACE_ENTER(sprintf("find_locks(%O, %O, %O, X)",    path, recursive, exclude_shared), this);       string rsc = resource_id (path, id);    -  multiset(DAVLock) locks = (<>); +  mapping(string:DAVLock) locks = ([]);    function(mapping(mixed:DAVLock):void) add_locks;       if (exclude_shared) {    mixed auth_user = authenticated_user_id (path, id);    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) {    foreach (sub_locks; string user; DAVLock lock)    if (user == auth_user ||    lock->lockscope == "DAV:exclusive") -  locks[lock] = 1; +  locks[lock->locktoken] = lock;    };    }    else    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) { -  locks |= mkmultiset (values (sub_locks)); +  locks |= mkmapping(values(sub_locks)->locktoken, +  values(sub_locks));    };       if (file_locks[rsc]) {    add_locks (file_locks[rsc]);    }       if (recursive >= 0) {    foreach(prefix_locks;    string prefix; mapping(mixed:DAVLock) sub_locks) {    if (has_prefix(rsc, prefix)) {