Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cUpgradeJob_0001
  • cUpgradeJob_0002
  • cUpgradeJob_0003
  • cUpgradeJob_0004
  • cUpgradeJob_0005
  • cUpgradeJob_0006
  • cUpgradeJob_0007
  • cUpgradeJob_0008
  • cUpgradeJob_0009
  • cUpgradeJob_0010
  • cUpgradeJob_0011
  • cUpgradeJob_0012
  • cUpgradeJob_0013
  • cUpgradeJob_0014
  • cUpgradeJob_0015
  • cUpgradeJob_0016
  • cUpgradeJob_0017
  • cUpgradeJob_0018
  • cUpgradeJobAbstract
  • cUpgradeJobMain
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: /**
 3:  * This file contains the upgrade job 6.
 4:  *
 5:  * @package    Setup
 6:  * @subpackage UpgradeJob
 7:  * @author     Murat Purc <murat@purc>
 8:  * @copyright  four for business AG <www.4fb.de>
 9:  * @license    http://www.contenido.org/license/LIZENZ.txt
10:  * @link       http://www.4fb.de
11:  * @link       http://www.contenido.org
12:  */
13: 
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15: 
16: /**
17:  * Upgrade job 6.
18:  * Runs the upgrade job to move files/from old client folders to new client's data folders
19:  *
20:  * @package Setup
21:  * @subpackage UpgradeJob
22:  */
23: class cUpgradeJob_0006 extends cUpgradeJobAbstract {
24: 
25:     public $maxVersion = "4.9.0-beta1";
26: 
27:     /**
28:      * @throws cInvalidArgumentException
29:      */
30:     public function _execute() {
31: 
32:         global $cfg, $cfgClient;
33: 
34:         include_once($cfg['path']['contenido'] . 'includes/functions.file.php');
35: 
36:         if ($this->_setupType == 'upgrade') {
37: 
38:             // List of source and destination folder or files based on clients frontend dir.
39:             $clientCopyList = array(
40:                 'layouts/' => 'data/layouts/',
41:                 'logs/' => 'data/logs/',
42:                 'version/' => 'data/version/',
43:                 'data/config/config.php' => 'data/config/' . CON_ENVIRONMENT . '/config.php',
44:                 'data/config/config.local.php' => 'data/config/' . CON_ENVIRONMENT . '/config.local.php',
45:                 'data/config/config.after.php' => 'data/config/' . CON_ENVIRONMENT . '/config.after.php',
46:                 'config.php' => 'data/config/' . CON_ENVIRONMENT . '/config.php',
47:                 'config.local.php' => 'data/config/' . CON_ENVIRONMENT . '/config.local.php',
48:                 'config.after.php' => 'data/config/' . CON_ENVIRONMENT . '/config.after.php'
49:             );
50: 
51:             // Load client configuration
52:             setupInitializeCfgClient();
53: 
54:             $allClients = $this->_getAllClients();
55: 
56:             // Loop thru al clients and copy old data folder to new data folder
57:             foreach ($allClients as $idclient => $oClient) {
58:                 // check if config directory exists
59:                 $configDir = $cfgClient[$idclient]['path']['frontend'] . 'data/config/' . CON_ENVIRONMENT;
60:                 if (!is_dir($configDir)) {
61:                     @mkdir($configDir, cDirHandler::getDefaultPermissions(), true);
62:                 }
63: 
64:                 foreach ($clientCopyList as $src => $dst) {
65:                     $source = $cfgClient[$idclient]['path']['frontend'] . $src;
66:                     $destination = $cfgClient[$idclient]['path']['frontend'] . $dst;
67:                     if (is_dir($source)) {
68:                         if (!is_dir($destination)) {
69:                             @mkdir($destination, cDirHandler::getDefaultPermissions(), true);
70:                         }
71:                         if (!is_dir($destination)) {
72:                             logSetupFailure("Couldn't create client data directory $destination");
73:                             continue;
74:                         }
75: 
76:                         cDirHandler::recursiveCopy($source, $destination, cDirHandler::getDefaultPermissions());
77:                     } elseif (cFileHandler::exists($source) && cFileHandler::exists($destination)) {
78:                         if (cFileHandler::move($source, $destination)) {
79:                             cFileHandler::chmod($destination, cDirHandler::getDefaultPermissions());
80:                         } else {
81:                             logSetupFailure("Couldn't copy client file $source");
82:                         }
83:                     }
84:                 }
85:             }
86:         }
87:     }
88: 
89: }
90: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0