1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15:
16: 17: 18: 19: 20: 21: 22:
23: class cUpgradeJob_0006 extends cUpgradeJobAbstract {
24:
25: public $maxVersion = "4.9.0-beta1";
26:
27: const MODE = 0777;
28:
29: public function _execute() {
30:
31: global $cfg, $cfgClient;
32:
33: include_once($cfg['path']['contenido'] . 'includes/functions.file.php');
34:
35: if ($this->_setupType == 'upgrade') {
36:
37:
38: $clientCopyList = array(
39: 'layouts/' => 'data/layouts/',
40: 'logs/' => 'data/logs/',
41: 'version/' => 'data/version/',
42: 'data/config/config.php' => 'data/config/' . CON_ENVIRONMENT . '/config.php',
43: 'data/config/config.local.php' => 'data/config/' . CON_ENVIRONMENT . '/config.local.php',
44: 'data/config/config.after.php' => 'data/config/' . CON_ENVIRONMENT . '/config.after.php',
45: 'config.php' => 'data/config/' . CON_ENVIRONMENT . '/config.php',
46: 'config.local.php' => 'data/config/' . CON_ENVIRONMENT . '/config.local.php',
47: 'config.after.php' => 'data/config/' . CON_ENVIRONMENT . '/config.after.php'
48: );
49:
50:
51: setupInitializeCfgClient();
52:
53: $allClients = $this->_getAllClients();
54:
55:
56: foreach ($allClients as $idclient => $oClient) {
57:
58: $configDir = $cfgClient[$idclient]['path']['frontend'] . 'data/config/' . CON_ENVIRONMENT;
59: if (!is_dir($configDir)) {
60: @mkdir($configDir, self::MODE, true);
61: }
62:
63: foreach ($clientCopyList as $src => $dst) {
64: $source = $cfgClient[$idclient]['path']['frontend'] . $src;
65: $destination = $cfgClient[$idclient]['path']['frontend'] . $dst;
66: if (is_dir($source)) {
67: if (!is_dir($destination)) {
68: @mkdir($destination, self::MODE, true);
69: }
70: if (!is_dir($destination)) {
71: logSetupFailure("Couldn't create client data directory $destination");
72: continue;
73: }
74:
75: cDirHandler::recursiveCopy($source, $destination, self::MODE);
76: } elseif (cFileHandler::exists($source) && cFileHandler::exists($destination)) {
77: if (cFileHandler::move($source, $destination)) {
78: cFileHandler::chmod($destination, self::MODE);
79: } else {
80: logSetupFailure("Couldn't copy client file $source");
81: }
82: }
83: }
84: }
85: }
86: }
87:
88: }
89: