Changeset 1169

Show
Ignore:
Timestamp:
11/19/08 00:27:54 (2 months ago)
Author:
laurentj
Message:

ticket #409: standalone script to check the configuration of a server

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/buildjelix.php

    r1163 r1169  
    235235} 
    236236 
     237$var = ENV::getAll(); 
     238$var['STANDALONE_CHECKER'] = true; 
     239jManifest::process('build/manifests/jelix-checker.mn','.', $BUILD_TARGET_PATH , $var); 
     240 
    237241file_put_contents($BUILD_TARGET_PATH.'lib/jelix/VERSION', $LIB_VERSION); 
    238242 
  • trunk/build/manifests/jelix-lib.mn

    r1164 r1169  
    99  CREDITS 
    1010* init.php 
    11  checker.php 
     11* checker.php 
    1212  INSTALL 
    1313  LICENCE 
     
    3737! defaultconfig.ini.php 
    3838* jConfigCompiler.class.php 
    39  jInstallChecker.class.php 
     39* jInstallChecker.class.php 
    4040  jSoapCoordinator.class.php 
    4141  jCmdlineCoordinator.class.php 
  • trunk/lib/jelix/checker.php

    r819 r1169  
    1616 * 
    1717 */ 
     18#if STANDALONE_CHECKER 
     19#includephp core/jInstallChecker.class.php 
     20#else 
    1821include dirname(__FILE__).'/core/jInstallChecker.class.php'; 
    19  
     22#endif 
    2023/** 
    2124 * an HTML reporter for jInstallChecker 
  • trunk/lib/jelix/core/jInstallChecker.class.php

    r1075 r1169  
    3939    protected $messages = array( 
    4040        'fr'=>array( 
     41#ifnot STANDALONE_CHECKER 
    4142            'checker.title'=>'Vérification de l\'installation de Jelix', 
     43#else 
     44#expand      'checker.title'=>'Vérification de votre serveur pour Jelix __LIB_VERSION__', 
     45#endif 
    4246            'number.errors'=>' erreurs.', 
    4347            'number.error'=>' erreur.', 
     
    4650            'number.notices'=>' remarques.', 
    4751            'number.notice'=>' remarque.', 
     52#ifnot STANDALONE_CHECKER 
    4853            'build.not.found'=>'Le fichier BUILD de jelix est introuvable', 
    4954            'conclusion.error'=>'Vous devez corriger l\'erreur pour faire fonctionner correctement votre application.', 
     
    5459            'conclusion.notices'=>'L\'installation est correcte malgré les remarques.', 
    5560            'conclusion.ok'=>'L\'installation est correcte', 
     61#else 
     62#expand            'conclusion.error'=>'Vous devez corriger l\'erreur pour faire fonctionner correctement une application Jelix __LIB_VERSION__.', 
     63#expand            'conclusion.errors'=>'Vous devez corriger les erreurs pour faire fonctionner correctement une application Jelix __LIB_VERSION__.', 
     64#expand            'conclusion.warning'=>'Une application Jelix __LIB_VERSION__ peut à priori fonctionner, mais il est préférable de corriger l\'avertissement pour être sûr.', 
     65#expand            'conclusion.warnings'=>'Une application Jelix __LIB_VERSION__ peut à priori fonctionner, mais il est préférable de corriger les avertissements pour être sûr.', 
     66#expand     'conclusion.notice'=>'Aucun problème pour installer une application pour Jelix  __LIB_VERSION__ malgré la remarque.', 
     67#expand     'conclusion.notices'=>'Aucun problème pour installer une application pour Jelix  __LIB_VERSION__ malgré les remarques.', 
     68#expand     'conclusion.ok'=>'Vous pouvez installer une application avec Jelix __LIB_VERSION__', 
     69#endif 
    5670            'cannot.continue'=>'Les vérifications ne peuvent continuer : ', 
    5771            'extension.dom'=>'L\'extension DOM n\'est pas installée', 
     
    93107 
    94108        'en'=>array( 
     109#ifnot STANDALONE_CHECKER 
    95110            'checker.title'=>'Jelix Installation checking', 
     111#else 
     112#expand      'checker.title'=>'Check your configuration server for Jelix __LIB_VERSION__', 
     113#endif 
    96114            'number.errors'=>' errors.', 
    97115            'number.error'=>' error.', 
     
    100118            'number.notices'=>' notices.', 
    101119            'number.notice'=>' notice.', 
     120#ifnot STANDALONE_CHECKER 
    102121            'build.not.found'=>'BUILD jelix file is not found', 
    103122            'conclusion.error'=>'You must fix the error in order to run your application correctly.', 
     
    108127            'conclusion.notices'=>'The installation is ok, although there are notices.', 
    109128            'conclusion.ok'=>'The installation is ok', 
     129#else 
     130#expand            'conclusion.error'=>'You must fix the error in order to run an application correctly with Jelix __LIB_VERSION__.', 
     131#expand            'conclusion.errors'=>'You must fix errors in order to run an application correctly with Jelix __LIB_VERSION__.', 
     132#expand            'conclusion.warning'=>'Your application for Jelix __LIB_VERSION__ may run without problems, but it is recommanded to fix the warning.', 
     133#expand            'conclusion.warnings'=>'Your application for Jelix __LIB_VERSION__ may run without problems, but it is recommanded to fix warnings.', 
     134#expand            'conclusion.notice'=>'You can install an application for Jelix __LIB_VERSION__, although there is a notice.', 
     135#expand            'conclusion.notices'=>'You can install an application for Jelix __LIB_VERSION__, although there are notices.', 
     136#expand            'conclusion.ok'=>'You can install an application for Jelix __LIB_VERSION__.', 
     137#endif 
    110138            'cannot.continue'=>'Cannot continue the checking: ', 
    111139            'extension.dom'=>'DOM extension is not installed', 
     
    210238        $this->reporter = $reporter; 
    211239        $this->messages = new jInstallMessageProvider($lang); 
     240#if STANDALONE_CHECKER 
     241        $this->buildProperties = array( 
     242#expand    'PHP_VERSION_TARGET'=>'__PHP_VERSION_TARGET__',  
     243#expand    'ENABLE_PHP_FILTER' =>'__ENABLE_PHP_FILTER__',  
     244#expand    'ENABLE_PHP_JSON'   =>'__ENABLE_PHP_JSON__',  
     245#expand    'ENABLE_PHP_JELIX'  =>'__ENABLE_PHP_JELIX__',  
     246#expand    'WITH_BYTECODE_CACHE'=>'__WITH_BYTECODE_CACHE__', 
     247        ); 
     248#endif 
    212249    } 
    213250 
     
    219256        $this->reporter->start(); 
    220257        try { 
     258#ifnot STANDALONE_CHECKER 
    221259            $this->checkAppPaths(); 
    222260            $this->loadBuildFile(); 
     261#endif 
    223262            $this->checkPhpExtensions(); 
    224263            $this->checkPhpSettings(); 
     
    261300        if(!version_compare($this->buildProperties['PHP_VERSION_TARGET'], phpversion(), '<=')){ 
    262301            $this->error('php.bad.version'); 
    263             $notice = $this->messages->get('php.version.required').$this->buildProperties['PHP_VERSION_TARGET']; 
     302            $notice = $this->messages->get('php.version.required') 
     303                     .$this->buildProperties['PHP_VERSION_TARGET']; 
    264304            $notice.= '. '.$this->messages->get('php.version.current').phpversion(); 
    265305            $this->reporter->showNotice($notice); 
     
    304344            $ok=false; 
    305345        } 
    306         if($this->buildProperties['WITH_BYTECODE_CACHE'] != 'auto' && $this->buildProperties['WITH_BYTECODE_CACHE'] != '') { 
     346        if($this->buildProperties['WITH_BYTECODE_CACHE'] != 'auto' && 
     347           $this->buildProperties['WITH_BYTECODE_CACHE'] != '') { 
    307348            if(!extension_loaded ('apc') && !extension_loaded ('eaccelerator') && !extension_loaded ('xcache')) { 
    308349                $this->error('extension.opcode.cache'); 
     
    315356        return $ok; 
    316357    } 
    317  
     358#ifnot STANDALONE_CHECKER 
    318359    function checkAppPaths(){ 
    319360        $ok = true; 
     
    348389            throw new Exception($this->messages->get('too.critical.error')); 
    349390 
    350         if(!isset($GLOBALS['config_file']) || empty($GLOBALS['config_file']) || !file_exists(JELIX_APP_CONFIG_PATH.$GLOBALS['config_file'])){ 
     391        if(!isset($GLOBALS['config_file']) || 
     392           empty($GLOBALS['config_file']) || 
     393           !file_exists(JELIX_APP_CONFIG_PATH.$GLOBALS['config_file'])){ 
    351394            throw new Exception($this->messages->get('config.file')); 
    352395        } 
     
    362405        } 
    363406    } 
     407#endif 
    364408 
    365409    function checkPhpSettings(){ 
    366410        $ok = true; 
     411#ifnot STANDALONE_CHECKER 
    367412        $defaultconfig = parse_ini_file(JELIX_APP_CONFIG_PATH."defaultconfig.ini.php", true); 
    368413        $indexconfig = parse_ini_file(JELIX_APP_CONFIG_PATH."index/config.ini.php", true); 
     
    379424        } 
    380425        else { 
     426#endif 
    381427            if(ini_get('magic_quotes_gpc') == 1){ 
    382428                $this->warning('ini.magic_quotes_gpc'); 
    383429                $ok=false; 
    384430            } 
    385         } 
    386  
     431#ifnot STANDALONE_CHECKER 
     432        } 
     433#endif 
    387434        if(ini_get('magic_quotes_runtime') == 1){ 
    388435            $this->error('ini.magic_quotes_runtime'); 
Download in other formats: Unified Diff Zip Archive