function loadBuildFile() { if (!file_exists(JELIX_LIB_PATH . 'BUILD')) { throw new Exception($this->messages->get('build.not.found')); } else { $this->buildProperties = parse_ini_file(JELIX_LIB_PATH . 'BUILD'); } }
function checkPhpExtensions() { $ok = true; if (!version_compare($this->buildProperties['PHP_VERSION_TARGET'], phpversion(), '<=')) { $this->error('php.bad.version'); $notice = $this->messages->get('php.version.required', $this->buildProperties['PHP_VERSION_TARGET']); $notice .= '. ' . $this->messages->get('php.version.current', phpversion()); $this->reporter->showNotice($notice); $ok = false; } else { if ($this->verbose) { $this->ok('php.ok.version', phpversion()); } } $extensions = array('dom', 'SPL', 'SimpleXML', 'pcre', 'session', 'tokenizer', 'iconv', 'filter', 'json'); foreach ($extensions as $name) { if (!extension_loaded($name)) { $this->error('extension.required.not.installed', $name); $ok = false; } else { if ($this->verbose) { $this->ok('extension.required.installed', $name); } } } if (count($this->databases)) { $driversInfos = jDbParameters::getDriversInfosList(); $req = $this->dbRequired ? 'required' : 'optional'; $okdb = false; array_combine($this->databases, array_fill(0, count($this->databases), false)); $alreadyExtensionsChecked = array(); $okdatabases = array(); foreach ($this->databases as $name) { foreach ($driversInfos as $driverInfo) { list($dbType, $nativeExt, $pdoExt, $jdbDriver, $pdoDriver) = $driverInfo; if ($name == $dbType || $name == $nativeExt || $name == $pdoDriver) { if (extension_loaded($nativeExt)) { if (!isset($alreadyExtensionsChecked[$nativeExt])) { if ($this->verbose) { $this->ok('extension.installed', $nativeExt); } $alreadyExtensionsChecked[$nativeExt] = true; $okdb = true; $okdatabases[$name] = true; } } else { if (!isset($alreadyExtensionsChecked[$nativeExt])) { if ($this->verbose) { $this->notice('extension.not.installed', $nativeExt); } $alreadyExtensionsChecked[$nativeExt] = false; } } if (extension_loaded($pdoExt)) { if (!isset($alreadyExtensionsChecked[$pdoExt])) { if ($this->verbose) { $this->ok('extension.installed', $pdoExt); } $alreadyExtensionsChecked[$pdoExt] = true; $okdb = true; $okdatabases[$name] = true; } } else { if (!isset($alreadyExtensionsChecked[$pdoExt])) { if ($this->verbose) { $this->notice('extension.not.installed', $pdoExt); } $alreadyExtensionsChecked[$pdoExt] = false; } } } } } if ($this->dbRequired) { if ($okdb) { $this->ok('extension.database.ok', implode(',', array_keys($okdatabases))); } else { $this->error('extension.database.missing'); $ok = false; } } else { if ($okdb) { $this->ok('extension.database.ok2', implode(',', array_keys($okdatabases))); } else { $this->notice('extension.database.missing2'); } } } foreach ($this->otherExtensions as $name => $required) { $req = $required ? 'required' : 'optional'; if (!extension_loaded($name)) { if ($required) { $this->error('extension.' . $req . '.not.installed', $name); $ok = false; } else { $this->notice('extension.' . $req . '.not.installed', $name); } } else { if ($this->verbose) { $this->ok('extension.' . $req . '.installed', $name); } } } if ($ok) { $this->ok('extensions.required.ok'); } return $ok; }
function checkPhpExtensions() { $ok = true; if (!version_compare($this->buildProperties['PHP_VERSION_TARGET'], phpversion(), '<=')) { $this->error('php.bad.version'); $notice = $this->messages->get('php.version.required', $this->buildProperties['PHP_VERSION_TARGET']); $notice .= '. ' . $this->messages->get('php.version.current', phpversion()); $this->reporter->showNotice($notice); $ok = false; } else { if ($this->verbose) { $this->ok('php.ok.version', phpversion()); } } $extensions = array('dom', 'SPL', 'SimpleXML', 'pcre', 'session', 'tokenizer', 'iconv', 'filter', 'json'); if ($this->buildProperties['ENABLE_PHP_JELIX'] == '1') { $extensions[] = 'jelix'; } foreach ($extensions as $name) { if (!extension_loaded($name)) { $this->error('extension.required.not.installed', $name); $ok = false; } else { if ($this->verbose) { $this->ok('extension.required.installed', $name); } } } if ($this->buildProperties['WITH_BYTECODE_CACHE'] != 'auto' && $this->buildProperties['WITH_BYTECODE_CACHE'] != '') { if (!extension_loaded('apc') && !extension_loaded('eaccelerator') && !extension_loaded('xcache')) { $this->error('extension.opcode.cache'); $ok = false; } } if (count($this->databases)) { $req = $this->dbRequired ? 'required' : 'optional'; $okdb = false; if (class_exists('PDO')) { $pdodrivers = PDO::getAvailableDrivers(); } else { $pdodrivers = array(); } foreach ($this->databases as $name) { if (!extension_loaded($name) && !in_array($name, $pdodrivers)) { $this->notice('extension.not.installed', $name); } else { $okdb = true; if ($this->verbose) { $this->ok('extension.installed', $name); } } } if ($this->dbRequired) { if ($okdb) { $this->ok('extension.database.ok'); } else { $this->error('extension.database.missing'); $ok = false; } } else { if ($okdb) { $this->ok('extension.database.ok2'); } else { $this->notice('extension.database.missing2'); } } } foreach ($this->otherExtensions as $name => $required) { $req = $required ? 'required' : 'optional'; if (!extension_loaded($name)) { if ($required) { $this->error('extension.' . $req . '.not.installed', $name); $ok = false; } else { $this->notice('extension.' . $req . '.not.installed', $name); } } else { if ($this->verbose) { $this->ok('extension.' . $req . '.installed', $name); } } } if ($ok) { $this->ok('extensions.required.ok'); } return $ok; }