Example #1
0
         $frontend->Database->query('ALTER TABLE `tbl_cache` DROP INDEX `creation`');
         $frontend->Database->query('CREATE INDEX `expiry` ON `tbl_cache` (`expiry`)');
         $frontend->Database->query('OPTIMIZE TABLE `tbl_cache`');
     } catch (Exception $ex) {
     }
     // Remove Hide Association field from Select Data tables
     $select_tables = $frontend->Database->fetchCol("field_id", "SELECT `field_id` FROM `tbl_fields_select`");
     if (is_array($select_tables) && !empty($select_tables)) {
         foreach ($select_tables as $field) {
             if (tableContainsField('tbl_entries_data_' . $field, 'show_association')) {
                 $frontend->Database->query(sprintf("ALTER TABLE `tbl_entries_data_%d` DROP `show_association`", $field));
             }
         }
     }
     // Update Select table to include the sorting option
     if (!tableContainsField('tbl_fields_select', 'sort_options')) {
         $frontend->Database->query('ALTER TABLE `tbl_fields_select` ADD `sort_options` ENUM( "yes", "no" ) COLLATE utf8_unicode_ci NOT NULL DEFAULT "no"');
     }
     // Remove the 'driver' from the Config
     unset($settings['database']['driver']);
     writeConfig(DOCROOT . '/manifest', $settings, $settings['file']['write_mode']);
     // Remove the NOT NULL from the Author tables
     try {
         $author = $frontend->Database->fetchCol("field_id", "SELECT `field_id` FROM `tbl_fields_author`");
         foreach ($author as $id) {
             $table = '`tbl_entries_data_' . $id . '`';
             $frontend->Database->query('ALTER TABLE ' . $table . ' CHANGE `author_id` `author_id` int(11) unsigned NULL');
         }
     } catch (Exception $ex) {
     }
 }
Example #2
0
         $frontend->Database->query("ALTER TABLE `tbl_sections` ADD INDEX (`navigation_group`)");
     }
     // Added support for upload field to handle empty mimetypes.
     $upload_fields = $frontend->Database->fetch("SELECT id FROM tbl_fields WHERE `type` = 'upload'");
     foreach ($upload_fields as $upload_field) {
         $frontend->Database->query("ALTER TABLE `tbl_entries_data_{$upload_field['id']}` CHANGE `mimetype` `mimetype` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL");
     }
 }
 if (version_compare($existing_version, '2.0.4', '<=')) {
     $date_fields = $frontend->Database->fetch("SELECT id FROM tbl_fields WHERE `type` = 'date'");
     foreach ($date_fields as $field) {
         $frontend->Database->query("ALTER TABLE `tbl_entries_data_{$field['id']}` CHANGE `local` `local` INT(11) DEFAULT NULL;");
         $frontend->Database->query("ALTER TABLE `tbl_entries_data_{$field['id']}` CHANGE `gmt` `gmt` INT(11) DEFAULT NULL;");
     }
     // Update author field table to support the default value checkbox
     if (!tableContainsField('tbl_fields_author', 'default_to_current_user')) {
         $frontend->Database->query("ALTER TABLE `tbl_fields_author` ADD `default_to_current_user` ENUM('yes', 'no') NOT NULL");
     }
     ## Change .htaccess from `page` to `symphony-page`
     $htaccess = @file_get_contents(DOCROOT . '/.htaccess');
     if ($htaccess !== false) {
         $htaccess = str_replace('index.php?page=$1&%{QUERY_STRING}', 'index.php?symphony-page=$1&%{QUERY_STRING}', $htaccess);
         @file_put_contents(DOCROOT . '/.htaccess', $htaccess);
     }
 }
 if (version_compare($existing_version, '2.0.5', '<=')) {
     ## Rebuild the .htaccess here
     $rewrite_base = trim(dirname($_SERVER['PHP_SELF']), '/');
     if (strlen($rewrite_base) > 0) {
         $rewrite_base .= '/';
     }