Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • 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
  • cUpgradeJobAbstract
  • cUpgradeJobMain
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the upgrade job 7.
  4:  *
  5:  * @package    Setup
  6:  * @subpackage UpgradeJob
  7:  * @version    SVN Revision $Rev:$
  8:  *
  9:  * @author     Simon Sprankel
 10:  * @copyright  four for business AG <www.4fb.de>
 11:  * @license    http://www.contenido.org/license/LIZENZ.txt
 12:  * @link       http://www.4fb.de
 13:  * @link       http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Upgrade job 7.
 20:  * Runs the upgrade job to remove unused mail logging include files from the DB.
 21:  * Additionally, the used include file is renamed.
 22:  * Besides, the column idmail_resend is removed from the con_mail_log_success
 23:  * table.
 24:  *
 25:  * @package Setup
 26:  * @subpackage UpgradeJob
 27:  */
 28: class cUpgradeJob_0007 extends cUpgradeJobAbstract {
 29: 
 30:     public $maxVersion = "4.9.0-beta1";
 31: 
 32:     public function _execute() {
 33:         global $cfg, $db;
 34: 
 35:         if ($this->_setupType == 'upgrade') {
 36:             // get the IDs of the mail log areas
 37:             $areaItem = new cApiArea();
 38:             $areaItem->loadByMany(array(
 39:                 'parent_id' => '0',
 40:                 'name' => 'mail_log'
 41:             ));
 42:             $mainIdarea = $areaItem->get('idarea');
 43:             $areaItem->loadByMany(array(
 44:                 'parent_id' => 'mail_log',
 45:                 'name' => 'mail_log_overview'
 46:             ));
 47:             $overviewIdarea = $areaItem->get('idarea');
 48:             $areaItem->loadByMany(array(
 49:                 'parent_id' => 'mail_log',
 50:                 'name' => 'mail_log_detail'
 51:             ));
 52:             $detailIdarea = $areaItem->get('idarea');
 53: 
 54:             // delete the unused mail log include files and rename the used ones
 55:             $fileCollection = new cApiFileCollection();
 56:             $file = new cApiFile();
 57: 
 58:             // delete the include.mail_log.left_bottom.php entry
 59:             $file->loadByMany(array(
 60:                 'idarea' => $mainIdarea,
 61:                 'filename' => 'include.mail_log.left_bottom.php'
 62:             ));
 63:             if ($file->isLoaded()) {
 64:                 $fileCollection->delete($file->get('idfile'));
 65:             }
 66: 
 67:             // delete the include.mail_log.subnav.php entry
 68:             $file->loadByMany(array(
 69:                 'idarea' => $mainIdarea,
 70:                 'filename' => 'include.mail_log_subnav.php'
 71:             ));
 72:             if ($file->isLoaded()) {
 73:                 $fileCollection->delete($file->get('idfile'));
 74:             }
 75: 
 76:             // rename the include.mail_log.right_bottom.php entries to
 77:             // include.mail_log.php
 78:             $file->loadByMany(array(
 79:                 'idarea' => $mainIdarea,
 80:                 'filename' => 'include.mail_log.right_bottom.php'
 81:             ));
 82:             if ($file->isLoaded()) {
 83:                 $file->set('filename', 'include.mail_log.php');
 84:                 $file->store();
 85:             }
 86:             $file->loadByMany(array(
 87:                 'idarea' => $overviewIdarea,
 88:                 'filename' => 'include.mail_log.right_bottom.php'
 89:             ));
 90:             if ($file->isLoaded()) {
 91:                 $file->set('filename', 'include.mail_log.php');
 92:                 $file->store();
 93:             }
 94:             $file->loadByMany(array(
 95:                 'idarea' => $detailIdarea,
 96:                 'filename' => 'include.mail_log.right_bottom.php'
 97:             ));
 98:             if ($file->isLoaded()) {
 99:                 $file->set('filename', 'include.mail_log.php');
100:                 $file->store();
101:             }
102: 
103:             // remove the column idmail_resend from the table
104:             // con_mail_log_success if it exists
105:             $columns = array();
106:             $sql = 'SHOW COLUMNS FROM ' . $cfg['tab']['mail_log_success'];
107:             $db->query($sql);
108:             while ($db->nextRecord()) {
109:                 $columns[] = $db->f('Field');
110:             }
111:             if (in_array('idmail_resend', $columns)) {
112:                 $sql = 'ALTER TABLE `' . $cfg['tab']['mail_log_success'] . '` DROP `idmail_resend`';
113:                 $db->query($sql);
114:             }
115:         }
116:     }
117: 
118: }
119: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0