Changeset 345
- Timestamp:
- 01/10/07 00:07:23 (2 years ago)
- Files:
-
- trunk/build/buildapp.php (modified) (3 diffs)
- trunk/build/buildjbt.php (modified) (2 diffs)
- trunk/build/buildjelix.php (modified) (5 diffs)
- trunk/build/buildjtpl.php (modified) (2 diffs)
- trunk/build/buildmodules.php (modified) (2 diffs)
- trunk/build/lib/jBuild.inc.php (modified) (8 diffs)
- trunk/build/lib/preprocessor.lib.php (modified) (2 diffs)
- trunk/build/manifests/jelix-lib.mn (modified) (1 diff)
- trunk/build/manifests/jelix-no-opt.mn (modified) (1 diff)
- trunk/lib/jelix/core/jConfig.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/jConfigCompiler.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/jController.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/jSelector.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseJson.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/url/jUrlEngine.significant.class.php (modified) (2 diffs)
- trunk/lib/jelix/dao/jDaoCompiler.class.php (modified) (1 diff)
- trunk/lib/jelix/db/jDb.class.php (modified) (2 diffs)
- trunk/lib/jelix/events/jEvent.class.php (modified) (2 diffs)
- trunk/lib/jelix/events/jEventListenerFactory.class.php (modified) (2 diffs)
- trunk/lib/jelix/init.php (modified) (7 diffs)
- trunk/lib/jelix/tpl/jTpl.class.php (modified) (3 diffs)
- trunk/lib/jelix/tpl/jTplCompiler.class.php (modified) (16 diffs)
- trunk/lib/jelix/utils/jDateTime.class.php (modified) (1 diff)
- trunk/lib/jelix/utils/jFilter.class.php (modified) (9 diffs)
- trunk/lib/jelix/utils/jJsonRpc.class.php (modified) (6 diffs)
- trunk/lib/jelix/utils/jZone.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/buildapp.php
r293 r345 4 4 * @author Jouanneau Laurent 5 5 * @contributor 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 9 9 */ 10 10 $BUILD_OPTIONS = array( 11 'MAIN_TARGET_PATH'=> array( 12 "main directory where sources will be copied", // signification (false = option cach� 13 '_dist', // valeur par d�ut (boolean = option booleene) 14 '', // regexp pour la valeur ou vide=tout (seulement pour option non booleene) 15 ), 16 'VERSION'=> array( 17 "Version number you want to set for this package", 18 'SVN', 19 '', 20 ), 21 'APPNAME'=> array( 22 "The name of the app you want to generate (demoxul, myapp, testapp)", 23 '', 24 '/demoxul|myapp|testapp/', 25 ), 26 'PACKAGE_TAR_GZ'=>array( 27 "create a tar.gz package", 28 false, 29 ), 30 'PACKAGE_ZIP'=>array( 31 "create a zip package", 32 false, 33 ), 34 'NIGHTLY_NAME'=>array( 35 "", 36 true, 37 ), 38 'SVN_REVISION'=> array( 39 false, 40 ), 41 ); 11 42 include(dirname(__FILE__).'/lib/jBuild.inc.php'); 12 13 Env::init(array(14 'MAIN_TARGET_PATH', // repertoire o� sources seront d�s�15 'VERSION',16 'APPNAME',17 ));18 19 Env::initBool(array(20 'PACKAGE_TAR_GZ', // indique de cr� un paquet tar.gz21 'PACKAGE_ZIP', // indique de cr� un paquet zip22 'NIGHTLY_NAME',23 ));24 43 25 44 //----------------- Preparation des variables d'environnement … … 37 56 $VERSION = 'SVN-'.$SVN_REVISION; 38 57 39 Env::set('MAIN_TARGET_PATH', '_dist', true);40 41 42 58 if($PACKAGE_TAR_GZ || $PACKAGE_ZIP ){ 43 59 if($NIGHTLY_NAME) … … 54 70 55 71 //... execution des manifests 56 jManifest::process('build/manifests/'.$APPNAME.'.mn', '.', $MAIN_TARGET_PATH, $GLOBALS);72 jManifest::process('build/manifests/'.$APPNAME.'.mn', '.', $MAIN_TARGET_PATH, ENV::getAll()); 57 73 58 74 trunk/build/buildjbt.php
r293 r345 4 4 * @author Jouanneau Laurent 5 5 * @contributor 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 9 9 */ 10 10 $BUILD_OPTIONS = array( 11 'MAIN_TARGET_PATH'=> array( 12 "main directory where sources will be copied", // signification (false = option cach� 13 '_dist', // valeur par d�ut (boolean = option booleene) 14 '', // regexp pour la valeur ou vide=tout (seulement pour option non booleene) 15 ), 16 'VERSION'=> array( 17 "Version number you want to set for this package", 18 'SVN', 19 '', 20 ), 21 'PACKAGE_TAR_GZ'=>array( 22 "create a tar.gz package", 23 false, 24 ), 25 'PACKAGE_ZIP'=>array( 26 "create a zip package", 27 false, 28 ), 29 'NIGHTLY_NAME'=>array( 30 "", 31 true, 32 ), 33 'SVN_REVISION'=> array( 34 false, 35 ), 36 ); 11 37 include(dirname(__FILE__).'/lib/jBuild.inc.php'); 12 13 Env::init(array(14 'MAIN_TARGET_PATH', // repertoire o� sources seront d�s�15 'VERSION',16 ));17 18 Env::initBool(array(19 'PACKAGE_TAR_GZ', // indique de cr� un paquet tar.gz20 'PACKAGE_ZIP', // indique de cr� un paquet zip21 'NIGHTLY_NAME',22 ));23 38 24 39 //----------------- Preparation des variables d'environnement … … 51 66 52 67 //... execution des manifests 53 jManifest::process('build/manifests/jbuildtools.mn', 'build/', $BUILD_TARGET_PATH, $GLOBALS);68 jManifest::process('build/manifests/jbuildtools.mn', 'build/', $BUILD_TARGET_PATH, ENV::getAll()); 54 69 55 70 trunk/build/buildjelix.php
r327 r345 4 4 * @author Jouanneau Laurent 5 5 * @contributor 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 9 9 */ 10 10 11 $BUILD_OPTIONS = array( 12 'MAIN_TARGET_PATH'=> array( 13 "main directory where sources will be copied", // signification (false = option cach� 14 '_dist', // valeur par d�ut (boolean = option booleene) 15 '', // regexp pour la valeur ou vide=tout (seulement pour option non booleene) 16 ), 17 'PHP_VERSION_TARGET'=> array( 18 "PHP5 version for which jelix will be generated (by default, for all PHP5 version)", 19 '5.0' 20 ), 21 'LIB_VERSION'=> array( 22 "Version of jelix you want to declare (default : SVN)", 23 'SVN', 24 ), 25 'ENABLE_PHP_FILTER'=>array( 26 "true if jelix can use php filter api (api included in PHP>=5.2)", 27 false, 28 ), 29 'ENABLE_PHP_JSON'=>array( 30 "true if jelix can use php json api (api included in PHP>=5.2)", 31 false, 32 ), 33 'ENABLE_PHP_XMLRPC'=>array( 34 "true if jelix can use php xmlrpc api", 35 false, 36 ), 37 'WITH_BYTECODE_CACHE'=> array( 38 "says which bytecode cache engine will be recognized by jelix. Possible values : 'auto' (automatic detection), 'apc', 'eaccelerator' or '' for none", 39 'auto', 40 '/^(auto|apc|eaccelerator)?$/', 41 ), 42 'ENABLE_DEVELOPER'=>array( 43 "include all developers tools in the distribution (simpletest &cie)", 44 true, 45 ), 46 'ENABLE_OPTIMIZE'=>array( 47 "true if you want on optimized version of jelix, for production server", 48 false, 49 ), 50 'STRIP_COMMENT'=>array( 51 "true if you want sources with PHP comments deleted (valid only if ENABLE_OPTIMIZE is true)", 52 false, 53 ), 54 'NIGHTLY_NAME'=>array( 55 "", 56 true, 57 ), 58 'ENABLE_OLD_CLASS_NAMING'=>array( 59 "old module class naming (jelix <= 1.0a5) can be used", 60 true, //TODO false pour la 1.0 finale 61 ), 62 'PACKAGE_TAR_GZ'=>array( 63 "create a tar.gz package", 64 false, 65 ), 66 'PACKAGE_ZIP'=>array( 67 "create a zip package", 68 false, 69 ), 70 'PHP50'=> array( 71 false, // hidden option 72 false, 73 ), 74 'PHP51'=> array( 75 false, 76 false, 77 ), 78 'PHP52'=> array( 79 false, 80 false, 81 ), 82 'SVN_REVISION'=> array( 83 false, 84 ), 85 /*''=> array( 86 "", 87 '', 88 '', 89 ),*/ 90 ); 91 92 93 11 94 include(dirname(__FILE__).'/lib/jBuild.inc.php'); 12 13 Env::init(array(14 'MAIN_TARGET_PATH', // repertoire o� sources seront d�s�15 /*16 'LIB_PATH', // plus tard17 'TEMP_PATH', // plus tard18 'APP_PATH', // plus tard19 'WWW_PATH', // plus tard20 'SCRIPT_PATH', // plus tard21 */22 'PHP_VERSION_TARGET', // version de php pour laquelle il faut g�rer jelix (5.x)23 'LIB_VERSION', // version de lib jelix si on veut forcer un numero de version sp�fique24 ));25 26 if(!isset($GLOBALS['ENABLE_OLD_CLASS_NAMING'])) //TODO �nlever pour la 1.0 finale27 $GLOBALS['ENABLE_OLD_CLASS_NAMING']= '1';28 29 Env::initBool(array(30 'ENABLE_OPTIMIZE', // indique que l'on veut une version optimis�pour un serveur de production31 32 // indique les api de php que l'on dispose (jelix n'utilisera alors pas ses propres implementations)33 'ENABLE_PHP_FILTER', // indique �elix d'utiliser l'api filter de php (en standard dans >=5.2)34 'ENABLE_PHP_JSON', // indique �elix d'utiliser l'api json de php (en standard dans >=5.2)35 'ENABLE_PHP_XMLRPC', // indique �elix d'utiliser l'api xmlrpc de php36 37 'ENABLE_DEVELOPER', // indique de cr� une version avec les outils de tests (simpletest &co)38 'PACKAGE_TAR_GZ', // indique de cr� un paquet tar.gz39 'PACKAGE_ZIP', // indique de cr� un paquet zip40 //'PACKAGE_DEB',41 'STRIP_COMMENT',42 'NIGHTLY_NAME',43 44 'ENABLE_OLD_CLASS_NAMING', // indique si on veut activer l'ancien nommage de certaines classes dans45 // jelix < 1.0beta146 ));47 95 48 96 //----------------- Preparation des variables d'environnement … … 54 102 $LIB_VERSION = 'SVN-'.$SVN_REVISION; 55 103 56 Env::set('MAIN_TARGET_PATH', '_dist', true);57 /*58 Env::set('LIB_PATH' , $MAIN_TARGET_PATH, true);59 Env::set('TEMP_PATH', $MAIN_TARGET_PATH, true);60 Env::set('APP_PATH' , $MAIN_TARGET_PATH, true);61 Env::set('WWW_PATH' , $MAIN_TARGET_PATH, true);62 Env::set('SCRIPT_PATH', $MAIN_TARGET_PATH, true);63 */64 65 104 if($PHP_VERSION_TARGET){ 66 105 if(version_compare($PHP_VERSION_TARGET, '5.2') > -1){ … … 69 108 $ENABLE_PHP_JSON = 1; 70 109 $PHP52 = 1; 110 }elseif(version_compare($PHP_VERSION_TARGET, '5.1') > -1){ 111 $PHP51=1; 112 }else{ 113 $PHP50=1; 71 114 } 72 73 if($PHP_VERSION_TARGET == '5.1') $PHP51=1;74 if($PHP_VERSION_TARGET == '5.0') $PHP50=1;75 115 }else{ 76 116 // pas de target d�nie : donc php 5.0 … … 109 149 110 150 //... execution des manifests 111 jManifest::process('build/manifests/jelix-lib.mn', '.', $BUILD_TARGET_PATH, $GLOBALS, $STRIP_COMMENT);151 jManifest::process('build/manifests/jelix-lib.mn', '.', $BUILD_TARGET_PATH, ENV::getAll(), $STRIP_COMMENT); 112 152 if(!$ENABLE_OPTIMIZE){ 113 jManifest::process('build/manifests/jelix-no-opt.mn', '.', $BUILD_TARGET_PATH , $GLOBALS, $STRIP_COMMENT);153 jManifest::process('build/manifests/jelix-no-opt.mn', '.', $BUILD_TARGET_PATH , ENV::getAll(), $STRIP_COMMENT); 114 154 } 115 155 if($ENABLE_DEVELOPER){ 116 jManifest::process('build/manifests/jelix-dev.mn', '.', $BUILD_TARGET_PATH , $GLOBALS);156 jManifest::process('build/manifests/jelix-dev.mn', '.', $BUILD_TARGET_PATH , ENV::getAll()); 117 157 } 118 158 if(!$ENABLE_PHP_JSON){ 119 jManifest::process('build/manifests/lib-json.mn', '.', $BUILD_TARGET_PATH , $GLOBALS);159 jManifest::process('build/manifests/lib-json.mn', '.', $BUILD_TARGET_PATH , ENV::getAll()); 120 160 } 121 jManifest::process('build/manifests/jelix-others.mn','.', $BUILD_TARGET_PATH , $GLOBALS);161 jManifest::process('build/manifests/jelix-others.mn','.', $BUILD_TARGET_PATH , ENV::getAll()); 122 162 123 163 … … 125 165 126 166 // creation du fichier d'infos sur le build 127 128 $infos = 'PHP_VERSION_TARGET="'.($PHP_VERSION_TARGET?$PHP_VERSION_TARGET:'5.x')."\"\n"; 129 $infos .= 'LIB_VERSION="'.$LIB_VERSION."\"\n"; 130 $infos .= 'SVN_REVISION='.$SVN_REVISION."\n"; 131 $infos .= 'ENABLE_OLD_CLASS_NAMING='.$ENABLE_OLD_CLASS_NAMING."\n"; 132 $infos .= 'ENABLE_OPTIMIZE='.($ENABLE_OPTIMIZE?'1':'0')."\n"; 133 $infos .= 'ENABLE_PHP_FILTER='.($ENABLE_PHP_FILTER?'1':'0')."\n"; 134 $infos .= 'ENABLE_PHP_JSON='.($ENABLE_PHP_JSON?'1':'0')."\n"; 135 $infos .= 'ENABLE_PHP_XMLRPC='.($ENABLE_PHP_XMLRPC?'1':'0')."\n"; 136 $infos .= 'ENABLE_DEVELOPER='.($ENABLE_DEVELOPER?'1':'0')."\n"; 137 $infos .= 'STRIP_COMMENT='.($STRIP_COMMENT?'1':'0')."\n"; 167 $infos = 'BUILD_DATE= "'.date('Y-m-d H:i')."\"\n".ENV::getIniContent(array('SVN_REVISION')); 138 168 139 169 file_put_contents($BUILD_TARGET_PATH.'lib/jelix/BUILD', $infos); trunk/build/buildjtpl.php
r293 r345 4 4 * @author Jouanneau Laurent 5 5 * @contributor 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 9 9 */ 10 10 11 $BUILD_OPTIONS = array( 12 'MAIN_TARGET_PATH'=> array( 13 "main directory where sources will be copied", // signification (false = option cach� 14 '_dist', // valeur par d�ut (boolean = option booleene) 15 '', // regexp pour la valeur ou vide=tout (seulement pour option non booleene) 16 ), 17 'VERSION'=> array( 18 "Version number you want to set for this package", 19 'SVN', 20 '', 21 ), 22 'PACKAGE_TAR_GZ'=>array( 23 "create a tar.gz package", 24 false, 25 ), 26 'PACKAGE_ZIP'=>array( 27 "create a zip package", 28 false, 29 ), 30 'NIGHTLY_NAME'=>array( 31 "", 32 true, 33 ), 34 'SVN_REVISION'=> array( 35 false, 36 ), 37 'JTPL_STANDALONE'=> array( 38 false, 39 '1', 40 ), 41 ); 42 11 43 include(dirname(__FILE__).'/lib/jBuild.inc.php'); 12 13 Env::init(array(14 'MAIN_TARGET_PATH', // repertoire o� sources seront d�s�15 'VERSION',16 ));17 18 Env::initBool(array(19 'PACKAGE_TAR_GZ', // indique de cr� un paquet tar.gz20 'PACKAGE_ZIP', // indique de cr� un paquet zip21 'NIGHTLY_NAME',22 ));23 44 24 45 //----------------- Preparation des variables d'environnement … … 51 72 52 73 //... execution des manifests 53 jManifest::process('build/manifests/jtpl-standalone.mn', '.', $BUILD_TARGET_PATH, $GLOBALS);74 jManifest::process('build/manifests/jtpl-standalone.mn', '.', $BUILD_TARGET_PATH, ENV::getAll()); 54 75 55 76 trunk/build/buildmodules.php
r312 r345 4 4 * @author Jouanneau Laurent 5 5 * @contributor 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html 9 9 */ 10 $BUILD_OPTIONS = array( 11 'MAIN_TARGET_PATH'=> array( 12 "main directory where sources will be copied", // signification (false = option cach� 13 '_dist', // valeur par d�ut (boolean = option booleene) 14 '', // regexp pour la valeur ou vide=tout (seulement pour option non booleene) 15 ), 16 'PACKAGE_TAR_GZ'=>array( 17 "create a tar.gz package", 18 false, 19 ), 20 'PACKAGE_ZIP'=>array( 21 "create a zip package", 22 false, 23 ), 24 'NIGHTLY_NAME'=>array( 25 "", 26 true, 27 ), 28 'SVN_REVISION'=> array( 29 false, 30 ), 31 ); 10 32 11 33 include(dirname(__FILE__).'/lib/jBuild.inc.php'); 12 13 Env::init(array(14 'MAIN_TARGET_PATH', // repertoire o� sources seront d�s�15 ));16 17 Env::initBool(array(18 'PACKAGE_TAR_GZ', // indique de cr� un paquet tar.gz19 'PACKAGE_ZIP', // indique de cr� un paquet zip20 'NIGHTLY_NAME',21 ));22 34 23 35 //----------------- Preparation des variables d'environnement … … 47 59 48 60 //... execution des manifests 49 jManifest::process('build/manifests/jelix-modules.mn', 'lib/jelix-modules/', $MAIN_TARGET_PATH.$BUILD_SUBPATH, $GLOBALS);61 jManifest::process('build/manifests/jelix-modules.mn', 'lib/jelix-modules/', $MAIN_TARGET_PATH.$BUILD_SUBPATH, ENV::getAll()); 50 62 51 63 //... packages trunk/build/lib/jBuild.inc.php
r322 r345 4 4 * @author Jouanneau Laurent 5 5 * @contributor 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html … … 17 17 require_once(dirname(__FILE__).'/jCmdUtils.class.php'); 18 18 19 20 21 19 class Env { 22 20 21 static protected $variables_def = array(); 22 23 23 private function __construct(){ } 24 24 25 26 27 static public function set($name,$value, $onlyIfNotExists=false){ 28 if($onlyIfNotExists && isset($GLOBALS[$name]) && $GLOBALS[$name] !='') return; 29 if(!self::verifyName($name)) return; 30 $GLOBALS[$name]=$value; 31 } 32 33 static public function addArray($arr){ 34 foreach($arr as $k=>$v){ 35 if(self::verifyName($k)) 36 $GLOBALS[$k]=$v; 25 static public function init($build_options){ 26 self::$variables_def = $build_options; 27 foreach($build_options as $name=>$def){ 28 if(!isset($def[1])){ 29 self::$variables_def[$name][1]=''; 30 } 31 if(!isset($def[2]) && !is_bool(self::$variables_def[$name][1])){ 32 self::$variables_def[$name][2]=''; 33 } 34 self::storeValue($name,self::$variables_def[$name][1]); 35 } 36 } 37 38 static public function getAll($getHiddenOption = true){ 39 $values =array(); 40 foreach(self::$variables_def as $name=>$def){ 41 if($def[0] === false && $getHiddenOption == false){ 42 continue; 43 } 44 if(is_bool($def[1])){ 45 if($GLOBALS[$name] != '0') 46 $values[$name] = true; 47 else 48 $values[$name] = false; 49 }else{ 50 $values[$name] = $GLOBALS[$name]; 51 } 52 } 53 54 return $values; 55 } 56 57 static public function set($name,$value){ 58 if(!self::verifyName($name)){ 59 echo "warning: unknow option name ($name)\n"; 60 }else{ 61 self::storeValue($name,$value); 37 62 } 38 63 } … … 41 66 if($arr = parse_ini_file($file,false)){ 42 67 foreach($arr as $k=>$v){ 43 if(self::verifyName($k)) 44 $GLOBALS[$k]=$v; 45 } 46 }else{ 47 die("can't read ini file\n"); 48 } 49 } 50 51 static public function init($varnames){ 52 foreach($varnames as $name){ 53 if(!isset($GLOBALS[$name]) && self::verifyName($name)) 54 $GLOBALS[$name] = ''; 55 } 56 } 57 58 static public function initBool($varnames){ 59 foreach($varnames as $name){ 60 if(!self::verifyName($name)) continue; 61 62 if(isset($GLOBALS[$name]) && $GLOBALS[$name] != '0'){ 63 if($GLOBALS[$name] != '') $GLOBALS[$name] = '1'; 64 }else{ 65 $GLOBALS[$name] = ''; 66 } 68 if(self::verifyName($k)){ 69 self::storeValue($k,$v); 70 }else{ 71 echo "warning: unknow option name ($name) in the ini file\n"; 72 } 73 } 74 }else{ 75 throw new Exception("can't read ini file\n"); 67 76 } 68 77 } … … 70 79 static public function setFromFile($name,$file, $onlyIfNotExists=false){ 71 80 if($onlyIfNotExists && isset($GLOBALS[$name]) && $GLOBALS[$name] !='') return; 72 if(!self::verifyName($name)) return; 73 $GLOBALS[$name]=file_get_contents($file); 74 } 75 76 static public function verifyName($name, $verbose=true){ 81 if(!self::verifyName($name)){ 82 echo "warning: unknow option name ($name)\n"; 83 }else{ 84 self::storeValue($name,file_get_contents($file)); 85 } 86 87 } 88 89 static protected function verifyName($name, $verbose=true){ 77 90 static $var= array('_ENV','_GET','_POST','_SERVER','GLOBALS','_FILES', '_COOKIE', 78 91 'HTTP_ENV_VARS','HTTP_POST_VARS','HTTP_GET_VARS','HTTP_COOKIE_VARS', … … 80 93 81 94 if(in_array($name,$var )){ 82 if($verbose) echo "warning: invalid variable name ($name)\n"; 95 throw new Exception("forbidden option name ($name)"); 96 }elseif(!isset(self::$variables_def[$name])){ 83 97 return false; 84 98 }else{ 85 99 return true; 86 100 } 87 88 } 89 101 } 102 103 static protected function storeValue($name,$value){ 104 if(is_bool(self::$variables_def[$name][1])){ 105 if($value == 'true' || $value === true || $value == 1 || $value == 'on' || $value=='yes') 106 $value='1'; 107 else 108 $value='0'; 109 }else{ 110 if($value == ''){ 111 if(self::$variables_def[$name][2] != '' && !preg_match(self::$variables_def[$name][2], $value)){ 112 $value = self::$variables_def[$name][1]; 113 } 114 }else{ 115 if(self::$variables_def[$name][2] != ''){ 116 if(!preg_match(self::$variables_def[$name][2], $value)){ 117 throw new Exception("bad value setting for the variable $name"); 118 } 119 } 120 } 121 } 122 123 $GLOBALS[$name]=$value; 124 } 125 126 static public function help($showHiddenOption = false){ 127 $help="Available build options :\n\n"; 128 foreach(self::$variables_def as $name=>$def){ 129 if($def[0] === false && $showHiddenOption == false){ 130 continue; 131 } 132 $help.=$name."\n"; 133 if($def[0] != '') 134 $help.="\t".$def[0]."\n"; 135 // type 136 if(is_bool($def[1])){ 137 $help.="\t(boolean) default value: ".($def[1]?'1':'0')."\n"; 138 }elseif($def[1] != ''){ 139 $help.="\t default value: ".$def[1]."\n"; 140 } 141 } 142 $help.="\n\n"; 143 return $help; 144 } 145 146 static public function getIniContent($showHiddenOption = false){ 147 $ini=''; 148 foreach(self::$variables_def as $name=>$def){ 149 if($def[0] === false && $showHiddenOption === false){ 150 continue; 151 } 152 if($def[0] === false && is_array($showHiddenOption)){ 153 if(!in_array($name,$showHiddenOption)) 154 continue; 155 } 156 if(is_bool($def[1])){ 157 $ini.=$name."=".($GLOBALS[$name]?'1':'0')."\n"; 158 }else{ 159 $value = $GLOBALS[$name]; 160 if ($value == '' || is_numeric($value) || preg_match("/^[\w]*$/", $value)) { 161 $ini.=$name."=".$value."\n"; 162 } else { 163 $ini.=$name."=\"".$value."\"\n"; 164 } 165 } 166 } 167 return $ini; 168 } 90 169 } 91 170 … … 113 192 114 193 function init(){ 115 $sws = array('-v'=>false, '-D'=>2); 194 195 $sws = array('-v'=>false, '-h'=>false, '-ini'=>false, '-D'=>2); 116 196 $params = array('ini'=>true); 117 197 … … 133 213 ENV::set('VERBOSE_MODE',true); 134 214 } 215 if(isset($switches['-h'])){ 216 echo ENV::help(); 217 exit(0); 218 } 219 if(isset($switches['-ini'])){ 220 echo ENV::getIniContent(); 221 exit(0); 222 } 135 223 } 136 224 … … 147 235 148 236 try{ 237 if(!isset($BUILD_OPTIONS)) 238 throw new Exception('$BUILD_OPTIONS variable is missing in your build file'); 239 240 $BUILD_OPTIONS['VERBOSE_MODE']=array("",false); 241 ENV::init($BUILD_OPTIONS); 242 149 243 init(); 244 150 245 }catch(Exception $e){ 151 echo " jBuildTools error : " , $e->getMessage(),"\n";152 echo " options : [-v ] [-D foo=bar]* fichier.ini246 echo "\n\njBuildTools error : " , $e->getMessage(),"\n"; 247 echo " options : [-vh] [-D foo=bar]* fichier.ini 153 248 -v : verbose mode 154 249 -D : declare a variable and its value 250 -h : only display list of build options 155 251 "; 156 252 trunk/build/lib/preprocessor.lib.php
r315 r345 2 2 /** 3 3 * @package jBuildTools 4 * @version $Id$5 4 * @author Jouanneau Laurent 6 5 * @contributor 7 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 8 7 * @link http://www.jelix.org 9 8 * @licence GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html … … 193 192 $source[$nb]=false; 194 193 194 }elseif(preg_match('/^\#ifnot\s(.*)$/m',$line,$m)){ 195 if( !$isOpen ){ 196 array_push($this->_blockstack, self::BLOCK_IF_NO); 197 }else{ 198 $val = $this->evalExpression($m[1], $filename,$nb); 199 if($val){ 200 array_push($this->_blockstack, self::BLOCK_IF_NO); 201 }else{ 202 array_push($this->_blockstack, self::BLOCK_IF_YES); 203 } 204 } 205 $source[$nb]=false; 206 }elseif(preg_match('/^\#elseif\s(.*)$/m',$line,$m)){ 207 $end = array_pop($this->_blockstack); 208 if(!($end & self::BLOCK_IF)){ 209 throw new jExceptionPreProc($filename,$nb,self::ERR_IF_MISSING); 210 } 211 if(end($this->_blockstack) & self::BLOCK_NO){ 212 array_push($this->_blockstack, self::BLOCK_IF_NO); 213 }elseif(($end & self::BLOCK_YES) || ($end & self::BLOCK_YES_PREVIOUS)){ 214 array_push($this->_blockstack, (self::BLOCK_IF_NO + self::BLOCK_YES_PREVIOUS)); 215 }else{ 216 $val = $this->evalExpression($m[1], $filename,$nb); 217 if($val){ 218 array_push($this->_blockstack, self::BLOCK_IF_YES); 219 }else{ 220 array_push($this->_blockstack, self::BLOCK_IF_NO); 221 } 222 } 223 $source[$nb]=false; 195 224 }elseif(preg_match('/^\#(endif|else)\s*$/m',$line,$m)){ 196 225 if($m[1] == 'endif'){ trunk/build/manifests/jelix-lib.mn
r340 r345 30 30 cd lib/jelix/core 31 31 ! defaultconfig.ini.php 32 jConfigCompiler.class.php32 * jConfigCompiler.class.php 33 33 34 34 cd lib/jelix/core/request trunk/build/manifests/jelix-no-opt.mn
r335 r345 1 1 cd lib/jelix/core 2 jConfig.class.php2 * jConfig.class.php 3 3 jContext.class.php 4 4 jController.class.php trunk/lib/jelix/core/jConfig.class.php
r334 r345 5 5 * @author Jouanneau Laurent 6 6 * @contributor 7 * @copyright 2005-200 6Jouanneau laurent7 * @copyright 2005-2007 Jouanneau laurent 8 8 * @link http://www.jelix.org 9 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 35 35 static public function load($configFile){ 36 36 $config=array(); 37 $file = JELIX_APP_TEMP_PATH.$configFile.'.resultini.php'; 37 #if WITH_BYTECODE_CACHE == 'auto' 38 if(BYTECODE_CACHE_EXISTS) 39 $file = JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.conf.php'; 40 else 41 $file = JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.resultini.php'; 42 #elseif WITH_BYTECODE_CACHE 43 $file = JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.conf.php'; 44 #else 45 $file = JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.resultini.php'; 46 #endif 38 47 $compil=false; 39 48 if(!file_exists($file)){ … … 46 55 $compil=true; 47 56 }else{ 57 #if WITH_BYTECODE_CACHE == 'auto' 58 if(BYTECODE_CACHE_EXISTS){ 59 include($file); 60 }else{ 61 $config = parse_ini_file($file,true); 62 } 63 #elseif WITH_BYTECODE_CACHE 64 include($file); 65 #else 48 66 $config = parse_ini_file($file,true); 67 #endif 49 68 $config = (object) $config; 69 50 70 if($config->compilation['checkCacheFiletime']){ 51 71 $compil = self::_verifpath($config->modulesPath,$t); trunk/lib/jelix/core/jConfigCompiler.class.php
r341 r345 5 5 * @author Jouanneau Laurent 6 6 * @contributor 7 * @copyright 2006 Jouanneau laurent7 * @copyright 2006-2007 Jouanneau laurent 8 8 * @link http://www.jelix.org 9 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 69 69 $config['urlengine']['basePath'] = $path; 70 70 } 71 #if WITH_BYTECODE_CACHE == 'auto' 72 if(BYTECODE_CACHE_EXISTS){ 73 $filename=JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.conf.php'; 74 if ($f = @fopen($filename, 'wb')) { 75 fwrite($f, '<?php $config = '.var_export($config,true).";\n?>"); 76 fclose($f); 77 } else { 78 throw new Exception('(24)Error while writing config cache file '.$filename); 79 } 80 }else{ 81 jIniFile::write($config, JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.resultini.php'); 82 } 83 #elseif WITH_BYTECODE_CACHE 84 $filename=JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.conf.php'; 85 if ($f = @fopen($filename, 'wb')) { 86 fwrite($f, '<?php $config = '.var_export($config,true).";\n?>"); 87 fclose($f); 88 } else { 89 throw new Exception('(24)Error while writing config cache file '.$filename); 90 } 91 #else 71 92 jIniFile::write($config, JELIX_APP_TEMP_PATH.str_replace('/','~',$configFile).'.resultini.php'); 93 #endif 72 94 $config = (object) $config; 73 95 return $config; trunk/lib/jelix/core/jController.class.php
r334 r345 5 5 * @author Laurent Jouanneau 6 6 * @contributor Loic Mathaud 7 * @copyright 2005-200 6Laurent Jouanneau, 2006 Loic Mathaud7 * @copyright 2005-2007 Laurent Jouanneau, 2006 Loic Mathaud 8 8 * @link http://www.jelix.org 9 9 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file … … 59 59 60 60 /** 61 * jZone:: processZonealias61 * jZone::get alias 62 62 * @param string $name zone selector 63 63 * @param array $params associative array, parameters 64 64 */ 65 65 protected function processZone($name, $params=array ()){ 66 return jZone:: processZone($name, $params);66 return jZone::get ($name, $params); 67 67 } 68 68 trunk/lib/jelix/core/jSelector.class.php
r338 r345 12 12 * @author Laurent Jouanneau 13 13 * @contributor 14 * @copyright 2005-200 6Laurent Jouanneau14 * @copyright 2005-2007 Laurent Jouanneau 15 15 * @link http://www.jelix.org 16 16 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 247 247 248 248 public function getClass(){ 249 #if defENABLE_OLD_CLASS_NAMING249 #if ENABLE_OLD_CLASS_NAMING 250 250 $className = $this->controller.'Ctrl'; 251 251 if($GLOBALS['gJConfig']->enableOldClassNaming && !class_exists($className,false)){ … … 501 501 } 502 502 503 public function getCompiledBuildFilePath (){ 504 return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->module.'~'.$this->resource.'_htmlbuilder'.$this->_cacheSuffix;; 505 } 503 506 } 504 507 trunk/lib/jelix/core/response/jResponseJson.class.php
r338 r345 5 5 * @author Laurent Jouanneau 6 6 * @contributor 7 * @copyright 2006 Laurent Jouanneau7 * @copyright 2006-2007 Laurent Jouanneau 8 8 * @link http://www.jelix.org 9 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 10 */ 11 11 12 #ifn defENABLE_PHP_JSON12 #ifnot ENABLE_PHP_JSON 13 13 /** 14 14 * … … 39 39 if($this->hasErrors()) return false; 40 40 header("Content-Type: text/plain"); 41 #if defENABLE_PHP_JSON41 #if ENABLE_PHP_JSON 42 42 $content = json_encode($this->datas); 43 43 #else … … 62 62 } 63 63 header("Content-Type: text/plain"); 64 #if defENABLE_PHP_JSON64 #if ENABLE_PHP_JSON 65 65 $content = json_encode($message); 66 66 #else trunk/lib/jelix/core/url/jUrlEngine.significant.class.php
