Changeset 192 for trunk/trax/data

Show
Ignore:
Timestamp:
03/27/06 15:02:53 (6 years ago)
Author:
haas
Message:

working Pear install w/ tests

Location:
trunk/trax/data
Files:
4 added
1 removed
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/data/config/database.ini

    r182 r192  
     1;;; 
     2;;;  Description of the database used by Trax 
     3;;;  in each of the three modes of operation 
     4;;; 
     5;;;  Edit the descriptions below to match the actual database name, 
     6;;;  host location, username and password for each database. 
     7;;; 
     8;;;  This file is parsed by parse_ini_file().  See 
     9;;;  http://www.php.net/manual/en/function.parse-ini-file.php 
     10;;; 
    111[development] 
    212    phptype = mysql 
  • trunk/trax/data/config/environment.php

    r182 r192  
    11<?php 
    22/** 
     3 *  Trax runtime environment definitions 
    34 *  @package PHPonTrax 
    45 */ 
    5 # include path for your php libs (PEAR etc) 
    6 define("PHP_LIB_ROOT",          "/usr/local/lib/php"); 
    7 define("TRAX_ROOT",             dirname(dirname(__FILE__)) . "/"); 
    8 define("TRAX_PUBLIC",           dirname(dirname(dirname(__FILE__)))."/public"); 
     6 
     7/** 
     8 *  Location of the PEAR library on this system 
     9 * 
     10 *  Set automatically by the Pear installer when you install Trax with 
     11 *  the <b>pear install</b> command.  If you are prevented from using 
     12 *  <b>pear install</b>, change "@PHP-DIR@" by hand to the full filesystem 
     13 *  path of the location where you installed the Pear modules needed 
     14 *  by Trax. 
     15 */ 
     16define("PHP_LIB_ROOT", "@PHP-DIR@"); 
     17 
     18/** 
     19 *  Location of the directories constructed by the <b>trax</b> 
     20 *  command. 
     21 */ 
     22define("TRAX_ROOT", dirname(dirname(__FILE__)) . "/"); 
     23 
     24/** 
     25 *  Location of the directory exposed to the public by Apache. 
     26 * 
     27 *  The <b>trax</b> command generates this as <i>TRAX_ROOT</i>/public/ 
     28 *  but you will probably want to move the files in public/ to somewhere under 
     29 *  {@link http://httpd.apache.org/docs/2.0/  Apache} 
     30 *  {@link http://httpd.apache.org/docs/2.0/mod/core.html#documentroot DocumentRoot}. 
     31 *  Change the second argument to the full filesystem path to the 
     32 *  directory that holds the files generated in public/ 
     33 */ 
     34define("TRAX_PUBLIC", dirname(dirname(dirname(__FILE__)))."/public"); 
     35 
     36/** 
     37 *  Part of URL between domain name and Trax application 
     38 * 
     39 *  That part of the browser's URL after the domain name and before 
     40 *  the location described by <i>TRAX_PUBLIC</i>.  If 
     41 *  <i>TRAX_PUBLIC</i> is the same as 
     42 *  {@link http://httpd.apache.org/docs/2.0/  Apache} 
     43 *  {@link http://httpd.apache.org/docs/2.0/mod/core.html#documentroot DocumentRoot},  
     44 *  then TRAX_URL_PREFIX is null. 
     45 */ 
    946define("TRAX_URL_PREFIX",       null); # no leading or trailing slashes 
     47 
     48/** 
     49 *  The file extension of files in app/views.  Normally '.phtml' 
     50 */ 
    1051define("TRAX_VIEWS_EXTENTION",  "phtml"); 
    1152 
    12 # Set in the Apache Vhost (SetEnv TRAX_MODE development) 
     53/** 
     54 *  Trax mode of operation 
     55 * 
     56 *  Must be one of: 'development', 'test' or 'production'. 
     57 *  May be set in the 
     58 *  {@link http://httpd.apache.org/docs/2.0/  Apache} 
     59 *  configuration with the 
     60 *  {@link  http://httpd.apache.org/docs/2.0/mod/mod_env.html#setenv SetEnv} 
     61 *  directive.  If not set there, then it must be set here. 
     62 */ 
    1363if(isset($_SERVER) && array_key_exists('TRAX_MODE',$_SERVER)) { 
    14     # Set from Env production / development / test 
    1564    define("TRAX_MODE",   $_SERVER['TRAX_MODE']); 
    1665} else { 
    17     # Manually set production / development / test 
    1866    define("TRAX_MODE",   "development"); 
    1967} 
    2068 
     69/** 
     70 *  Location of Trax components relative to TRAX_ROOT 
     71 *  @global $GLOBALS['TRAX_INCLUDES'] 
     72 */ 
    2173$GLOBALS['TRAX_INCLUDES'] = 
    2274    array( "models" => "app/models", 
     
    3082           "app" => "app", 
    3183           "log" => "log", 
    32            "vendor" => "vendor" ); 
    33  
    34 if (substr(PHP_OS, 0, 3) == 'WIN') { 
    35     # Windows 
    36     define("TRAX_PATH_SEPERATOR", ";"); 
    37 } else { 
    38     # Unix 
    39     define("TRAX_PATH_SEPERATOR", ":"); 
    40 } 
    41  
    42 # Set which file to log php errors to for this application 
    43 # As well in your application you can do error_log("whatever") and it will go to this log file. 
    44 ini_set("log_errors", "On"); 
    45 ini_set("error_log", TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['log']."/".TRAX_MODE.".log");  
    46  
     84           "vendor" => "vendor" ); // FIXME: generated by trax cmd 
     85 
     86/** 
     87 *  Set how errors are to be logged 
     88 * 
     89 *  The 'log_errors'  
     90 *  {@link http://www.php.net/manual/en/ref.errorfunc.php PHP configuration setting} 
     91 *  determines whether PHP error messages should be sent to the 
     92 *  {@link http://httpd.apache.org/docs/2.0/  Apache} 
     93 *  {@link http://httpd.apache.org/docs/2.0/logs.html#errorlog error log} 
     94 *  (log_errors false) or to the log file defined in the 'error_log' 
     95 *  setting (log_errors true).  Trax uses a different log file for 
     96 *  each of the three modes defined in TRAX_MODE. 
     97 *   
     98 *  In your application you can write a message to this log file with 
     99 *   the call <b>error_log("</b><i>text of message</i><b>")</b>. 
     100 */ 
     101ini_set("log_errors", true); 
     102ini_set("error_log", 
     103    TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['log']."/".TRAX_MODE.".log");  
     104 
     105/** 
     106 *  Whether to generate debugging messages and send errors to the browser 
     107 * 
     108 *  The 'display_errors'  
     109 *  {@link http://www.php.net/manual/en/ref.errorfunc.php PHP configuration setting} 
     110 *  determines whether error messages should be sent to the browser. 
     111 *  It should be false for production systems.  DEBUG is a define that 
     112 *  you can test for your own purposes. 
     113 */ 
    47114if(TRAX_MODE == "development") { 
    48115    define("DEBUG", true); 
    49     # Display errors to browser if in development mode for debugging 
    50116    ini_set("display_errors", "On"); 
    51117} else { 
    52118    define("DEBUG", false); 
    53     # Hide errors from browser if not in development mode 
    54119    ini_set("display_errors", "Off"); 
    55120} 
    56121 
    57 # Load databse settings 
    58 $GLOBALS['TRAX_DB_SETTINGS'] = parse_ini_file(TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['config']."/database.ini",true); 
    59  
    60 # Should we use local copy of the Trax libs in vendor/trax or 
    61 # the server Trax libs in the php libs dir defined in PHP_LIB_ROOT 
     122/** 
     123 *  Load database settings from config/database.ini 
     124 */ 
     125$GLOBALS['TRAX_DB_SETTINGS'] = 
     126    parse_ini_file(TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['config'] 
     127                   ."/database.ini",true); 
     128/** 
     129 *  Define location of the Trax PHP modules 
     130 * 
     131 *  Should we use local copy of the Trax libs in vendor/trax or 
     132 *  the server Trax libs in the php libs dir defined in PHP_LIB_ROOT 
     133 */ 
    62134if(file_exists(TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['vendor']."/trax")) { 
    63135    define("TRAX_LIB_ROOT", TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['vendor']."/trax"); 
    64 } elseif(file_exists(PHP_LIB_ROOT."/trax")) { 
    65     define("TRAX_LIB_ROOT", PHP_LIB_ROOT."/trax"); 
     136} elseif(file_exists(PHP_LIB_ROOT."/PHPonTrax/vendor/trax")) { 
     137    define("TRAX_LIB_ROOT", PHP_LIB_ROOT."/PHPonTrax/vendor/trax"); 
    66138} else { 
    67     echo "Can't determine where your Trax Libs are located."; 
     139    error_log("Can't determine where your Trax Libs are located."); 
    68140    exit; 
    69141} 
     
    71143# Set the include_path 
    72144ini_set("include_path", 
    73         ".".TRAX_PATH_SEPERATOR.   # current directory 
    74         TRAX_LIB_ROOT.TRAX_PATH_SEPERATOR.  # trax libs (vendor/trax or server trax libs) 
    75         PHP_LIB_ROOT.TRAX_PATH_SEPERATOR.  # php libs dir (ex: /usr/local/lib/php) 
    76         TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['lib'].TRAX_PATH_SEPERATOR. # app specific libs extra libs to include 
     145        ".".PATH_SEPARATOR.   # current directory 
     146        TRAX_LIB_ROOT.PATH_SEPARATOR.  # trax libs (vendor/trax or server trax libs) 
     147        PHP_LIB_ROOT.PATH_SEPARATOR.  # php libs dir (ex: /usr/local/lib/php) 
     148        TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['lib'].PATH_SEPARATOR. # app specific libs extra libs to include 
    77149        ini_get("include_path")); # add on old include_path to end 
    78150 
     
    121193} 
    122194 
     195// -- set Emacs parameters -- 
     196// Local variables: 
     197// tab-width: 4 
     198// c-basic-offset: 4 
     199// c-hanging-comment-ender-p: nil 
     200// indent-tabs-mode: nil 
     201// End: 
    123202?> 
  • trunk/trax/data/public/.htaccess

    r182 r192  
    1 # php include_path to Trax config directory 
    2 php_value include_path .:/home/<username>/trax/config 
     1# 
     2#    PHP include_path to Trax config directory 
     3# 
     4php_value include_path .:@TRAX-CONFIG@ 
    35 
    46# Redirect all requests not available on the filesystem to Trax