Skip to content

Commit 4e7b365

Browse files
author
Branislav Viest
committed
Custom PHP variables are not apply when configured in Directive Snippet
PHP variables from Directive Snippets order fix in php.ini
1 parent a265c64 commit 4e7b365

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,13 +1247,14 @@ function update($event_name, $data) {
12471247
}
12481248

12491249
//* Create custom php.ini
1250-
if(trim($data['new']['custom_php_ini']) != '') {
1250+
# Because of custom default PHP directives from snippet
1251+
# php.ini custom values order os: 1. general settings 2. Directive Snippets settings 3. custom php.ini settings defined in domain settings
1252+
if(trim($data['new']['custom_php_ini']) != '' || $data['new']['directive_snippets_id'] > "0") {
12511253
$has_custom_php_ini = true;
12521254
$custom_sendmail_path = false;
12531255
if(!is_dir($custom_php_ini_dir)) $app->system->mkdirpath($custom_php_ini_dir);
12541256

12551257
$php_ini_content = $this->get_master_php_ini_content($data['new']);
1256-
$php_ini_content .= str_replace("\r", '', trim($data['new']['custom_php_ini']));
12571258

12581259
if(intval($data['new']['directive_snippets_id']) > 0){
12591260
$snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id']));
@@ -1266,13 +1267,15 @@ function update($event_name, $data) {
12661267
$php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet);
12671268
$php_snippet['snippet'] = trim($php_snippet['snippet']);
12681269
if($php_snippet['snippet'] != ''){
1270+
$php_snippet['snippet'] = str_replace("\r", '', $php_snippet['snippet']);
12691271
$php_ini_content .= "\n".$php_snippet['snippet'];
12701272
}
12711273
}
12721274
}
12731275
}
12741276
}
12751277
}
1278+
$php_ini_content .= "\n".str_replace("\r", '', trim($data['new']['custom_php_ini']));
12761279

12771280
$custom_sendmail_path = false;
12781281
$line = strtok($php_ini_content, '\n');

0 commit comments

Comments
 (0)