<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * ExpressionEngine - by EllisLab
 *
 * @package		ExpressionEngine
 * @author		ExpressionEngine Dev Team
 * @copyright	Copyright (c) 2003 - 2011, EllisLab, Inc.
 * @license		http://expressionengine.com/user_guide/license.html
 * @link		http://expressionengine.com
 * @since		Version 2.0
 * @filesource
 */
 
// ------------------------------------------------------------------------

/**
 * ExpressionEngine Update Class
 *
 * @package		ExpressionEngine
 * @subpackage	Core
 * @category	Core
 * @author		ExpressionEngine Dev Team
 * @link		http://expressionengine.com
 */
class Updater {

	function Updater()
	{
		$this->EE =& get_instance();
	}

	function do_update()
	{		
        $Q[] = "INSERT INTO exp_actions (class, method) VALUES ('Channel', 'insert_new_entry')";

        $DB->fetch_fields = TRUE;
        $query = $this->EE->db->query("SELECT * FROM exp_member_groups");
        $flag = FALSE;
        
		foreach ($query->fields as $field)
		{
			if ($field == 'can_assign_post_authors')
			{
				$flag = TRUE;
			}		
		}
        
        if ($flag == FALSE)
        {
			$Q[] = "ALTER TABLE exp_member_groups ADD COLUMN can_assign_post_authors char(1) NOT NULL default 'n'";
		}
       
		$Q[] = "ALTER TABLE exp_weblogs ADD COLUMN trackback_system_enabled char(1) NOT NULL default 'y'";
	
		// Run the queries
		
		foreach ($Q as $sql)
		{
			$this->EE->db->query($sql);
		}
	
		/** -----------------------------------------
		/**  Update config file with new prefs
		/** -----------------------------------------*/
		
		$data = array(
                    		'max_tmpl_revisions' => '',
                    		'captcha_rand' 		=> 'n',
                    		'remap_pm_urls'		=> 'n',
                    		'remap_pm_dest'		=> '',
            				/* REMOVED */
                    		'max_referrers'		=> '500'
					);
													
		$this->EE->config->_append_config_1x($data);
		
		return TRUE;
	}
	
		
}	
// END CLASS




/* End of file ud_121.php */
/* Location: ./system/expressionengine/installer/updates/ud_121.php */