2019-10-08 19:42:54 +07:00
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
});
|
|
|
|
};
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
var result = {};
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
result["default"] = mod;
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const utils = __importStar(require("./utils"));
|
|
|
|
/**
|
|
|
|
* Function to add custom ini values
|
|
|
|
*
|
|
|
|
* @param ini_values_csv
|
|
|
|
* @param os_version
|
|
|
|
*/
|
2019-10-17 03:11:13 +07:00
|
|
|
function addINIValues(ini_values_csv, os_version, no_step = false) {
|
2019-10-08 19:42:54 +07:00
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
2019-10-17 03:11:13 +07:00
|
|
|
let script = '\n';
|
|
|
|
switch (no_step) {
|
|
|
|
case true:
|
|
|
|
script +=
|
|
|
|
(yield utils.stepLog('Add php.ini values', os_version)) +
|
|
|
|
(yield utils.suppressOutput(os_version)) +
|
|
|
|
'\n';
|
|
|
|
break;
|
|
|
|
case false:
|
|
|
|
default:
|
|
|
|
script += (yield utils.stepLog('Add php.ini values', os_version)) + '\n';
|
|
|
|
break;
|
|
|
|
}
|
2019-10-08 19:42:54 +07:00
|
|
|
switch (os_version) {
|
|
|
|
case 'win32':
|
2019-10-17 03:11:13 +07:00
|
|
|
return script + (yield addINIValuesWindows(ini_values_csv));
|
2019-10-08 19:42:54 +07:00
|
|
|
case 'darwin':
|
|
|
|
case 'linux':
|
2019-10-17 03:11:13 +07:00
|
|
|
return script + (yield addINIValuesUnix(ini_values_csv));
|
2019-10-08 19:42:54 +07:00
|
|
|
default:
|
2019-10-17 03:11:13 +07:00
|
|
|
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
2019-10-08 19:42:54 +07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.addINIValues = addINIValues;
|
|
|
|
/**
|
|
|
|
* Add script to set custom ini values for unix
|
|
|
|
*
|
|
|
|
* @param ini_values_csv
|
|
|
|
*/
|
|
|
|
function addINIValuesUnix(ini_values_csv) {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
let ini_values = yield utils.INIArray(ini_values_csv);
|
2019-10-17 03:11:13 +07:00
|
|
|
let script = '\n';
|
|
|
|
yield utils.asyncForEach(ini_values, function (line) {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
script +=
|
|
|
|
(yield utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
|
2019-10-08 19:42:54 +07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.addINIValuesUnix = addINIValuesUnix;
|
|
|
|
/**
|
|
|
|
* Add script to set custom ini values for windows
|
|
|
|
*
|
|
|
|
* @param ini_values_csv
|
|
|
|
*/
|
|
|
|
function addINIValuesWindows(ini_values_csv) {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
let ini_values = yield utils.INIArray(ini_values_csv);
|
2019-10-17 03:11:13 +07:00
|
|
|
let script = '\n';
|
|
|
|
yield utils.asyncForEach(ini_values, function (line) {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
script +=
|
|
|
|
(yield utils.addLog('$tick', line, 'Added to php.ini', 'win32')) + '\n';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return ('Add-Content C:\\tools\\php\\php.ini "' +
|
|
|
|
ini_values.join('\n') +
|
|
|
|
'"' +
|
|
|
|
script);
|
2019-10-08 19:42:54 +07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.addINIValuesWindows = addINIValuesWindows;
|