-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypo3-upgrade.php
executable file
·50 lines (38 loc) · 1.45 KB
/
typo3-upgrade.php
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
#!/usr/bin/env php
<?php
namespace SourceBroker\Typo3Upgrade;
// define root path (one dir up)
$typo3RootDir = realpath(getcwd()) . '/';
define('T3U_TYPO3_DIR', $typo3RootDir);
$upgradeDir = realpath( __DIR__ . '/../../..');
define('T3U_UPGRADE_DIR', $upgradeDir);
require_once(__DIR__ . '/../../autoload.php');
// cleanup opcache
clearCache();
// get composer and run initial install
if (!file_exists('composer.phar')) {
copy('https://getcomposer.org/installer', 'composer-setup.php');
exec('php composer-setup.php');
unlink('composer-setup.php');
}
$instance = getCurrentInstance();
$upgradeBranches = getUpgradeBranches();
$isFirst = true;
foreach ($upgradeBranches as $numericVersion => $branch) {
run('echo "---------------------- git checkout ' . $branch . '"');
run('git reset --hard');
run('git checkout ' . $branch);
run('rm -rf typo3_src typo3 index.php typo3conf/ext typo3temp vendor typo3conf/realurl_autoconf.php');
run('git reset --hard');
clearCache();
run('php composer.phar install');
clearCache();
run('./vendor/bin/typo3cms database:updateschema "*.add,*.change"');
if (!$isFirst) {
run('./vendor/bin/typo3cms upgrade:all');
}
dbUpdate(__DIR__ . '/sql/' . $numericVersion . '.sql');
dbUpdate(T3U_UPGRADE_DIR . '/config/project/'. $numericVersion . '.sql');
dbUpdate(T3U_UPGRADE_DIR . '/config/instances/' . $instance . '/' . $numericVersion . '.sql');
$isFirst = false;
}