install
[ class tree: install ] [ index: install ] [ all elements ]

Source for file create_config_inc.php

Documentation is available at create_config_inc.php

  1. <?php
  2. /**
  3.  * @version $Header: /cvsroot/bitweaver/_bit_install/create_config_inc.php,v 1.16 2006/11/15 12:24:35 squareing Exp $
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. /**
  9.  * create_config
  10.  */
  11.  
  12. /**
  13.  * create configuration file
  14.  *
  15.  * @param string  $pParamHash['gBitDbType'] 
  16.  * @param string  $pParamHash['gBitDbHost'] 
  17.  * @param string  $pParamHash['gBitDbUser'] 
  18.  * @param string  $pParamHash['gBitDbPassword'] 
  19.  * @param string  $pParamHash['gBitDbName'] 
  20.  * @param numeric $pParamHash['gBitDbCaseSensitivity'] 
  21.  * @param string  $pParamHash['bit_db_prefix'] 
  22.  * @param string  $pParamHash['bit_root_url'] 
  23.  * @param boolean $pParamHash['auto_bug_submit'] 
  24.  * @param boolean $pParamHash['is_live'] 
  25.  * @access public
  26.  * @return void 
  27.  */
  28. function create_config$pParamHash {
  29.     // assign values to their keys
  30.     extract$pParamHash );
  31.  
  32.     $bit_db_prefix  empty$bit_db_prefix "" $bit_db_prefix;
  33.  
  34.     $gBitDbType     addslashes$gBitDbType );
  35.     $gBitDbHost     addslashes$gBitDbHost );
  36.     $gBitDbUser     addslashes$gBitDbUser );
  37.     $gBitDbPassword addslashes$gBitDbPassword );
  38.     $gBitDbName     addslashes$gBitDbName );
  39.     $bit_db_prefix  addslashes$bit_db_prefix );
  40.  
  41.     ifpreg_match'/\./'$bit_db_prefix ) ) {
  42.         if$gBitDbType == 'mysql' {
  43.             $bit_db_prefix preg_replace'/[`.]/'''$bit_db_prefix );
  44.         elseif!preg_match'/`\.`/'$bit_db_prefix ) ) {
  45.             $bit_db_prefix preg_replace'/\./''`.`'$bit_db_prefix );
  46.         }
  47.     }
  48.  
  49.     $config_file empty$_SERVER['CONFIG_INC''../kernel/config_inc.php' $_SERVER['CONFIG_INC'];
  50.  
  51.     // We can't call clean_file_path here even though we would like to.
  52.     $config_file strpos$_SERVER["SERVER_SOFTWARE"],"IIS" str_replace"/""\\"$config_file $config_file );
  53.  
  54.     $fw fopen$config_file'w' );
  55.     ifisset$fw ) ) {
  56.         $filetowrite="<?php
  57. // Copyright (c) 2006, bitweaver.org
  58. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE.
  59.  
  60. // The following line is required and should not be altered
  61. global \$gBitDbType, \$gBitDbHost, \$gBitDbUser, \$gBitDbPassword, \$gBitDbName, \$gBitDbCaseSensitivity, \$smarty_force_compile, \$gDebug, \$gPreScan;
  62.  
  63.  
  64.              /******************************************************\
  65.               ***************   Database settings   **************** 
  66.              \******************************************************/
  67.  
  68. // You can choose between different Database abstraction layersCurrently we support:
  69. //    adodb          ADODB
  70. //                   this is the default setting and is bundled with bitweaver
  71. //    pear           PEAR::DB
  72. //                   when using thisyou can even remove the util/adodb directory
  73. \$gBitDbSystem = \"adodb\";
  74.  
  75.  
  76. // bitweaver can store its data in multiple different back-endsCurrently we
  77. // support MySQLMSSQLFirebirdSybasePostgreSQL and Oracle.  Enter the
  78. // hostname where your database livesand the username and password you use to
  79. // connect to it.
  80. //
  81. // You must specify the name of a database that already existsbitweaver will not
  82. // create the database for youbecause it's very difficult to do that in a
  83. // reliabledatabase-neutral fashionThe user that you use should have the
  84. // following permissions:
  85. //
  86. //    SELECTINSERTUPDATEDELETECREATEALTERDROP
  87. //
  88. // The possible database types that we support are:
  89. //    mysql          Standard MySQL
  90. //    mysqli         New MySQL driver
  91. //    sqlite         SQLLite
  92. //    mssql          MS-SQL (experimental)
  93. //    postgres       PostgreSQL 7.x
  94. //    oci8po         Oracle (9i and newer)
  95. //    firebird       FireBird
  96. //    sybase         Sybase
  97. \$gBitDbType    = \"$gBitDbType\";
  98.  
  99. // Hostname or IP for your database.
  100. // Some examples:
  101. //    'localhostif you are running the database on the same machine as bitweaver
  102. //    If you use Oracleinsert your TNS Name here
  103. //    If you use SQLiteinsert the path and filename to your database file
  104. \$gBitDbHost  = \"$gBitDbHost\";
  105.  
  106. // Database username
  107. \$gBitDbUser  = \"$gBitDbUser\";
  108.  
  109. // Database password
  110. \$gBitDbPassword  = \"$gBitDbPassword\";
  111.  
  112. // Database name
  113. \$gBitDbName   = \"$gBitDbName\";
  114.  
  115. // Database field case default
  116. \$gBitDbCaseSensitivity = \"$gBitDbCaseSensitivity\";
  117.  
  118. // This prefix will be prepended to the begining of every table name to allow
  119. // multiple independent installs to share a single databaseBy ending the prefix
  120. // with a '.' (periodyou can use a schema in systems that support itBackticks
  121. // '`' around the '.' are required if presentA schema example is: 'bit`.`'
  122. define( 'BIT_DB_PREFIX', '$bit_db_prefix' );
  123.  
  124.  
  125.              /******************************************************\
  126.               *************** Environment Settings  **************** 
  127.              \******************************************************/
  128.  
  129. // Setting IS_LIVE to TRUE will let the application know that this site is a live
  130. // production site and is not used for testing purposes.  This will prevent any
  131. // nasty error pages from appearing and will redirect the user to a 'nicererror
  132. // pageErrors should still show up in your error logsPlease use these when
  133. // submitting bugs to http://sourceforge.net/tracker/?group_id=141358&atid=749176
  134. define( 'IS_LIVE', $is_live );
  135.  
  136.  
  137. // if you set AUTO_BUG_SUBMIT to TRUE bitweaver will automatically email the team
  138. // with details regarding the error.  Alternatively you can submit bugs to
  139. // http://sourceforge.net/tracker/?group_id=141358&atid=749176 which will probably
  140. // get processed faster since more people have access to these.
  141. define( 'AUTO_BUG_SUBMIT', $auto_bug_submit );
  142.  
  143.  
  144. // This is the path from the server root to your bitweaver location.  i.eif you
  145. // access bitweaver as 'http://MyServer.com/applications/new/wiki/index.phpyou
  146. // should enter '/applications/new/'
  147. define( 'BIT_ROOT_URL', '$bit_root_url' );
  148.  
  149.  
  150. // This allows you to set a custom path to your PHP tmp directory - used for ADODB
  151. // caching if activeand other stuff This is usually only needed in very
  152. // restrictive hosting environments.
  153. //\$gTempDir = '/path/to/private/directory';
  154.  
  155.  
  156. // \$gPreScan can be used to specify the order in which packages are scanned by
  157. // the kernel.  In the example provided belowthe kernel package is processed
  158. // firstfollowed by the users and liberty packages.  Any packages not specified
  159. // in \$gPreScan are processed in the traditional order
  160. //\$gPreScan = array( 'kernel', 'users', 'liberty' );
  161.  
  162.  
  163.              /******************************************************\
  164.               ***************   Debugging Options   **************** 
  165.              \******************************************************/
  166.  
  167. // If you wish to force compiling of every pageyou can set the next setting to
  168. // TRUEthis willhoweverseverly impact performance since every page that is
  169. // generated is generated afresh and the cache is recreated every time.
  170. \$smarty_force_compile = FALSE;
  171.  
  172.  
  173. // Setting TEMPLATE_DEBUG = TRUE will output <!-- <called templates> --> in your
  174. // templateswhich will allow you to track all used templates in the HTML source
  175. // of the pageThis will also disable stripping of whitespace making it easier to
  176. // read the templatesYou will only see the effect of the strip changes by
  177. // clearing out your cache or setting \$smarty_force_compile = TRUE;
  178. // Notebe sure to set this to FALSE and clear out the cache once done since it
  179. //       will increase the page size by at least 10%.
  180. //define( 'TEMPLATE_DEBUG', TRUE );
  181.  
  182.  
  183. // This statement will enable you to view all database queries made
  184. //\$gDebug = TRUE;
  185.  
  186.  
  187. // This will turn on ADODB performance monitoring and log all queriesThis should
  188. // not be enabled except when doing query analysis due to an overall performance
  189. // drop.  see kernel/admin/db_performance.php for statistics
  190. //define( 'DB_PERFORMANCE_STATS', TRUE );
  191.  
  192. ?>";
  193.         fwrite$fw$filetowrite );
  194.         fclose$fw );
  195.     else {
  196.         print "UNABLE TO WRITE TO ".realpath$config_file );
  197.     }
  198. }
  199.  
  200. ?>

Documentation generated on Thu, 15 Feb 2007 20:36:04 +0000 by phpDocumentor 1.3.0