Skip to content

Commit a1e7fda

Browse files
author
Till Brehm
committed
Merge branch '5440-mariadb-field-nginx_directives-doesn-t-have-a-default-value' into 'stable-3.1'
Resolve "MariaDB: Field 'nginx_directives' doesn't have a default value" See merge request ispconfig/ispconfig3!1070
2 parents b957d5e + 6891708 commit a1e7fda

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

install/sql/incremental/upd_dev_collection.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ ALTER TABLE `web_domain` DROP COLUMN `enable_spdy`;
4444

4545
-- was missing in incremental, inserted for fixing older installations
4646
ALTER TABLE `web_domain` ADD `folder_directive_snippets` TEXT NULL AFTER `https_port`;
47+
48+
ALTER TABLE `web_domain` CHANGE `apache_directives` `apache_directives` mediumtext NULL DEFAULT NULL;
49+
ALTER TABLE `web_domain` CHANGE `nginx_directives` `nginx_directives` mediumtext NULL DEFAULT NULL;

install/sql/ispconfig3.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,8 +2046,8 @@ CREATE TABLE `web_domain` (
20462046
`stats_password` varchar(255) default NULL,
20472047
`stats_type` varchar(255) default 'awstats',
20482048
`allow_override` varchar(255) NOT NULL default 'All',
2049-
`apache_directives` mediumtext,
2050-
`nginx_directives` mediumtext,
2049+
`apache_directives` mediumtext NULL DEFAULT NULL,
2050+
`nginx_directives` mediumtext NULL DEFAULT NULL,
20512051
`php_fpm_use_socket` ENUM('n','y') NOT NULL DEFAULT 'y',
20522052
`php_fpm_chroot` enum('n','y') NOT NULL DEFAULT 'n',
20532053
`pm` enum('static','dynamic','ondemand') NOT NULL DEFAULT 'ondemand',

server/plugins-available/apache2_plugin.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,11 @@ function update($event_name, $data) {
11861186
$vhost_data['apache_directives'] = $snippet['snippet'];
11871187
}
11881188
}
1189+
1190+
if(!$vhost_data['apache_directives']) {
1191+
$vhost_data['apache_directives'] = ''; // ensure it is not null
1192+
}
1193+
11891194
// Make sure we only have Unix linebreaks
11901195
$vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']);
11911196
$vhost_data['apache_directives'] = str_replace("\r", "\n", $vhost_data['apache_directives']);

server/plugins-available/nginx_plugin.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,9 @@ function update($event_name, $data) {
12001200
$nginx_directives = $data['new']['nginx_directives'];
12011201
// $vhost_data['enable_pagespeed'] = false;
12021202
}
1203+
if(!$nginx_directives) {
1204+
$nginx_directives = ''; // ensure it is not null
1205+
}
12031206

12041207
// folder_directive_snippets
12051208
if(trim($data['new']['folder_directive_snippets']) != ''){

server/plugins-available/nginx_reverseproxy_plugin.inc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ function update($event_name, $data) {
111111
$crt_file = $ssl_dir.'/'.$domain.'.crt';
112112
$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
113113

114-
$vhost_data['nginx_directives'] = preg_replace("/\[IP\]/", $vhost_data['ip_address'], $vhost_data['nginx_directives']);
114+
if($vhost_data['nginx_directives']) {
115+
$vhost_data['nginx_directives'] = preg_replace("/\[IP\]/", $vhost_data['ip_address'], $vhost_data['nginx_directives']);
116+
}
115117

116118

117119
if($data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file)) {

0 commit comments

Comments
 (0)