Skip to content

Commit

Permalink
MySQL updates for 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
razzed committed Feb 1, 2021
1 parent c970e8f commit 3692954
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion modules/mysql/classes/Database/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ private function parse_column_sql(Database_Table $table, $sql) {

if ($sql_type === "timestamp" && !isset($options['default'])) {
if (!avalue($options, 'not null')) {
$options['default'] = null;
// $options['default'] = null;
// KMD False DEFAULT NULL not compatible 2021
} else {
$options['default'] = 0;
// KMD Was 2020-07-13 "CURRENT_TIMESTAMP";
Expand Down
4 changes: 2 additions & 2 deletions modules/mysql/classes/Database/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public function sql_type_default($native_type, $default_value = null) {
case self::sql_type_text:
return null;
case self::sql_type_integer:
return intval($default_value);
return is_numeric($default_value) ? intval($default_value) : null;
case self::sql_type_double:
return doubleval($default_value);
return is_numeric($default_value) ? floatval($default_value) : null;
case self::sql_type_datetime:
if ($default_value === 0 || $default_value === "0") {
$invalid_dates_ok = $this->database->option_bool("invalid_dates_ok");
Expand Down
10 changes: 10 additions & 0 deletions modules/orm/classes/Module/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,4 +511,14 @@ public function database_table_add_column(Database_Table $table, Database_Column
$adapter = $this->database_adapters[$code];
$adapter->database_column_set_type($column);
}

/**
* Run beforehand.
*/
public function hook_cron_before() {
$application = $this->application;
$server = $application->orm_factory(Server::class);
/* @var $server Server */
$server->bury_dead_servers();
}
}
4 changes: 2 additions & 2 deletions modules/polyglot/classes/module/polyglot.inc
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class Module_PolyGlot extends Module implements Interface_Module_Routes {
/**
*
* @param string $locale
* @throws Exception_File_NotFound
* @throws Exception_File_Format
* @return PolyGlot_Token[]
* @throws Exception_File_Format|Exception_Directory_NotFound
* @throws Exception_File_NotFound
*/
public function load_locale($locale = null) {
$source_files = $this->option_list("source_files");
Expand Down

0 comments on commit 3692954

Please sign in to comment.