1 | <?php |
||
24 | class Locator { |
||
25 | |||
26 | /** |
||
27 | * absolute path to ownCloud root |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $owncloudRootPath; |
||
31 | |||
32 | /** |
||
33 | * absolute path to updater root |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $updaterRootPath; |
||
37 | |||
38 | /** |
||
39 | * |
||
40 | * @param string $baseDir |
||
41 | */ |
||
42 | public function __construct($baseDir){ |
||
46 | |||
47 | public function getOwncloudRootPath(){ |
||
50 | |||
51 | /** |
||
52 | * expected items in the core |
||
53 | * @return array |
||
54 | */ |
||
55 | public function getRootDirContent(){ |
||
56 | return [ |
||
57 | "config/config.sample.php", |
||
58 | "core", |
||
59 | "l10n", |
||
60 | "lib", |
||
61 | "ocs", |
||
62 | "ocs-provider", |
||
63 | "resources", |
||
64 | "settings", |
||
65 | ".htaccess", |
||
66 | ".mailmap", |
||
67 | ".tag", |
||
68 | ".user.ini", |
||
69 | "AUTHORS", |
||
70 | "console.php", |
||
71 | "COPYING-AGPL", |
||
72 | "cron.php", |
||
73 | "db_structure.xml", |
||
74 | "index.html", |
||
75 | "index.php", |
||
76 | "indie.json", |
||
77 | "occ", |
||
78 | "public.php", |
||
79 | "remote.php", |
||
80 | "robots.txt", |
||
81 | "status.php", |
||
82 | "version.php" |
||
83 | ]; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Absolute path to core root dir content |
||
88 | * @return array |
||
89 | */ |
||
90 | public function getRootDirItems(){ |
||
91 | $items = $this->getRootDirContent(); |
||
92 | $items = array_map( |
||
93 | function($item){ return $this->owncloudRootPath . "/" . $item; }, |
||
94 | $items |
||
95 | ); |
||
96 | return $items; |
||
97 | } |
||
98 | |||
99 | public function getDataDir(){ |
||
102 | |||
103 | public function getCheckpointDir(){ |
||
106 | |||
107 | public function getDownloadBaseDir(){ |
||
110 | |||
111 | public function getExtractionBaseDir(){ |
||
114 | |||
115 | /** |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getPathToOccFile(){ |
||
122 | |||
123 | /** |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getInstalledVersion(){ |
||
128 | include $this->getPathToVersionFile(); |
||
129 | |||
130 | /** @var $OC_Version string */ |
||
131 | return $OC_Version; |
||
|
|||
132 | } |
||
133 | |||
134 | /** |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | public function getBuild(){ |
||
139 | include $this->getPathToVersionFile(); |
||
140 | |||
141 | /** @var $OC_Build string */ |
||
142 | return $OC_Build; |
||
143 | } |
||
144 | |||
145 | public function getPathtoConfigFiles($filePostfix = 'config.php'){ |
||
146 | // Only config.php for now |
||
147 | return [ |
||
148 | $this->owncloudRootPath . '/config/' . $filePostfix |
||
149 | ]; |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getPathToVersionFile(){ |
||
159 | |||
160 | } |
||
161 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.