mirror of
https://github.com/retailcrm/opencart-module.git
synced 2025-02-16 22:43:18 +03:00
parsing opencart version from index.php define procedure
This commit is contained in:
parent
86069fa869
commit
7f69765295
@ -3,13 +3,18 @@
|
|||||||
// Ensure $cli_action is set
|
// Ensure $cli_action is set
|
||||||
if (!isset($cli_action)) {
|
if (!isset($cli_action)) {
|
||||||
echo 'ERROR: $cli_action must be set in calling script.';
|
echo 'ERROR: $cli_action must be set in calling script.';
|
||||||
$log->write('ERROR: $cli_action must be set in calling script.');
|
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version
|
// Version
|
||||||
define('VERSION', '1.5.6');
|
$version = '1.5.6';
|
||||||
|
$indexFile = file_get_contents(realpath(dirname(__FILE__)) . '/../../index.php');
|
||||||
|
preg_match("/define\([\s]*['\"]VERSION['\"][\s]*,[\s]*['\"](.*)['\"][\s]*\)[\s]*;/mi", $indexFile, $versionMatches);
|
||||||
|
if(isset($versionMatches[1])) {
|
||||||
|
$version = $versionMatches[1];
|
||||||
|
}
|
||||||
|
define('VERSION', $version);
|
||||||
|
|
||||||
// Configuration (note we're using the admin config)
|
// Configuration (note we're using the admin config)
|
||||||
require_once(realpath(dirname(__FILE__)) . '/../../admin/config.php');
|
require_once(realpath(dirname(__FILE__)) . '/../../admin/config.php');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user