public function run28Update()
{
// Database changes
$this->Database->query("ALTER TABLE `tl_layout` ADD `script` text NULL");
$this->Database->query("ALTER TABLE `tl_member` ADD `dateAdded` int(10) unsigned NOT NULL default '0'");
$this->Database->query("ALTER TABLE `tl_member` ADD `currentLogin` int(10) unsigned NOT NULL default '0'");
$this->Database->query("ALTER TABLE `tl_member` ADD `lastLogin` int(10) unsigned NOT NULL default '0'");
$this->Database->query("ALTER TABLE `tl_user` ADD `dateAdded` int(10) unsigned NOT NULL default '0'");
$this->Database->query("ALTER TABLE `tl_user` ADD `currentLogin` int(10) unsigned NOT NULL default '0'");
$this->Database->query("ALTER TABLE `tl_user` ADD `lastLogin` int(10) unsigned NOT NULL default '0'");
$this->Database->query("ALTER TABLE `tl_comments` ADD `source` varchar(32) NOT NULL default ''");
$this->Database->query("ALTER TABLE `tl_comments` ADD KEY `source` (`source`)");
$this->Database->query("ALTER TABLE `tl_layout` CHANGE `mootools` `mootools` text NULL");
$this->Database->query("ALTER TABLE `tl_comments` CHANGE `pid` `parent` int(10) unsigned NOT NULL default '0'");
$this->Database->query("UPDATE tl_member SET dateAdded=tstamp, currentLogin=tstamp");
$this->Database->query("UPDATE tl_user SET dateAdded=tstamp, currentLogin=tstamp");
$this->Database->query("UPDATE tl_layout SET mootools='moo_accordion' WHERE mootools='moo_default'");
$this->Database->query("UPDATE tl_comments SET source='tl_content'");
$this->Database->query("UPDATE tl_module SET cal_format='next_365', type='eventlist' WHERE type='upcoming_events'");
// Get all front end groups
$objGroups = $this->Database->execute("SELECT id FROM tl_member_group");
$strGroups = serialize($objGroups->fetchEach('id'));
// Update protected elements
$this->Database->prepare("UPDATE tl_page SET groups=? WHERE protected=1 AND groups=''")->execute($strGroups);
$this->Database->prepare("UPDATE tl_content SET groups=? WHERE protected=1 AND groups=''")->execute($strGroups);
$this->Database->prepare("UPDATE tl_module SET groups=? WHERE protected=1 AND groups=''")->execute($strGroups);
// Update layouts
$objLayout = $this->Database->execute("SELECT id, mootools FROM tl_layout");
while ($objLayout->next()) {
$mootools = array('moo_mediabox');
if ($objLayout->mootools != '') {
$mootools[] = $objLayout->mootools;
}
$this->Database->prepare("UPDATE tl_layout SET mootools=? WHERE id=?")->execute(serialize($mootools), $objLayout->id);
}
// Update event reader
if (!file_exists(TL_ROOT . '/templates/event_default.tpl')) {
$this->Database->execute("UPDATE tl_module SET cal_template='event_full' WHERE cal_template='event_default'");
}
// News comments
$objComment = $this->Database->execute("SELECT * FROM tl_news_comments");
while ($objComment->next()) {
$arrSet = $objComment->row();
$arrSet['source'] = 'tl_news';
$arrSet['parent'] = $arrSet['pid'];
unset($arrSet['id']);
unset($arrSet['pid']);
$this->Database->prepare("INSERT INTO tl_comments %s")->set($arrSet)->execute();
}
// Delete system/modules/news/Comments.php
$this->import('Files');
$this->Files->delete('system/modules/news/Comments.php');
}