When installing a component, if the sql file has a line starting with # the following statement will be ignored.
# Insert content history rows
INSERT INTO `#__content_types` (`type_title`, `type_alias`, `table`, `content_history_options`)
...
The issue is in splitSql()
method of JDatabaseDriver
. where both lines are returned as a single one. After spliting, there is a check to ignore comments, so the entire line (comment and insert) is skipped.
// Create an array of queries from the sql file
$queries = JDatabaseDriver::splitSql($buffer);
if (count($queries) == 0)
{
// No queries to process
return 0;
}
// Process each query in the $queries array (split out of sql file).
foreach ($queries as $query)
{
$query = trim($query);
if ($query != '' && $query{0} != '#')
{
$db->setQuery($query);
if (!$db->execute())
{
JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)), JLog::WARNING, 'jerror');
return false;
}
}
}
Labels |
Added:
?
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-02-16 18:01:53 |
Closed_By | ⇒ | brianteeman |
Closing as we have a PR #9137
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9008.