Skip to content

Commit

Permalink
Modified code to travis compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Uhl committed Aug 9, 2016
1 parent 03cca45 commit 22fcc21
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
11 changes: 4 additions & 7 deletions installation/model/database.php
Expand Up @@ -652,12 +652,7 @@ public function createTables($options)
}
}

/* in case the nullDate Conversion has to be triggered additionally - remove after testing
// Do the nullDate Conversion
JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php');
$jinstallscript = new JoomlaInstallerScript;
$jinstallscript->convertTablesToNewNullDate();
*/


// Handle default backend language setting. This feature is available for localized versions of Joomla.
$app = JFactory::getApplication();
Expand Down Expand Up @@ -1034,8 +1029,10 @@ public function populateDatabase($db, $schema)
* If the Driver has set a nullDate which differs from the default (oldschool) nullDate
* replace it in the query
*/
if($db->getNullDate())
if ($db->getNullDate())
{
$query = $db->convertNullDate($query,$db->getNullDate());
}

/**
* This is a query which was supposed to convert tables to utf8mb4 charset but the server doesn't
Expand Down
5 changes: 3 additions & 2 deletions libraries/cms/schema/changeitem/mysql.php
Expand Up @@ -63,8 +63,9 @@ protected function buildCheckQuery()
if ((($command == 'UPDATE `#__UTF8_CONVERSION`'
|| $command == 'UPDATE #__UTF8_CONVERSION')
&& strtoupper($wordArray[2]) == 'SET'
&& strtolower(substr(str_replace('`', '', $wordArray[3]), 0, 9)) == 'converted') ||
(($command == 'INSERT INTO `#__nullDate_conversion`') && strtolower(substr(str_replace('`', '', $wordArray[3]), 0, 9)) == 'converted'))
&& strtolower(substr(str_replace('`', '', $wordArray[3]), 0, 9)) == 'converted')
|| (($command == 'INSERT INTO `#__nullDate_conversion`')
&& strtolower(substr(str_replace('`', '', $wordArray[3]), 0, 9)) == 'converted'))
{
// Statement is special statement to reset conversion status
$this->queryType = 'UTF8CNV';
Expand Down
5 changes: 4 additions & 1 deletion libraries/joomla/database/driver.php
Expand Up @@ -877,13 +877,16 @@ public function getAlterTableCharacterSet($tableName)

/**
* Automatically changes the null date in the Query File
*
* @param string $query The query to convert
*
* @param string $nullDate The used nullDate
*
* @return string The converted query
*/
public function convertNullDate($query,$nullDate)
{
if($nullDate != '0000-00-00 00:00:00')
if ($nullDate != '0000-00-00 00:00:00')
{
$query = str_replace('0000-00-00 00:00:00', $nullDate, $query);
}
Expand Down
6 changes: 4 additions & 2 deletions libraries/joomla/database/driver/mysqli.php
Expand Up @@ -195,9 +195,11 @@ public function connect()
// Pre-populate the UTF-8 Multibyte compatibility flag based on server version
$this->utf8mb4 = $this->serverClaimsUtf8mb4Support();

//Use different NullTime
if($this->serverUsesNewNullTime())
// Use different NullTime
if ($this->serverUsesNewNullTime())
{
$this->nullDate = '1000-01-01 00:00:00';
}

// Set the character set (needed for MySQL 4.1.2+).
$this->utf = $this->setUtf();
Expand Down
5 changes: 3 additions & 2 deletions libraries/joomla/database/driver/pdomysql.php
Expand Up @@ -152,9 +152,10 @@ public function connect()
/*
* checking if the new null type format of myaql 5.7.0 is used
*/
if(version_compare($serverVersion, '5.7.0', '>='))
if (version_compare($serverVersion, '5.7.0', '>='))
{
$this->nullDate = '1000-01-01 00:00:00';
}

$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
Expand Down

0 comments on commit 22fcc21

Please sign in to comment.