PageRenderTime 47ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/setup/includes/config/modevolutionconfigreader.class.php

http://github.com/modxcms/revolution
PHP | 54 lines | 46 code | 0 blank | 8 comment | 0 complexity | 036e8ca2d1f92d168d4f866f5cab0e15 MD5 | raw file
Possible License(s): GPL-2.0, Apache-2.0, BSD-3-Clause, LGPL-2.1
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. require_once strtr(realpath(MODX_SETUP_PATH.'includes/config/modconfigreader.class.php'),'\\','/');
  11. /**
  12. * Reads from a Revolution config file
  13. *
  14. * @package modx
  15. * @subpackage setup
  16. */
  17. class modEvolutionConfigReader extends modConfigReader {
  18. public function read(array $config = array()) {
  19. global $database_dsn, $database_type, $database_server, $dbase, $database_user, $database_password,
  20. $database_connection_charset, $table_prefix, $config_options, $driver_options;
  21. $database_connection_charset = 'utf8';
  22. /* get http host */
  23. $this->getHttpHost();
  24. @ob_start();
  25. $included = @ include MODX_INSTALL_PATH . 'manager/includes/config.inc.php';
  26. @ob_end_clean();
  27. if ($included && isset ($dbase)) {
  28. $config_options = is_array($config_options) ? $config_options : array();
  29. $driver_options = is_array($driver_options) ? $driver_options : array();
  30. $this->config = array_merge(array(
  31. 'database_type' => !empty($database_type) ? $database_type : 'mysql',
  32. 'database_server' => !empty($database_server) ? $database_server : 'localhost',
  33. 'dbase' => trim($dbase, '`[]'),
  34. 'database_user' => !empty($database_user) ? $database_user : '',
  35. 'database_password' => isset($database_password) ? $database_password : '',
  36. 'database_connection_charset' => $database_connection_charset,
  37. 'database_charset' => $database_connection_charset,
  38. 'table_prefix' => isset($table_prefix) ? $table_prefix : 'modx',
  39. 'https_port' => isset ($https_port) ? $https_port : '443',
  40. 'http_host' => defined('MODX_HTTP_HOST') ? MODX_HTTP_HOST : $this->config['http_host'],
  41. 'site_sessionname' => isset ($site_sessionname) ? $site_sessionname : 'SN' . uniqid(''),
  42. 'inplace' => isset ($_POST['inplace']) ? 1 : 0,
  43. 'unpacked' => isset ($_POST['unpacked']) ? 1 : 0,
  44. 'config_options' => $config_options,
  45. 'driver_options' => $driver_options,
  46. ),$this->config,$config);
  47. }
  48. return $this->config;
  49. }
  50. }