-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.ext_update.php
More file actions
50 lines (42 loc) · 1.13 KB
/
class.ext_update.php
File metadata and controls
50 lines (42 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
class ext_update {
private $version;
public function __construct() {
$this->version = $this->getVersion();
}
public function main() {
list($major, $minor, $fix) = $this->version;
if ($major == '2' ) {
return $this->migrate();
} else {
return "Version mismatch, expected 2.1.x";
}
}
public function access() {
// allow access to update script only for version 2.1.x
list($major, $minor, $fix) = $this->version;
if ($major == '2')
return true;
else
return false;
}
private function migrate() {
list($major, $minor, $fix) = $this->version;
if ($major < '2' && $minor > '0') {
$db = $GLOBALS['TYPO3_DB'];
return "no update";
}
}
private function getVersion() {
$_EXTKEY = 'tp3_businessview';
$path = PATH_site . 'typo3conf/ext/'.$_EXTKEY.'/ext_emconf.php';
if (file_exists($path)) {
$EM_CONF = NULL;
include $path;
if (is_array($EM_CONF[$_EXTKEY])) {
return explode('.', $EM_CONF[$_EXTKEY]['version']);
}
}
return false;
}
}