Ejemplo n.º 1
0
 /**
  * Get the DCA table settings from the DCA cache
  * 
  * @return array An array of DCA table settings
  */
 protected function getFromDca()
 {
     $arrReturn = array();
     $arrTables = \DcaExtractor::createAllExtracts();
     foreach ($arrTables as $strTable => $objTable) {
         $arrReturn[$strTable] = $objTable->getDbInstallerArray();
     }
     return $arrReturn;
 }
Ejemplo n.º 2
0
 /**
  * Version 3.0.0 update
  */
 public function run300Update()
 {
     // Create the files table
     $this->Database->query("CREATE TABLE `tl_files` (\n\t\t\t  `id` int(10) unsigned NOT NULL auto_increment,\n\t\t\t  `pid` int(10) unsigned NOT NULL default '0',\n\t\t\t  `tstamp` int(10) unsigned NOT NULL default '0',\n\t\t\t  `type` varchar(16) NOT NULL default '',\n\t\t\t  `path` varchar(255) NOT NULL default '',\n\t\t\t  `extension` varchar(16) NOT NULL default '',\n\t\t\t  `hash` varchar(32) NOT NULL default '',\n\t\t\t  `found` char(1) NOT NULL default '1',\n\t\t\t  `name` varchar(64) NOT NULL default '',\n\t\t\t  `meta` blob NULL,\n\t\t\t  PRIMARY KEY  (`id`),\n\t\t\t  KEY `pid` (`pid`),\n\t\t\t  UNIQUE KEY `path` (`path`),\n\t\t\t  KEY `extension` (`extension`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
     // Create the DCA extracts (will also create the DCA cache)
     \DcaExtractor::createAllExtracts();
     // Add the "numberOfItems" field
     $this->Database->query("ALTER TABLE `tl_module` ADD `numberOfItems` smallint(5) unsigned NOT NULL default '0'");
     $this->Database->query("UPDATE `tl_module` SET `numberOfItems`=`rss_numberOfItems` WHERE `rss_numberOfItems`>0");
     $this->Database->query("UPDATE `tl_module` SET `numberOfItems`=`news_numberOfItems` WHERE `news_numberOfItems`>0");
     // Add the "addMooTools" field
     $this->Database->query("ALTER TABLE `tl_layout` ADD `addMooTools` char(1) NOT NULL default ''");
     $this->Database->query("UPDATE `tl_layout` SET `addMooTools`=1 WHERE `mootools`!=''");
     // Add the "notified" field
     $this->Database->query("ALTER TABLE `tl_comments` ADD `notified` char(1) NOT NULL default ''");
     $this->Database->query("UPDATE `tl_comments` SET `notified`=1");
     // Add the "rows" field
     $this->Database->query("ALTER TABLE `tl_layout` ADD `rows` varchar(8) NOT NULL default ''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='1rw' WHERE `header`='' AND `footer`=''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='2rwh' WHERE `header`!='' AND `footer`=''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='2rwf' WHERE `header`='' AND `footer`!=''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='3rw' WHERE `header`!='' AND `footer`!=''");
     // Update the "mooType" field
     $this->Database->query("UPDATE `tl_content` SET `mooType`='mooStart' WHERE `mooType`='start'");
     $this->Database->query("UPDATE `tl_content` SET `mooType`='mooStop' WHERE `mooType`='stop'");
     $this->Database->query("UPDATE `tl_content` SET `mooType`='mooSingle' WHERE `mooType`='single'");
     // Add the "framework" field
     $this->Database->query("ALTER TABLE `tl_layout` ADD `framework` varchar(255) NOT NULL default ''");
     $this->Database->query("UPDATE `tl_layout` SET `framework`='a:2:{i:0;s:10:\"layout.css\";i:1;s:11:\"tinymce.css\";}'");
     $this->Database->query("UPDATE `tl_layout` SET `framework`='a:1:{i:0;s:10:\"layout.css\";}' WHERE skipTinymce=1");
     // Make sure the "skipFramework" field exists (see #4624)
     if ($this->Database->fieldExists('skipFramework', 'tl_layout')) {
         $this->Database->query("UPDATE `tl_layout` SET `framework`='' WHERE skipFramework=1");
     }
     // Add the "ptable" field
     $this->Database->query("ALTER TABLE `tl_content` ADD ptable varchar(64) NOT NULL default ''");
     // Create a content element for each news article
     $objNews = $this->Database->execute("SELECT * FROM tl_news WHERE text!=''");
     while ($objNews->next()) {
         $this->createContentElement($objNews, 'tl_news', 'text');
     }
     // Create a content element for each event
     $objEvents = $this->Database->execute("SELECT * FROM tl_calendar_events WHERE details!=''");
     while ($objEvents->next()) {
         $this->createContentElement($objEvents, 'tl_calendar_events', 'details');
     }
     // Add an .htaccess file to the modules' html folders so they can be accessed via HTTP
     foreach (scan(TL_ROOT . '/system/modules') as $strFolder) {
         if (is_dir(TL_ROOT . '/system/modules/' . $strFolder) && is_dir(TL_ROOT . '/system/modules/' . $strFolder . '/html')) {
             if (!file_exists(TL_ROOT . '/system/modules/' . $strFolder . '/html/.htaccess')) {
                 $objFile = new \File('system/modules/' . $strFolder . '/html/.htaccess');
                 $objFile->write("order deny,allow\nallow from all");
                 $objFile->close();
             }
         }
     }
     // Convert the gradient angle syntax (see #4569)
     if ($this->Database->fieldExists('gradientAngle', 'tl_style')) {
         $objStyle = $this->Database->execute("SELECT id, gradientAngle FROM tl_style WHERE gradientAngle!=''");
         while ($objStyle->next()) {
             if (strpos($objStyle->gradientAngle, 'deg') !== false) {
                 $angle = abs(450 - intval($objStyle->gradientAngle)) % 360 . 'deg';
             } else {
                 switch ($objStyle->gradientAngle) {
                     case 'top':
                         $angle = 'to bottom';
                         break;
                     case 'right':
                         $angle = 'to left';
                         break;
                     case 'bottom':
                         $angle = 'to top';
                         break;
                     case 'left':
                         $angle = 'to right';
                         break;
                     case 'top left':
                         $angle = 'to bottom right';
                         break;
                     case 'top right':
                         $angle = 'to bottom left';
                         break;
                     case 'bottom left':
                         $angle = 'to top right';
                         break;
                     case 'bottom right':
                         $angle = 'to top left';
                         break;
                 }
             }
             $this->Database->prepare("UPDATE tl_style SET gradientAngle=? WHERE id=?")->execute($angle, $objStyle->id);
         }
     }
     // Make unlimited recurrences end on 2038-01-01 00:00:00 (see #4862)
     $this->Database->query("UPDATE `tl_calendar_events` SET `repeatEnd`=2145913200 WHERE `recurring`=1 AND `recurrences`=0");
 }
Ejemplo n.º 3
0
 /**
  * Version 3.0.0 update
  */
 public function run300Update()
 {
     // Create the files table
     $this->Database->query("CREATE TABLE `tl_files` (\n\t\t\t  `id` int(10) unsigned NOT NULL auto_increment,\n\t\t\t  `pid` int(10) unsigned NOT NULL default '0',\n\t\t\t  `tstamp` int(10) unsigned NOT NULL default '0',\n\t\t\t  `type` varchar(16) NOT NULL default '',\n\t\t\t  `path` varchar(255) NOT NULL default '',\n\t\t\t  `extension` varchar(16) NOT NULL default '',\n\t\t\t  `hash` varchar(32) NOT NULL default '',\n\t\t\t  `found` char(1) NOT NULL default '1',\n\t\t\t  `name` varchar(64) NOT NULL default '',\n\t\t\t  `meta` blob NULL,\n\t\t\t  PRIMARY KEY  (`id`),\n\t\t\t  KEY `pid` (`pid`),\n\t\t\t  KEY `path` (`path`),\n\t\t\t  KEY `extension` (`extension`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
     // Create the DCA extracts (will also create the DCA cache)
     \DcaExtractor::createAllExtracts();
     // Add the "numberOfItems" field
     $this->Database->query("ALTER TABLE `tl_module` ADD `numberOfItems` smallint(5) unsigned NOT NULL default '0'");
     $this->Database->query("UPDATE `tl_module` SET `numberOfItems`=`rss_numberOfItems` WHERE `rss_numberOfItems`>0");
     $this->Database->query("UPDATE `tl_module` SET `numberOfItems`=`news_numberOfItems` WHERE `news_numberOfItems`>0");
     // Add the "addMooTools" field
     $this->Database->query("ALTER TABLE `tl_layout` ADD `addMooTools` char(1) NOT NULL default ''");
     $this->Database->query("UPDATE `tl_layout` SET `addMooTools`=1 WHERE `mooSource`!=''");
     // Add the "rows" field
     $this->Database->query("ALTER TABLE `tl_layout` ADD `rows` varchar(8) NOT NULL default ''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='1rw' WHERE `header`='' AND `footer`=''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='2rwh' WHERE `header`!='' AND `footer`=''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='2rwf' WHERE `header`='' AND `footer`!=''");
     $this->Database->query("UPDATE `tl_layout` SET `rows`='3rw' WHERE `header`!='' AND `footer`!=''");
 }