Skip to content

Commit

Permalink
First working commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Uhl committed Aug 9, 2016
1 parent d3c9687 commit 6903d53
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion administrator/components/com_admin/script.php
Expand Up @@ -1759,7 +1759,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
@@ -1,2 +1,2 @@
ALTER TABLE `#__nullDate_conversion` CHANGE `converted` `converted` datetime NOT NULL DEFAULT #T#;
UPDATE `#__nullDate_conversion` SET converted = #T#;
ALTER TABLE `#__nullDate_conversion` CHANGE `converted` `converted` datetime NOT NULL DEFAULT $T$;
UPDATE `#__nullDate_conversion` SET `converted` = $T$;
5 changes: 5 additions & 0 deletions installation/model/database.php
Expand Up @@ -652,6 +652,11 @@ public function createTables($options)
}
}

// 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();
$languages = $app->getLocaliseAdmin($db);
Expand Down
4 changes: 2 additions & 2 deletions libraries/joomla/database/driver/mysqli.php
Expand Up @@ -988,10 +988,10 @@ private function serverClaimsUtf8mb4Support()
*
* @since 12.2
*/
private function serverUsesNewNullTime()
public function serverUsesNewNullTime()
{
$server_version = $this->getVersion();
return (version_compare($server_version, '5.7.0', '>='));
return version_compare($server_version, '5.7.0', '>=');
}

/**
Expand Down
15 changes: 15 additions & 0 deletions libraries/joomla/database/driver/pdomysql.php
Expand Up @@ -165,6 +165,21 @@ public static function isSupported()
{
return class_exists('PDO') && in_array('mysql', PDO::getAvailableDrivers());
}

/**
* Does the database server uses the new null time (1000-01-01 00:00:00) instead of the old one (0000-00-00 00:00:00)
*
* libmysql uses the new null time since 5.7 (same version as the MySQL server).
*
* @return boolean
*
* @since 12.2
*/
public function serverUsesNewNullTime()
{
return ($this->nullDate == "1000-01-01 00:00:00");
}


/**
* Drops a table from the database.
Expand Down

0 comments on commit 6903d53

Please sign in to comment.