Changeset b65617 for install


Ignore:
Timestamp:
07/10/10 14:03:29 (9 years ago)
Author:
pierre-alain <pierre-alain@…>
Branches:
master
Children:
6fd857
Parents:
5fedee
git-author:
pierre-alain <pierre-alain@…> (07/10/10 14:03:29)
git-committer:
pierre-alain <pierre-alain@…> (07/10/10 14:03:29)
Message:

code cleaning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install/cfg-dist.php

    r077f3f rb65617  
    3535 */ 
    3636namespace OWR; 
    37 if(defined('INC_CONFIG'))  
     37if(defined('INC_CONFIG')) 
    3838    die("can't include config file more than one time"); 
    39 if(!defined('PATH') || !defined('HOME_PATH'))  
     39if(!defined('PATH') || !defined('HOME_PATH')) 
    4040    die('please define constants HOME and HOME_PATH before including the config file'); 
    4141 
     
    5050$cfg['begintime'] = microtime(true); 
    5151 
     52/**************************************** START EDITING HERE ****************************************/ 
     53/** 
     54 * Please have a look at http://trac.openwebreader.org/wiki/Configuration 
     55 */ 
     56/* db config */ 
     57$cfg['dbname']                  = 'openwebreader'; 
     58$cfg['dbhost']                  = 'localhost'; 
     59$cfg['dbport']                  = '3306'; 
     60$cfg['dbdriver']                = 'mysql'; 
     61$cfg['dbuser']                  = 'openwebreader'; 
     62$cfg['dbpasswd']                = 'openwebreader'; 
     63// generally /var/run/mysqld.sock or /tmp/mysql.sock 
     64$cfg['dbsocket']                = '/var/run/mysqld/mysqld.sock'; 
     65$cfg['dsn']                     = $cfg['dbdriver'].':dbname='.$cfg['dbname'] . 
     66                                    ';host='.$cfg['dbhost'].';port='.$cfg['dbport'] . 
     67                                    ';unix_socket='.$cfg['dbsocket']; 
     68$cfg['dbCacheTime']             = 86400 * 7; // 24h * 7 
     69 
     70/* host config */ 
     71$cfg['url']                     = 'openwebreader.mydomain.tld'; 
     72$cfg['path']                    = '/'; // MUST ends with '/' 
     73$cfg['httpsecure']              = false; // set to true if owr will be used over SSL (HTTPS) 
     74$cfg['surl']                    = 'http'.($cfg['httpsecure'] ? 's' : '').'://'.$cfg['url'].$cfg['path']; 
     75 
     76/* templates cache time, default to 24h * 7 */ 
     77$cfg['cacheTime']               = 86400 * 7; 
     78/* session life time, default to 24h */ 
     79$cfg['sessionLifeTime']         = 86400; 
     80 
     81/* server config */ 
     82// default temporary directory 
     83// please keep this OUT of public web server access 
     84$cfg['defaultTmpDir']           = sys_get_temp_dir().DIRECTORY_SEPARATOR; 
     85// max upload file size, in octets, default to 5mo 
     86$cfg['maxUploadFileSize']       = 5120000; 
     87// path to php executable 
     88// please let empty open_basedir 
     89$cfg['phpbin']                  = '/usr/bin/php -d open_basedir= '; 
     90// default ttl, in minutes, used if no ttl is found while parsing a stream 
     91$cfg['defaultStreamRefreshTime'] = 60; 
     92// default minimum ttl, in minutes, used for checking ttl found while parsing a stream 
     93$cfg['defaultMinStreamRefreshTime'] = 30; 
     94// set to "index" for uri like /index.php?do=action, "action" for uri like /action? 
     95// look at file HOME/.htaccess for url-rewriting 
     96$cfg['uriStyle']                = 'index'; 
     97// max log file size, in octets, default to 5mo 
     98$cfg['maxLogFileSize']          = 5120000; 
     99// maximum number of PHP threads that OWR can launch simultaneously 
     100// if you have an old server, maybe set this to 2, else 5 is not bad 
     101$cfg['maxThreads']              = 5; 
     102// nice command used to lower process priority, default "nice -n 10 " 
     103// (MUST ends with a space if you use it) 
     104$cfg['nicecmd']                 = 'nice -n 10 '; 
     105// command used to get the number of process used by OWR, default 'ps aux | grep "%s" | grep -v grep' 
     106$currentUser                    = @posix_getpwuid(posix_getuid()); 
     107if(!empty($currentUser['name'])) 
     108    $cfg['grepcmd']                 = 'pgrep -u '.$currentUser['name'].' -f "%s"'; 
     109else 
     110    $cfg['grepcmd']                 = 'ps aux | grep "%s" | grep -v grep'; 
     111unset($currentUser); 
     112 
     113/* default intl config */ 
     114$cfg['date_default_timezone']   = 'Europe/Paris'; 
     115$cfg['default_language']        = 'fr_FR'; 
     116 
     117// activate debug mode here 
     118define('DEBUG', true); 
     119/**************************************** STOP EDITING HERE ****************************************/ 
     120 
     121// OpenID 
     122$cfg['openIDUrl']               = 'http'.($cfg['httpsecure'] ? 's' : '').'://'.$cfg['url']; 
     123$cfg['openIDReturn']            = $cfg['surl'].'?do=verifyOpenID&try=1'; 
     124 
     125// version 
     126$cfg['version']                 = '0.2.1'; 
     127 
     128// CLI call ? 
     129define('CLI', 'cli' === PHP_SAPI); 
     130 
     131// REST call ? 
     132define('REST', isset($_SERVER['SCRIPT_FILENAME']) && basename($_SERVER['SCRIPT_FILENAME']) === 'rest.php'); 
     133 
     134// AJAX call ? 
     135define('AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest'); 
     136 
    52137/** 
    53138 * Defines classes autoloading 
     
    56141 * @param string $c The classname to load 
    57142 */ 
    58 spl_autoload_register(function ($c)  
     143spl_autoload_register(function($c) 
    59144{ 
    60145    if(class_exists($c, false)) return true; 
     
    82167    elseif(false !== $ns) 
    83168    { 
    84         $f = PATH.str_replace('\\', DIRECTORY_SEPARATOR, str_replace('_', DIRECTORY_SEPARATOR,$c)).".php"; 
     169        $f = PATH.str_replace('\\', DIRECTORY_SEPARATOR, str_replace('_', DIRECTORY_SEPARATOR, $c)).".php"; 
    85170    } 
    86171    else 
     
    89174    } 
    90175 
    91     if(!file_exists($f))  
     176    if(!file_exists($f)) 
    92177    { 
    93178        return false; 
    94179    } 
    95      
    96     if(!include($f))  
     180 
     181    if(!include($f)) 
    97182    { 
    98183        return false; 
    99184    } 
    100      
     185 
    101186    return class_exists($c, false); 
    102187}); 
    103  
    104  
    105  
    106 /**************************************** START EDITING HERE ****************************************/ 
    107 /* db config */ 
    108 $cfg['dbname']                  = 'openwebreader'; 
    109 $cfg['dbhost']                  = 'localhost'; 
    110 $cfg['dbport']                  = '3306'; 
    111 $cfg['dbdriver']                = 'mysql'; 
    112 $cfg['dbuser']                  = 'openwebreader'; 
    113 $cfg['dbpasswd']                = 'openwebreader'; 
    114 // generally /var/run/mysqld/mysqld.sock or /tmp/mysql.sock 
    115 $cfg['dbsocket']                = '/var/run/mysqld/mysqld.sock'; 
    116 $cfg['dsn']                     = $cfg['dbdriver'].':dbname='.$cfg['dbname'] . 
    117                                     ';host='.$cfg['dbhost'].';port='.$cfg['dbport'] . 
    118                                     ';unix_socket='.$cfg['dbsocket']; 
    119 $cfg['dbCacheTime']             = 86400; // 24h 
    120  
    121 /* host config */ 
    122 $cfg['url']                     = 'yourdomain.tld'; 
    123 $cfg['path']                    = '/OWR/'; // MUST end with '/' 
    124 $cfg['httpsecure']              = false; // set to true if owr will be used with SSL (HTTPS) 
    125 $cfg['surl']                    = 'http'.($cfg['httpsecure'] ? 's' : '').'://'.$cfg['url'].$cfg['path']; 
    126  
    127 /* templates cache time, default to 24h */ 
    128 $cfg['cacheTime']               = 86400; 
    129 /* session life time, default to 24h */ 
    130 $cfg['sessionLifeTime']         = 86400; 
    131  
    132 /* server config */ 
    133 // default temporary directory 
    134 // please keep this OUT of public web server access 
    135 $cfg['defaultTmpDir']           = sys_get_temp_dir().DIRECTORY_SEPARATOR; 
    136 // max upload file size, in octets, default to 5mo 
    137 $cfg['maxUploadFileSize']       = 5120000; 
    138 // path to php executable 
    139 $cfg['phpbin']                  = '/usr/bin/php -d open_basedir='; 
    140 // default ttl, in minutes, used if no ttl is found while parsing a stream 
    141 $cfg['defaultStreamRefreshTime'] = 60; 
    142 // default minimum ttl, in minutes, used for checking ttl found while parsing a stream 
    143 $cfg['defaultMinStreamRefreshTime'] = 10; 
    144 // set to "index" for uri like /index.php?do=action, "action" for uri like /action? 
    145 // look at file HOME/.htaccess for url-rewriting 
    146 $cfg['uriStyle']                = 'index'; 
    147 // max log file size, in octets, default to 5mo 
    148 $cfg['maxLogFileSize']          = 5120000; 
    149 // maximum number of PHP threads that OWR can launch simultaneously 
    150 // if you have an old server, maybe set this to 2, else 5 is not bad 
    151 $cfg['maxThreads']              = 5; 
    152 // nice command used to lower process priority, default "nice -n 10 "  
    153 // (MUST ends with a space if you use it) 
    154 $cfg['nicecmd']                 = 'nice -n 10 '; 
    155 // command used to get the number of process used by OWR, default 'ps aux | grep "%s" | grep -v grep' 
    156 $cfg['grepcmd']                 = 'ps aux | grep "%s" | grep -v grep'; 
    157  
    158 /* default intl config */ 
    159 $cfg['date_default_timezone']   = 'Europe/Paris'; 
    160 $cfg['default_language']        = 'fr_FR'; 
    161 /**************************************** STOP EDITING HERE ****************************************/ 
    162  
    163 // OpenID 
    164 $cfg['openIDUrl']               = 'http'.($cfg['httpsecure'] ? 's' : '').'://'.$cfg['url']; 
    165 $cfg['openIDReturn']            = $cfg['surl'].'?do=verifyOpenID&try=1'; 
    166  
    167 // version 
    168 $cfg['version']                 = '0.2'; 
    169  
    170 // activate debug mode here 
    171 define('DEBUG', false); 
    172  
    173 // cli call ? (cron) 
    174 define('CLI', 'cli' === PHP_SAPI); 
    175  
    176 // REST call ? 
    177 define('REST', isset($_SERVER['SCRIPT_FILENAME']) && basename($_SERVER['SCRIPT_FILENAME']) === 'rest.php'); 
    178188 
    179189Config::iGet($cfg); // init the config object 
     
    181191$cfg = null; 
    182192unset($cfg); 
    183 define('INC_CONFIG', true); // we are set ! 
     193 
     194// we are set ! 
     195define('INC_CONFIG', true); 
Note: See TracChangeset for help on using the changeset viewer.