Roxen.git
/
server
/
modules
/
examples
/
location.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/modules/examples/location.pike:1:
#include <module.h> inherit "module"; // All roxen modules must inherit module.pike
-
constant cvs_version = "$Id: location.pike,v 1.
2
2000/08/28
05
:
31
:
54
per
Exp $";
+
constant cvs_version = "$Id: location.pike,v 1.
3
2000/08/28
12
:
28
:
52
jhs
Exp $";
constant module_type = MODULE_LOCATION; constant module_name = "RefDoc for MODULE_LOCATION"; constant module_doc = "This module does nothing, but its inlined " "documentation gets imported into the roxen " "programmer manual. You really don't want to " "add this module to your virtual server, promise!"; // see common_api.pike for further explanations of the above constants void create()
Roxen.git/server/modules/examples/location.pike:117:
{ return ({ 0775, // mode ({ 17, -2 })[random(2)], // size/special 963331858, // atime 963331858, // mtime 963331858, // ctime 0, // uid 0 /* gid */ }); } // Of course, it's typically silly to return something like this.
-
string|void real_file( string path, RequestID id )
+
mapping(
string
:array(int)
|
Stat) find_dir_stat( string path, RequestID id );
+
//! Need not be implemented. The parameter `path' is the path to a
+
//! directory, `id' is the request information object and the returned
+
//! mapping contains all filenames in the directory mapped to Stat
+
//! objects (or arrays for pike 7.0) for the same files respectively.
+
//!
+
//! If this method is not implemented, the find_dir_stat function
+
//! inherited from <tt>module.pike</tt> maps the result of
+
//! <ref>find_dir()</ref> over <ref>stat_file()</ref> to produce the
+
//! same result. Providing your own find_dir_stat might be useful if
+
//! your module maps its files from a database, in which case you
+
//! would gain performance by using just one big query instead of
+
//! hordes of single-file queries.
+
+
string|
void real_file( string path, RequestID id )
;
//! This method translates the path of a file in the module's name //! space to the path to the file in the real file system. path //! is the path to the file in the module's name space, id is the //! request information object. //! //! If the file could not be found, or the file doesn't exist on a //! real file system, zero should be returned. Only location modules //! that access server files from a real file system need implement //! this method. See also the <ref>stat_file()</ref> method.
-
{}
+
array(string)|void find_dir( string path, RequestID id ) //! The find_dir() returns a directory listing; an array of strings //! containing the names of all files and directories in this //! directory. The path parameter is the path to the directory, in the //! module's name space, id is the request information object. //! //! This method is usually called because a previous call to //! find_file() returned that this path contained a directory and a //! directory type module is right now trying to create a directory //! listing of this directory. Note that it is possible that the //! find_dir() is called in several location modules, and that the //! actual directory listing shown to the user will be the //! concatenated result of all those calls. //! //! To find information about each entry in the returned array the //! <ref>stat_file()</ref> is used. { return allocate(random(47)+11, make_random_string)(4, 71); }