Skip to content

Commit

Permalink
Modified code for travis compatibility - part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Uhl committed Aug 9, 2016
1 parent 83c8f74 commit 44e3c6d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
32 changes: 21 additions & 11 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,30 @@ 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
}
}
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 +1754,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 +1769,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
7 changes: 3 additions & 4 deletions libraries/joomla/database/driver.php
Expand Up @@ -873,14 +873,13 @@ public function getAlterTableCharacterSet($tableName)

return $queries;
}



/**
* 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 44e3c6d

Please sign in to comment.