Skip to content

Commit

Permalink
Modified code for travis compatibility - part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Uhl committed Aug 9, 2016
1 parent 22fcc21 commit c9a956a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
29 changes: 19 additions & 10 deletions administrator/components/com_admin/script.php
Expand Up @@ -1688,8 +1688,9 @@ public function flushSessions()
/**
* Converts the site's database tables to the new null Date of mySQL 5.7. Can also be used as reverter
*
* @param string $oldNull the old null date string
* @param string $newNull the new null date string
* @param string $newNull the old null date string
*
* @param string $oldNull the new null date string
*
* @return void
*
Expand All @@ -1699,21 +1700,29 @@ public function convertTablesToNewNullDate($newNull=null,$oldNull=null)
{
$db = JFactory::getDbo();

//Possible Convert Back
if($db->serverUsesNewNullTime())
// Possible to Convert Back
if ($db->serverUsesNewNullTime())
{
if(is_null($newNull))
if (is_null($newNull))
{
$newNull='1000-01-01 00:00:00';
}

if(is_null($oldNull))
if (is_null($oldNull))
{
$oldNull='0000-00-00 00:00:00';
}
} else
{
if(is_null($oldNull))
if (is_null($oldNull))
{
$oldNull='1000-01-01 00:00:00';
}

if(is_null($newNull))
if (is_null($newNull))
{
$newNull='0000-00-00 00:00:00';
}
}

// This is only required for MySQL databases
Expand Down Expand Up @@ -1744,7 +1753,7 @@ public function convertTablesToNewNullDate($newNull=null,$oldNull=null)

if($convertedDB == $newNull)
{
//Already updated - nothing to do
// Already updated - nothing to do
return;
}

Expand All @@ -1759,7 +1768,7 @@ public function convertTablesToNewNullDate($newNull=null,$oldNull=null)
{
foreach ($queries as $query)
{
$query = str_replace(array('$O$','$T$'), array("'".$oldNull."'","'".$newNull."'"), $query);
$query = str_replace(array('$O$','$T$'), array("'" . $oldNull . "'","'" . $newNull . "'"), $query);

try
{
Expand Down
2 changes: 1 addition & 1 deletion installation/model/database.php
Expand Up @@ -1031,7 +1031,7 @@ public function populateDatabase($db, $schema)
*/
if ($db->getNullDate())
{
$query = $db->convertNullDate($query,$db->getNullDate());
$query = $db->convertNullDate($query, $db->getNullDate());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions libraries/joomla/database/driver.php
Expand Up @@ -878,9 +878,9 @@ public function getAlterTableCharacterSet($tableName)
/**
* Automatically changes the null date in the Query File
*
* @param string $query The query to convert
* @param string $query The query to convert
*
* @param string $nullDate The used nullDate
* @param string $nullDate The used nullDate
*
* @return string The converted query
*/
Expand Down

0 comments on commit c9a956a

Please sign in to comment.