Skip to content

Commit 0435b3b

Browse files
committed
Disabled pcre.jit as it is always running out of memory. Added optional XFServerPort conf.ini directive to specify the server port when using development server.
1 parent 887f610 commit 0435b3b

File tree

3 files changed

+52
-14
lines changed

3 files changed

+52
-14
lines changed

Dataface/Application.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,10 @@ function __construct($conf = null) {
558558
}
559559
$this->_baseUrl = $_SERVER['PHP_SELF'];
560560
if ( !is_array($conf) ) $conf = array();
561-
$configPath = DATAFACE_SITE_PATH.'/conf.ini.php';
562-
if (!is_readable($configPath)) {
563-
$configPath = DATAFACE_SITE_PATH.'/conf.ini';
564-
}
561+
$configPath = DATAFACE_SITE_PATH.'/conf.ini.php';
562+
if (!is_readable($configPath)) {
563+
$configPath = DATAFACE_SITE_PATH.'/conf.ini';
564+
}
565565
if ( is_readable($configPath) ){
566566
$conf = array_merge(parse_ini_file($configPath, true), $conf);
567567
if ( @$conf['__include__'] ){

init.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
function init($site_path, $dataface_url){
23-
23+
ini_set('pcre.jit', '0');
2424
$originalUrl = isset($_SERVER['HTTP_X_ORIGINAL_URL']) ? parse_url($_SERVER['HTTP_X_ORIGINAL_URL']) : null;
2525
if ($originalUrl) {
2626
$host = @$originalUrl["host"];

scaffold_template/bin/print_config_var.php

+47-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,52 @@
11
<?php
2+
error_reporting(E_ALL);
3+
ini_set('display_errors', 'on');
24
if (!@$argv) {
35
fwrite(STDERR, "CLI ONLY");
46
exit(1);
57
}
8+
$XATAFACE_CONFIG_PATHS = array();
69

7-
$files = array('conf.ini', 'conf.ini.php', 'conf.db.ini', 'conf.db.ini.php');
10+
$cliConfPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'cli-conf.ini';
11+
12+
if (is_readable($cliConfPath)) {
13+
$cliConf = parse_ini_file($cliConfPath, true);
14+
if (isset($cliConf['XATAFACE_CONFIG_PATHS'])) {
15+
$paths = explode(":", $cliConf['XATAFACE_CONFIG_PATHS']);
16+
foreach ($paths as $path) {
17+
if (!trim($path)) {
18+
continue;
19+
}
20+
$XATAFACE_CONFIG_PATHS[] = dirname($cliConfPath).DIRECTORY_SEPARATOR.$path;
21+
}
22+
}
23+
}
24+
$XATAFACE_CONFIG_PATHS[] = dirname(__FILE__). DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'app';
25+
$files = array('conf.ini.php', 'conf.ini');
826
$conf = array();
927
foreach ($files as $file) {
10-
$file_path = dirname(__FILE__)
11-
. DIRECTORY_SEPARATOR . '..'
12-
. DIRECTORY_SEPARATOR . 'app'
13-
. DIRECTORY_SEPARATOR . $file;
14-
if (file_exists($file_path)) {
15-
$conf = array_merge_recursive($conf, parse_ini_file($file_path, true));
16-
}
28+
foreach ($XATAFACE_CONFIG_PATHS as $path) {
29+
$file_path = $path . DIRECTORY_SEPARATOR . $file;
30+
if (file_exists($file_path)) {
31+
$tmp = parse_ini_file($file_path, true);
32+
if ( @$tmp['__include__'] ){
33+
$includes = array_map('trim',explode(',', $tmp['__include__']));
34+
foreach ($includes as $i){
35+
if (!trim($i)) {
36+
continue;
37+
}
38+
$p = dirname($file_path) . DIRECTORY_SEPARATOR . $i;
39+
if ( is_readable($p) ){
40+
$tmp = array_merge($tmp, parse_ini_file($p, true));
41+
} else if ( is_readable($p.'.php') ){
42+
$tmp = array_merge($tmp, parse_ini_file($p.'.php', true));
43+
}
44+
}
45+
}
46+
$conf = array_merge_recursive($tmp, $conf);
47+
}
48+
}
49+
1750
}
1851
if (count($argv) < 2) {
1952
print_r($conf);
@@ -30,7 +63,12 @@
3063
echo dirname(dirname(realpath(__FILE__)));
3164
exit;
3265
case 'XFServerPort':
33-
echo '9090';
66+
if (@$conf['XFServerPort']) {
67+
echo $conf['XFServerPort'];
68+
} else {
69+
echo '9090';
70+
}
71+
3472
exit;
3573
case 'XFShortVersionString':
3674
$version_path = dirname(__FILE__)

0 commit comments

Comments
 (0)