Navigation Menu

Skip to content

Commit

Permalink
Removed any reference to MyISAM and explicitly set InnoDB as the engi…
Browse files Browse the repository at this point in the history
…ne when connecting.
  • Loading branch information
Rowan Lewis authored and brendo committed Jun 28, 2016
1 parent f731cc9 commit fa0602b
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 62 deletions.
40 changes: 20 additions & 20 deletions install/includes/install.sql
Expand Up @@ -16,7 +16,7 @@ CREATE TABLE `tbl_authors` (
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_cache` ***
DROP TABLE IF EXISTS `tbl_cache`;
Expand All @@ -30,7 +30,7 @@ CREATE TABLE `tbl_cache` (
PRIMARY KEY (`id`),
UNIQUE KEY `hash` (`hash`),
KEY `expiry` (`expiry`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_entries` ***
DROP TABLE IF EXISTS `tbl_entries`;
Expand All @@ -49,7 +49,7 @@ CREATE TABLE `tbl_entries` (
KEY `creation_date_gmt` (`creation_date_gmt`),
KEY `modification_date` (`modification_date`),
KEY `modification_date_gmt` (`modification_date_gmt`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_extensions` ***
DROP TABLE IF EXISTS `tbl_extensions`;
Expand All @@ -60,7 +60,7 @@ CREATE TABLE `tbl_extensions` (
`version` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_extensions_delegates` ***
DROP TABLE IF EXISTS `tbl_extensions_delegates`;
Expand All @@ -75,7 +75,7 @@ CREATE TABLE `tbl_extensions_delegates` (
KEY `extension_id` (`extension_id`),
KEY `page` (`page`),
KEY `delegate` (`delegate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields` ***
DROP TABLE IF EXISTS `tbl_fields`;
Expand All @@ -91,7 +91,7 @@ CREATE TABLE `tbl_fields` (
`show_column` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no',
PRIMARY KEY (`id`),
KEY `index` (`element_name`,`type`,`parent_section`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_author` ***
DROP TABLE IF EXISTS `tbl_fields_author`;
Expand All @@ -103,7 +103,7 @@ CREATE TABLE `tbl_fields_author` (
`author_types` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_checkbox` ***
DROP TABLE IF EXISTS `tbl_fields_checkbox`;
Expand All @@ -114,7 +114,7 @@ CREATE TABLE `tbl_fields_checkbox` (
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_date` ***
DROP TABLE IF EXISTS `tbl_fields_date`;
Expand All @@ -126,7 +126,7 @@ CREATE TABLE `tbl_fields_date` (
`time` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_input` ***
DROP TABLE IF EXISTS `tbl_fields_input`;
Expand All @@ -136,7 +136,7 @@ CREATE TABLE `tbl_fields_input` (
`validator` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_select` ***
DROP TABLE IF EXISTS `tbl_fields_select`;
Expand All @@ -149,7 +149,7 @@ CREATE TABLE `tbl_fields_select` (
`dynamic_options` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_taglist` ***
DROP TABLE IF EXISTS `tbl_fields_taglist`;
Expand All @@ -161,7 +161,7 @@ CREATE TABLE `tbl_fields_taglist` (
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`),
KEY `pre_populate_source` (`pre_populate_source`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_textarea` ***
DROP TABLE IF EXISTS `tbl_fields_textarea`;
Expand All @@ -172,7 +172,7 @@ CREATE TABLE `tbl_fields_textarea` (
`size` int(3) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_fields_upload` ***
DROP TABLE IF EXISTS `tbl_fields_upload`;
Expand All @@ -183,7 +183,7 @@ CREATE TABLE `tbl_fields_upload` (
`validator` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_forgotpass` ***
DROP TABLE IF EXISTS `tbl_forgotpass`;
Expand All @@ -192,7 +192,7 @@ CREATE TABLE `tbl_forgotpass` (
`token` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
`expiry` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_pages` ***
DROP TABLE IF EXISTS `tbl_pages`;
Expand All @@ -208,7 +208,7 @@ CREATE TABLE `tbl_pages` (
`sortorder` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `parent` (`parent`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_pages_types` ***
DROP TABLE IF EXISTS `tbl_pages_types`;
Expand All @@ -218,7 +218,7 @@ CREATE TABLE `tbl_pages_types` (
`type` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `page_id` (`page_id`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_sections` ***
DROP TABLE IF EXISTS `tbl_sections`;
Expand All @@ -232,7 +232,7 @@ CREATE TABLE `tbl_sections` (
`navigation_group` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Content',
PRIMARY KEY (`id`),
UNIQUE KEY `handle` (`handle`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_sections_association` ***
DROP TABLE IF EXISTS `tbl_sections_association`;
Expand All @@ -247,7 +247,7 @@ CREATE TABLE `tbl_sections_association` (
`editor` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `parent_section_id` (`parent_section_id`,`child_section_id`,`child_section_field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);

-- *** STRUCTURE: `tbl_sessions` ***
DROP TABLE IF EXISTS `tbl_sessions`;
Expand All @@ -257,4 +257,4 @@ CREATE TABLE `tbl_sessions` (
`session_data` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`session`),
KEY `session_expires` (`session_expires`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
);
6 changes: 1 addition & 5 deletions symphony/lib/toolkit/class.database.php
Expand Up @@ -584,11 +584,7 @@ public function query($query, array $params = array(), array $values = array())
$query_type = $this->determineQueryType(trim($query));
$query_hash = md5($query.$start);

// TYPE is deprecated since MySQL 4.0.18, ENGINE is preferred
if($query_type == self::__WRITE_OPERATION__) {
$query = preg_replace('/TYPE=(MyISAM|InnoDB)/i', 'ENGINE=$1', $query);
}
else if($query_type == self::__READ_OPERATION__ && !preg_match('/^\s*SELECT\s+SQL(_NO)?_CACHE/i', $query)){
if($query_type == self::__READ_OPERATION__ && !preg_match('/^\s*SELECT\s+SQL(_NO)?_CACHE/i', $query)){
if($this->isCachingEnabled()) {
$query = preg_replace('/^\s*SELECT\s+/i', 'SELECT SQL_CACHE ', $query);
}
Expand Down
4 changes: 2 additions & 2 deletions symphony/lib/toolkit/class.field.php
Expand Up @@ -1208,7 +1208,7 @@ public function fetchFilterableOperators()
}

/**
* Returns the types of filter suggestion this field supports.
* Returns the types of filter suggestion this field supports.
* The array may contain the following values:
*
* - `entry` for searching entries in the current section
Expand Down Expand Up @@ -1610,7 +1610,7 @@ public function createTable()
PRIMARY KEY (`id`),
KEY `entry_id` (`entry_id`),
KEY `value` (`value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
);"
);
}

Expand Down
43 changes: 16 additions & 27 deletions symphony/lib/toolkit/class.mysql.php
Expand Up @@ -185,26 +185,24 @@ public static function isLoggingEnabled()
*/
public function connect($host = null, $user = null, $password = null, $port = '3306', $database = null)
{
$options = array(
//PDO::ATTR_ORACLE_NULLS => PDO::NULL_EMPTY_STRING
);
$config = array(
'driver' => 'mysql',
'db' => $database,
'host' => $host,
'port' => $port,
'user' => $user,
'password' => $password,
'charset' => 'utf8'
);

if(PHP_VERSION_ID <= 50306 && $config['driver'] == 'mysql') {
$options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES '" . $config['charset'] . "'";
}
$config = [
'driver' => 'mysql',
'db' => $database,
'host' => $host,
'port' => $port,
'user' => $user,
'password' => $password,
'charset' => 'utf8',
'options' => [
// PDO::ATTR_ORACLE_NULLS => PDO::NULL_EMPTY_STRING
]
];

$config['options'] = $options;
MySQL::$_conn_pdo = new Database($config);

// Ensure that the default storage engine is InnoDB:
MySQL::$_conn_pdo->conn->exec('SET storage_engine = "InnoDB"');

return true;
}

Expand Down Expand Up @@ -691,21 +689,12 @@ public function getStatistics()
* @throws Exception
* @param string $sql
* A string containing SQL queries delimited by `;`
* @param boolean $force_engine
* If set to true, this will set MySQL's default storage engine to MyISAM.
* Defaults to false, which will use MySQL's default storage engine when
* tables don't explicitly define which engine they should be created with
* @return boolean
* If one of the queries fails, false will be returned and no further queries
* will be executed, otherwise true will be returned.
*/
public function import($sql, $force_engine = false)
public function import($sql)
{
if ($force_engine) {
// Silently attempt to change the storage engine. This prevents INNOdb errors.
$this->query('SET default_storage_engine = MYISAM');
}

if (empty($sql)) {
throw new Exception('The SQL string contains no queries.');
}
Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.author.php
Expand Up @@ -90,7 +90,7 @@ public function createTable()
PRIMARY KEY (`id`),
UNIQUE KEY `author` (`entry_id`, `author_id`),
KEY `author_id` (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.checkbox.php
Expand Up @@ -92,7 +92,7 @@ public function createTable()
PRIMARY KEY (`id`),
UNIQUE KEY `entry_id` (`entry_id`),
KEY `value` (`value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.date.php
Expand Up @@ -125,7 +125,7 @@ public function createTable()
UNIQUE KEY `entry_id` (`entry_id`),
KEY `value` (`value`),
KEY `date` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.input.php
Expand Up @@ -63,7 +63,7 @@ public function createTable()
UNIQUE KEY `entry_id` (`entry_id`),
KEY `handle` (`handle`),
KEY `value` (`value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.select.php
Expand Up @@ -116,7 +116,7 @@ public function createTable()
KEY `entry_id` (`entry_id`),
KEY `handle` (`handle`),
KEY `value` (`value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.taglist.php
Expand Up @@ -66,7 +66,7 @@ public function createTable()
KEY `entry_id` (`entry_id`),
KEY `handle` (`handle`),
KEY `value` (`value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.textarea.php
Expand Up @@ -44,7 +44,7 @@ public function createTable()
PRIMARY KEY (`id`),
UNIQUE KEY `entry_id` (`entry_id`),
FULLTEXT KEY `value` (`value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/fields/field.upload.php
Expand Up @@ -101,7 +101,7 @@ public function createTable()
UNIQUE KEY `entry_id` (`entry_id`),
KEY `file` (`file`),
KEY `mimetype` (`mimetype`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
)"
);
}

Expand Down

0 comments on commit fa0602b

Please sign in to comment.