1 | <?php |
||
8 | class FileVersion extends DataObject |
||
9 | { |
||
10 | const VERSION_FOLDER = '_versions'; |
||
11 | |||
12 | private static $db = array( |
||
|
|||
13 | 'VersionNumber' => 'Int', |
||
14 | 'Filename' => 'Varchar(255)' |
||
15 | ); |
||
16 | |||
17 | private static $has_one = array( |
||
18 | 'Creator' => 'Member', |
||
19 | 'File' => 'File' |
||
20 | ); |
||
21 | |||
22 | /** |
||
23 | * Saves version meta-data, and generates the saved file version on first |
||
24 | * write. |
||
25 | */ |
||
26 | public function onBeforeWrite() |
||
50 | |||
51 | public function onBeforeDelete() |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getTitle() |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getName() |
||
77 | |||
78 | /** |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getURL() |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getFullPath() |
||
93 | |||
94 | /** |
||
95 | * Returns a Boolean object indicating if this version is currently active. |
||
96 | * |
||
97 | * @return Boolean |
||
98 | */ |
||
99 | public function IsCurrent() |
||
105 | |||
106 | /** |
||
107 | * Saves the current version of the linked File object in a versions |
||
108 | * directory, then returns the relative path to where it is stored. |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | protected function saveCurrentVersion() |
||
149 | } |
||
150 |