1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> |
---|
2 | <HTML> |
---|
3 | <HEAD> |
---|
4 | <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.17"> |
---|
5 | <TITLE>phpgwapi - VFS Class: Notes</TITLE> |
---|
6 | <LINK HREF="vfs-7.html" REL=next> |
---|
7 | <LINK HREF="vfs-5.html" REL=previous> |
---|
8 | <LINK HREF="vfs.html#toc6" REL=contents> |
---|
9 | </HEAD> |
---|
10 | <BODY> |
---|
11 | <A HREF="vfs-7.html">Next</A> |
---|
12 | <A HREF="vfs-5.html">Previous</A> |
---|
13 | <A HREF="vfs.html#toc6">Contents</A> |
---|
14 | <HR> |
---|
15 | <H2><A NAME="sec:notes"></A> <A NAME="s6">6.</A> <A HREF="vfs.html#toc6">Notes</A></H2> |
---|
16 | |
---|
17 | <H2><A NAME="sec:database"></A> <A NAME="ss6.1">6.1</A> <A HREF="vfs.html#toc6.1">Database</A> |
---|
18 | </H2> |
---|
19 | |
---|
20 | <P>Data about the files and directories within the virtual root |
---|
21 | is kept in the SQL database. Currently, this information includes:</P> |
---|
22 | <P> |
---|
23 | <UL> |
---|
24 | <LI>File ID (used internally, primary key for table)</LI> |
---|
25 | <LI>Owner ID (phpGW account_id)</LI> |
---|
26 | <LI>Created by ID (phpGW account_id)</LI> |
---|
27 | <LI>Modified by ID (phpGW account_id)</LI> |
---|
28 | <LI>Created (date)</LI> |
---|
29 | <LI>Modified (date)</LI> |
---|
30 | <LI>Size (bytes)</LI> |
---|
31 | <LI>MIME type</LI> |
---|
32 | <LI>Deleteable (Y/N/Other?)</LI> |
---|
33 | <LI>Comment</LI> |
---|
34 | <LI>App (appname of application that created the file)</LI> |
---|
35 | <LI>Directory (directory the file or directory is in)</LI> |
---|
36 | <LI>Name (name of file or directory)</LI> |
---|
37 | <LI>Link directory (if the file or directory is linked, what the |
---|
38 | actual directory is)</LI> |
---|
39 | <LI>Link name (if the file or directory is linked, what the actual |
---|
40 | name is)</LI> |
---|
41 | <LI>Version (numeric version of the file)</LI> |
---|
42 | </UL> |
---|
43 | </P> |
---|
44 | <P>The internal names of these (the database column names) are stored |
---|
45 | in the $GLOBALS['phpgw']->vfs->attributes |
---|
46 | array, which is useful for loops, and is guaranteed to be up-to-date.</P> |
---|
47 | <P>Note that no information is kept about files outside the virtual |
---|
48 | root. If a file is moved outside, all records of it are deleted from |
---|
49 | the database (other than the journaling records). If a file is moved |
---|
50 | into the virtual root, some information, specifically MIME-type, |
---|
51 | is not always stored in the database. The vital information has defaults: |
---|
52 | owner is based on where the file is being stored; size is correctly |
---|
53 | read; deleteable is set to Y.</P> |
---|
54 | <H2><A NAME="sec:acl_support"></A> <A NAME="ss6.2">6.2</A> <A HREF="vfs.html#toc6.2">ACL support</A> |
---|
55 | </H2> |
---|
56 | |
---|
57 | <P>ACL support is built into the VFS. vfs->acl_check () does |
---|
58 | the actual checking, and is called from all VFS functions as needed. |
---|
59 | If the file or directory sent to acl_check () doesn't exist, the |
---|
60 | permissions for the parent directory are used to determine access. |
---|
61 | ACL checking can be overridden at any time by setting vfs->override_acl. |
---|
62 | For example:</P> |
---|
63 | <P> |
---|
64 | <PRE> |
---|
65 | $GLOBALS['phpgw']->vfs->override_acl = 1; |
---|
66 | $GLOBALS['phpgw']->vfs->mkdir (array( |
---|
67 | 'string' => $GLOBALS['fakebase']. '/' . $group_array['account_name'], |
---|
68 | 'relatives' => array( |
---|
69 | RELATIVE_NONE |
---|
70 | ) |
---|
71 | )); |
---|
72 | $GLOBALS['phpgw']->vfs->override_acl = 0; |
---|
73 | </PRE> |
---|
74 | </P> |
---|
75 | <H2><A NAME="sec:function_aliases"></A> <A NAME="ss6.3">6.3</A> <A HREF="vfs.html#toc6.3">Function aliases</A> |
---|
76 | </H2> |
---|
77 | |
---|
78 | <P>You might have noticed there are some functions that just pass |
---|
79 | the arguments on to other functions. These are provided in part because |
---|
80 | of legacy and in part for convenience. You can use either. Here is |
---|
81 | the list (alias -> actual):</P> |
---|
82 | <P> |
---|
83 | <UL> |
---|
84 | <LI>copy -> cp</LI> |
---|
85 | <LI>move -> rm</LI> |
---|
86 | <LI>delete -> rm</LI> |
---|
87 | <LI>dir -> ls</LI> |
---|
88 | </UL> |
---|
89 | </P> |
---|
90 | <H2><A NAME="sec:fakebase"></A> <A NAME="ss6.4">6.4</A> <A HREF="vfs.html#toc6.4">Fakebase directory (changing /home)</A> |
---|
91 | </H2> |
---|
92 | |
---|
93 | <P>The old VFS was hard-coded to use '/home' as the fake base directory, |
---|
94 | even though the user never saw it. With the new system, crafty administrators |
---|
95 | may wish to change '/home' to something else, say '/users' or '/public_html'. |
---|
96 | The fake base directory name is stored in $GLOBALS['phpgw']->vfs->fakebase, |
---|
97 | and changing it will transparently change it throughout the VFS and |
---|
98 | all applications. However, this must be done <EM>before</EM> any data is in |
---|
99 | the VFS database. If you wish to change it afterwords, you'll have |
---|
100 | to manually update the database, replacing the old value with the |
---|
101 | new value. <EM>Application programmers need to recognize that /home is |
---|
102 | not absolute, and use $GLOBALS['phpgw']->vfs->fakebase |
---|
103 | instead</EM>. I suggest setting $fakebase = $GLOBALS['phpgw']->vfs->fakebase; |
---|
104 | right off the bat to keep things neater.</P> |
---|
105 | <HR> |
---|
106 | <A HREF="vfs-7.html">Next</A> |
---|
107 | <A HREF="vfs-5.html">Previous</A> |
---|
108 | <A HREF="vfs.html#toc6">Contents</A> |
---|
109 | </BODY> |
---|
110 | </HTML> |
---|