[LON-CAPA-cvs] cvs: loncom /debugging_tools modify_config_files.pl

raeburn raeburn at source.lon-capa.org
Thu Mar 25 09:23:07 EDT 2021


raeburn		Thu Mar 25 13:23:07 2021 EDT

  Modified files:              
    /loncom/debugging_tools	modify_config_files.pl 
  Log:
  - By default, Ubuntu 16LTS and later include "ONLY_FULL_GROUP_BY" in the
    global sql_mode. Remove that so DoDisc can be calculated in Statistics.
  
  
Index: loncom/debugging_tools/modify_config_files.pl
diff -u loncom/debugging_tools/modify_config_files.pl:1.19 loncom/debugging_tools/modify_config_files.pl:1.20
--- loncom/debugging_tools/modify_config_files.pl:1.19	Mon Mar 22 21:15:53 2021
+++ loncom/debugging_tools/modify_config_files.pl	Thu Mar 25 13:23:07 2021
@@ -2,7 +2,7 @@
 #
 # The LearningOnline Network
 #
-# $Id: modify_config_files.pl,v 1.19 2021/03/22 21:15:53 raeburn Exp $
+# $Id: modify_config_files.pl,v 1.20 2021/03/25 13:23:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -245,19 +245,29 @@
 }
 
 my $mysqlfile = '/etc/my.cnf';
+my $mysqlconf = [{section =>'mysqld',
+                  key     =>'wait_timeout=',
+                  value   =>'31536000'}];
 if ($dist =~ /^ubuntu(\d+)$/) {
     my $version = $1;
     $mysqlfile = '/etc/mysql/my.cnf';
     if ($version > 14) {
         $mysqlfile = '/etc/mysql/mysql.conf.d/mysqld.cnf';
+        if ($version < 20) {
+            push(@{$mysqlconf},
+                 {section =>'mysqld',
+                  key     =>'sql_mode=',
+                  value   =>'"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'});
+        } else {
+            push(@{$mysqlconf},
+                 {section =>'mysqld',
+                  key     =>'sql_mode=',
+                  value   =>'"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'});
+        }
     }
 }
 
-my $mysql_global_status =
-    &update_file($mysqlfile,
-             [{section =>'mysqld',
-               key     =>'wait_timeout=',
-               value   =>'31536000', }]);
+my $mysql_global_status = &update_file($mysqlfile,$mysqlconf);
 
 my $local_my_cnf = '/home/www/.my.cnf';
 if (! -e $local_my_cnf) {




More information about the LON-CAPA-cvs mailing list