HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //usr/src/corporate/for-upload/public/upgrade/scripts/Upgrade_0013.class.php
<?php

  /**
   * Update activeCollab 2.1.1 to activeCollab 2.1.2
   *
   * @package activeCollab.upgrade
   * @subpackage scripts
   */
  class Upgrade_0013 extends UpgradeScript {
    
    /**
     * Initial system version
     *
     * @var string
     */
    var $from_version = '2.1.1';
    
    /**
     * Final system version
     *
     * @var string
     */
    var $to_version = '2.1.2';
    
    /**
     * Return script actions
     *
     * @param void
     * @return array
     */
    function getActions() {
    	return array(
    	  'updateAttachmentParentType' => 'Update attachment parent types',
    	);
    } // getActions
    
    /**
     * Update parent type for old first discussion comments to Discussion
     *
     * @param void
     * @return boolean
     */
    function updateAttachmentParentType() {
      $rows = $this->utility->db->execute('SELECT id FROM ' . TABLE_PREFIX . 'project_objects WHERE type = ?', array('Discussion'));
      if(is_foreachable($rows)) {
        $discussion_ids = array();
        foreach($rows as $row) {
          $discussion_ids[] = (integer) $row['id'];
        } // foreach
        
        $this->utility->db->execute('UPDATE ' . TABLE_PREFIX . 'attachments SET parent_type = ? WHERE parent_id IN (?)', array('Discussion', $discussion_ids));
      } // if
      
      return true;
    } // updateExistingTables
    
  }

?>