From 94ba5569e7aa30dd3b1ee826f15bdfdf22f82698 Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@git-test.afi-sa.fr> Date: Wed, 17 Apr 2013 08:47:08 +0000 Subject: [PATCH] Cosmogramme :changement de configuration serveur --- .gitattributes | 1 + cosmogramme/php/_init.php | 3 ++- cosmogramme/storm_init.php | 41 +++++++++++++++++++++++++++++++++ cosmogramme/tests/bootstrap.php | 2 +- library/startup.php | 4 ++-- 5 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 cosmogramme/storm_init.php diff --git a/.gitattributes b/.gitattributes index 691b430c31c..cca40e1e30f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2132,6 +2132,7 @@ cosmogramme/sql/patch/patch_150.sql -text cosmogramme/sql/patch/patch_151.sql -text cosmogramme/sql/patch/patch_152.sql -text cosmogramme/sql/patch/patch_153.sql -text +cosmogramme/storm_init.php -text cosmogramme/tests/bootstrap.php -text cosmogramme/tests/php/classes/IndexationTest.php -text cosmogramme/tests/php/classes/Iso2709RecordTest.php -text diff --git a/cosmogramme/php/_init.php b/cosmogramme/php/_init.php index b55e22b9b52..ca2e805774d 100644 --- a/cosmogramme/php/_init.php +++ b/cosmogramme/php/_init.php @@ -8,6 +8,7 @@ define("BR","<br />"); define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs"); + if (!function_exists('xdebug_break')) { function xdebug_break(){}; } @@ -43,7 +44,7 @@ require("fonctions/string.php"); require("fonctions/erreur.php"); require("fonctions/date_heure.php"); require("fonctions/variables.php"); - +require_once(realpath(dirname(__FILE__)).'/../storm_init.php'); // Lire la config $cfg=lireConfig($cfgfile); diff --git a/cosmogramme/storm_init.php b/cosmogramme/storm_init.php new file mode 100644 index 00000000000..bf609102f12 --- /dev/null +++ b/cosmogramme/storm_init.php @@ -0,0 +1,41 @@ +<?php + +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * AFI-OPAC 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +define ('OPAC_REALPATH',realpath(dirname(__FILE__))); +set_include_path( + PATH_SEPARATOR . '../../ZendFramework-1.6.2/library' + . PATH_SEPARATOR . get_include_path() + . PATH_SEPARATOR.OPAC_REALPATH . '/../library' + ); + +// Includes de base +include_once "fonctions/array.php"; +include_once OPAC_REALPATH."/../local.php"; + +require_once "Zend/Loader.php"; +require_once "startup.php"; +Zend_Loader::registerAutoload(); +$cfg = loadConfig(OPAC_REALPATH.'/../config.ini'); +setupDatabase($cfg); +defineConstant('LANG_DIR', realpath(dirname(__FILE__)).'/../library/translation/'); +setupLanguage(); +?> \ No newline at end of file diff --git a/cosmogramme/tests/bootstrap.php b/cosmogramme/tests/bootstrap.php index 51ebe968b12..b18b827f697 100644 --- a/cosmogramme/tests/bootstrap.php +++ b/cosmogramme/tests/bootstrap.php @@ -13,7 +13,7 @@ set_include_path( realpath(dirname(__FILE__)).'/../php' . PATH_SEPARATOR . realpath(dirname(__FILE__)).'/../php/classes' . PATH_SEPARATOR . get_include_path()); -chdir('..'); +chdir(realpath(dirname(__FILE__)).'/..'); session_start(); diff --git a/library/startup.php b/library/startup.php index e93349b52cd..15e69d44419 100644 --- a/library/startup.php +++ b/library/startup.php @@ -108,13 +108,13 @@ function setupConstants() { -function loadConfig() { +function loadConfig($config_init_file_path = './config.ini') { // load configuration (local ou production) if(array_isset('REMOTE_ADDR', $_SERVER) and $_SERVER['REMOTE_ADDR'] == '127.0.0.1') $serveur='local'; else $serveur='production'; - $cfg = new Zend_Config_Ini('./config.ini', $serveur); + $cfg = new Zend_Config_Ini($config_init_file_path, $serveur); Zend_Registry::set('cfg', $cfg); -- GitLab