public function run29Update()
	{
		// Create the themes table
		$this->Database->query(
			"CREATE TABLE `tl_theme` (
			  `id` int(10) unsigned NOT NULL auto_increment,
			  `tstamp` int(10) unsigned NOT NULL default 0,
			  `name` varchar(128) NOT NULL default '',
			  `author` varchar(128) NOT NULL default '',
			  `screenshot` varchar(255) NOT NULL default '',
			  `folders` blob NULL,
			  `templates` varchar(255) NOT NULL default '',
			  PRIMARY KEY  (`id`)
			) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
		);

		// Add a PID column to the child tables
		$this->Database->query("ALTER TABLE `tl_module` ADD `pid` int(10) unsigned NOT NULL default 0");
		$this->Database->query("ALTER TABLE `tl_style_sheet` ADD `pid` int(10) unsigned NOT NULL default 0");
		$this->Database->query("ALTER TABLE `tl_layout` ADD `pid` int(10) unsigned NOT NULL default 0");
		$this->Database->query("UPDATE tl_module SET pid=1");
		$this->Database->query("UPDATE tl_style_sheet SET pid=1");
		$this->Database->query("UPDATE tl_layout SET pid=1");

		// Create a theme from the present resources
		$this->Database->prepare("INSERT INTO tl_theme SET tstamp=?, name=?")
					   ->execute(time(), 'Default');

		// Adjust the back end user permissions
		$this->Database->query("ALTER TABLE `tl_user` ADD `themes` blob NULL");
		$this->Database->query("ALTER TABLE `tl_user_group` ADD `themes` blob NULL");

		// Adjust the user and group rights
		$objUser = $this->Database->execute("SELECT id, modules, 'tl_user' AS tbl FROM tl_user WHERE modules!='' UNION SELECT id, modules, 'tl_user_group' AS tbl FROM tl_user_group WHERE modules!=''");

		while ($objUser->next())
		{
			$modules = StringUtil::deserialize($objUser->modules);

			if (empty($modules) || !\is_array($modules))
			{
				continue;
			}

			$themes = array();

			foreach ($modules as $k=>$v)
			{
				if ($v == 'css' || $v == 'modules ' || $v == 'layout')
				{
					$themes[] = $v;
					unset($modules[$k]);
				}
			}

			if (!empty($themes))
			{
				$modules[] = 'themes';
			}

			$modules = array_values($modules);

			$set = array
			(
				'modules' => (!empty($modules) ? serialize($modules) : null),
				'themes'  => (!empty($themes) ? serialize($themes) : null)
			);

			$this->Database->prepare("UPDATE " . $objUser->tbl . " %s WHERE id=?")
						   ->set($set)
						   ->execute($objUser->id);
		}

		// Featured news
		if ($this->Database->fieldExists('news_featured', 'tl_module'))
		{
			$this->Database->query("ALTER TABLE `tl_module` CHANGE `news_featured` `news_featured` varchar(16) NOT NULL default ''");
			$this->Database->query("UPDATE tl_module SET news_featured='featured' WHERE news_featured='1'");
		}

		// Other version 2.9 updates
		$this->Database->query("UPDATE tl_member SET country='gb' WHERE country='uk'");
		$this->Database->query("ALTER TABLE `tl_module` CHANGE `news_jumpToCurrent` `news_jumpToCurrent` varchar(16) NOT NULL default ''");
		$this->Database->query("UPDATE tl_module SET news_jumpToCurrent='show_current' WHERE news_jumpToCurrent=1");
		$this->Database->query("ALTER TABLE `tl_user` ADD `useCE` char(1) NOT NULL default ''");
		$this->Database->query("UPDATE tl_user SET useCE=1");
	}
public function run29Update()
	{
		
		$this->Database->query(
			"CREATE TABLE `tl_theme` (
			  `id` int(10) unsigned NOT NULL auto_increment,
			  `tstamp` int(10) unsigned NOT NULL default 0,
			  `name` varchar(128) NOT NULL default '',
			  `author` varchar(128) NOT NULL default '',
			  `screenshot` varchar(255) NOT NULL default '',
			  `folders` blob NULL,
			  `templates` varchar(255) NOT NULL default '',
			  PRIMARY KEY  (`id`)
			) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
		);

		
		$this->Database->query("ALTER TABLE `tl_module` ADD `pid` int(10) unsigned NOT NULL default 0");
		$this->Database->query("ALTER TABLE `tl_style_sheet` ADD `pid` int(10) unsigned NOT NULL default 0");
		$this->Database->query("ALTER TABLE `tl_layout` ADD `pid` int(10) unsigned NOT NULL default 0");
		$this->Database->query("UPDATE tl_module SET pid=1");
		$this->Database->query("UPDATE tl_style_sheet SET pid=1");
		$this->Database->query("UPDATE tl_layout SET pid=1");

		
		$this->Database->prepare("INSERT INTO tl_theme SET tstamp=?, name=?")
					   ->execute(time(), 'Default');

		
		$this->Database->query("ALTER TABLE `tl_user` ADD `themes` blob NULL");
		$this->Database->query("ALTER TABLE `tl_user_group` ADD `themes` blob NULL");

		
		$objUser = $this->Database->execute("SELECT id, modules, 'tl_user' AS tbl FROM tl_user WHERE modules!='' UNION SELECT id, modules, 'tl_user_group' AS tbl FROM tl_user_group WHERE modules!=''");

		while ($objUser->next())
		{
			$modules = StringUtil::deserialize($objUser->modules);

			if (empty($modules) || !\is_array($modules))
			{
				continue;
			}

			$themes = array();

			foreach ($modules as $k=>$v)
			{
				if ($v == 'css' || $v == 'modules ' || $v == 'layout')
				{
					$themes[] = $v;
					unset($modules[$k]);
				}
			}

			if (!empty($themes))
			{
				$modules[] = 'themes';
			}

			$modules = array_values($modules);

			$set = array
			(
				'modules' => (!empty($modules) ? serialize($modules) : null),
				'themes'  => (!empty($themes) ? serialize($themes) : null)
			);

			$this->Database->prepare("UPDATE " . $objUser->tbl . " %s WHERE id=?")
						   ->set($set)
						   ->execute($objUser->id);
		}

		
		if ($this->Database->fieldExists('news_featured', 'tl_module'))
		{
			$this->Database->query("ALTER TABLE `tl_module` CHANGE `news_featured` `news_featured` varchar(16) NOT NULL default ''");
			$this->Database->query("UPDATE tl_module SET news_featured='featured' WHERE news_featured='1'");
		}

		
		$this->Database->query("UPDATE tl_member SET country='gb' WHERE country='uk'");
		$this->Database->query("ALTER TABLE `tl_module` CHANGE `news_jumpToCurrent` `news_jumpToCurrent` varchar(16) NOT NULL default ''");
		$this->Database->query("UPDATE tl_module SET news_jumpToCurrent='show_current' WHERE news_jumpToCurrent=1");
		$this->Database->query("ALTER TABLE `tl_user` ADD `useCE` char(1) NOT NULL default ''");
		$this->Database->query("UPDATE tl_user SET useCE=1");
	}
public function run29Update ( ) { // Create the themes table $ this -> Database -> query ( "CREATE TABLE `tl_theme` (
			  `id` int(10) unsigned NOT NULL auto_increment,
			  `tstamp` int(10) unsigned NOT NULL default 0,
			  `name` varchar(128) NOT NULL default '',
			  `author` varchar(128) NOT NULL default '',
			  `screenshot` varchar(255) NOT NULL default '',
			  `folders` blob NULL,
			  `templates` varchar(255) NOT NULL default '',
			  PRIMARY KEY  (`id`)
			) ENGINE=MyISAM DEFAULT CHARSET=utf8;" ) ; // Add a PID column to the child tables $ this -> Database -> query ( "ALTER TABLE `tl_module` ADD `pid` int(10) unsigned NOT NULL default 0" ) ; $ this -> Database -> query ( "ALTER TABLE `tl_style_sheet` ADD `pid` int(10) unsigned NOT NULL default 0" ) ; $ this -> Database -> query ( "ALTER TABLE `tl_layout` ADD `pid` int(10) unsigned NOT NULL default 0" ) ; $ this -> Database -> query ( "UPDATE tl_module SET pid=1" ) ; $ this -> Database -> query ( "UPDATE tl_style_sheet SET pid=1" ) ; $ this -> Database -> query ( "UPDATE tl_layout SET pid=1" ) ; // Create a theme from the present resources $ this -> Database -> prepare ( "INSERT INTO tl_theme SET tstamp=?, name=?" ) -> execute ( time ( ) , 'Default' ) ; // Adjust the back end user permissions $ this -> Database -> query ( "ALTER TABLE `tl_user` ADD `themes` blob NULL" ) ; $ this -> Database -> query ( "ALTER TABLE `tl_user_group` ADD `themes` blob NULL" ) ; // Adjust the user and group rights $ objUser = $ this -> Database -> execute ( "SELECT id, modules, 'tl_user' AS tbl FROM tl_user WHERE modules!='' UNION SELECT id, modules, 'tl_user_group' AS tbl FROM tl_user_group WHERE modules!=''" ) ; while ( $ objUser -> next ( ) ) { $ modules = StringUtil :: deserialize ( $ objUser -> modules ) ; if ( empty ( $ modules ) || ! \ is_array ( $ modules ) ) { continue ; } $ themes = array ( ) ; foreach ( $ modules as $ k => $ v ) { if ( $ v == 'css' || $ v == 'modules ' || $ v == 'layout' ) { $ themes [ ] = $ v ; unset ( $ modules [ $ k ] ) ; } } if ( ! empty ( $ themes ) ) { $ modules [ ] = 'themes' ; } $ modules = array_values ( $ modules ) ; $ set = array ( 'modules' => ( ! empty ( $ modules ) ? serialize ( $ modules ) : null ) , 'themes' => ( ! empty ( $ themes ) ? serialize ( $ themes ) : null ) ) ; $ this -> Database -> prepare ( "UPDATE " . $ objUser -> tbl . " %s WHERE id=?" ) -> set ( $ set ) -> execute ( $ objUser -> id ) ; } // Featured news if ( $ this -> Database -> fieldExists ( 'news_featured' , 'tl_module' ) ) { $ this -> Database -> query ( "ALTER TABLE `tl_module` CHANGE `news_featured` `news_featured` varchar(16) NOT NULL default ''" ) ; $ this -> Database -> query ( "UPDATE tl_module SET news_featured='featured' WHERE news_featured='1'" ) ; } // Other version 2.9 updates $ this -> Database -> query ( "UPDATE tl_member SET country='gb' WHERE country='uk'" ) ; $ this -> Database -> query ( "ALTER TABLE `tl_module` CHANGE `news_jumpToCurrent` `news_jumpToCurrent` varchar(16) NOT NULL default ''" ) ; $ this -> Database -> query ( "UPDATE tl_module SET news_jumpToCurrent='show_current' WHERE news_jumpToCurrent=1" ) ; $ this -> Database -> query ( "ALTER TABLE `tl_user` ADD `useCE` char(1) NOT NULL default ''" ) ; $ this -> Database -> query ( "UPDATE tl_user SET useCE=1" ) ; }
Version 2.9.0 update
Version 2 . 9 . 0 update