BUG 0000 first commit enabling pmMonitor code
This commit is contained in:
@@ -1,6 +1,45 @@
|
||||
<?php
|
||||
//sysGeneric, this file is used initialize main variables and redirect to each and all pages
|
||||
$startingTime = array_sum(explode(' ',microtime()));
|
||||
//sysGeneric, this file is used initialize main variables and redirect to each and all pages
|
||||
$startingTime = microtime(true);
|
||||
|
||||
/* Default configuration values (do not change these, use env.ini) */
|
||||
$default_config = array(
|
||||
'debug' => 0,
|
||||
'debug_sql' => 0,
|
||||
'debug_time' => 0,
|
||||
'debug_calendar' => 0,
|
||||
'wsdl_cache' => 1,
|
||||
'memory_limit' => '100M',
|
||||
'time_zone' => 'America/La_Paz'
|
||||
);
|
||||
|
||||
/* Read the env.ini */
|
||||
$env_file = realpath(dirname(__FILE__) . "/../engine/config/env.ini");
|
||||
if ($env_file !== false && file_exists($env_file)) {
|
||||
$config = array_merge($default_config, parse_ini_file($env_file, false));
|
||||
} else {
|
||||
$config = $default_config;
|
||||
}
|
||||
|
||||
if ($config['debug']) {
|
||||
$config['debug_sql'] = 1;
|
||||
}
|
||||
|
||||
//*** Do not change any of these settings directly, use env.ini instead
|
||||
ini_set('display_errors','On');
|
||||
ini_set('short_open_tag', 'on');
|
||||
ini_set('asp_tags', 'on');
|
||||
ini_set('register_globals', 'off');
|
||||
ini_set('default_charset', "UTF-8");
|
||||
|
||||
$e_all = defined('E_DEPRECATED') ? E_ALL ^ E_DEPRECATED : E_ALL;
|
||||
ini_set('error_reporting', ($config['debug'] ? $e_all : $e_all ^ E_NOTICE) );
|
||||
ini_set('memory_limit', $config['memory_limit']);
|
||||
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
|
||||
|
||||
define ('DEBUG_SQL_LOG', $config['debug_sql'] );
|
||||
define ('DEBUG_TIME_LOG', $config['debug_time'] );
|
||||
define ('DEBUG_CALENDAR_LOG', $config['debug_calendar'] );
|
||||
|
||||
//*** process the $_POST with magic_quotes enabled
|
||||
function strip_slashes(&$vVar) {
|
||||
@@ -27,7 +66,7 @@ $startingTime = array_sum(explode(' ',microtime()));
|
||||
function logTimeByPage() {
|
||||
$serverAddr = $_SERVER['SERVER_ADDR'];
|
||||
global $startingTime;
|
||||
$endTime = array_sum(explode(' ',microtime()));
|
||||
$endTime = microtime(true);
|
||||
$time = $endTime - $startingTime;
|
||||
$fpt= fopen ( PATH_DATA . 'log/time.log', 'a' );
|
||||
fwrite( $fpt, sprintf ( "%s.%03d %15s %s %5.3f %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), substr($serverAddr,-4), $time, $_SERVER['REQUEST_URI'] ));
|
||||
@@ -327,6 +366,10 @@ $startingTime = array_sum(explode(' ',microtime()));
|
||||
}
|
||||
}
|
||||
|
||||
// ***** create memcached singleton *****************
|
||||
G::LoadClass ( 'memcached' );
|
||||
$memcache = & PMmemcached::getSingleton(SYS_SYS);
|
||||
|
||||
//***************** PM Paths DATA **************************
|
||||
define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
|
||||
define( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' );
|
||||
@@ -350,58 +393,33 @@ $startingTime = array_sum(explode(' ',microtime()));
|
||||
$oPluginRegistry->unSerializeInstance( file_get_contents ( $sSerializedFile ) );
|
||||
|
||||
|
||||
//***************** create $G_ENVIRONMENTS dependent of SYS_SYS **************************
|
||||
define ( 'G_ENVIRONMENT', G_DEV_ENV );
|
||||
$G_ENVIRONMENTS = array (
|
||||
G_PRO_ENV => array (
|
||||
'dbfile' => PATH_DB . 'production' . PATH_SEP . 'db.php' ,
|
||||
'cache' => 1,
|
||||
'debug' => 0,
|
||||
) ,
|
||||
G_DEV_ENV => array (
|
||||
'dbfile' => PATH_DB . SYS_SYS . PATH_SEP . 'db.php',
|
||||
'datasource' => 'workflow',
|
||||
'cache' => 0,
|
||||
'debug' => DEBUG_SQL_LOG, //<--- change the value of this Constant to to 1, to have a detailed sql log in PATH_DATA . 'log' . PATH_SEP . 'workflow.log'
|
||||
) ,
|
||||
G_TEST_ENV => array (
|
||||
'dbfile' => PATH_DB . 'test' . PATH_SEP . 'db.php' ,
|
||||
'cache' => 0,
|
||||
'debug' => 0,
|
||||
)
|
||||
);
|
||||
|
||||
//******* setup propel definitions and logging ****
|
||||
require_once ( "propel/Propel.php" );
|
||||
require_once ( "creole/Creole.php" );
|
||||
|
||||
if ( $G_ENVIRONMENTS[ G_ENVIRONMENT ]['debug'] ) {
|
||||
if (defined('DEBUG_SQL_LOG') && DEBUG_SQL_LOG) {
|
||||
define ( 'PM_PID', mt_rand(1,999999) );
|
||||
require_once ( "Log.php" );
|
||||
|
||||
// register debug connection decorator driver
|
||||
Creole::registerDriver('*', 'creole.contrib.DebugConnection');
|
||||
|
||||
// itialize Propel with converted config file
|
||||
// initialize Propel with converted config file
|
||||
Propel::init( PATH_CORE . "config/databases.php" );
|
||||
|
||||
//log file for workflow database
|
||||
$logFile = PATH_DATA . 'log' . PATH_SEP . 'workflow.log';
|
||||
//unified log file for all databases
|
||||
$logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log';
|
||||
$logger = Log::singleton('file', $logFile, 'wf ' . SYS_SYS, null, PEAR_LOG_INFO);
|
||||
Propel::setLogger($logger);
|
||||
//log file for workflow database
|
||||
$con = Propel::getConnection('workflow');
|
||||
if ($con instanceof DebugConnection) $con->setLogger($logger);
|
||||
|
||||
//log file for rbac database
|
||||
$logFile = PATH_DATA . 'log' . PATH_SEP . 'rbac.log';
|
||||
$logger = Log::singleton('file', $logFile, 'rbac ' . SYS_SYS, null, PEAR_LOG_INFO);
|
||||
Propel::setLogger($logger);
|
||||
$con = Propel::getConnection('rbac');
|
||||
if ($con instanceof DebugConnection) $con->setLogger($logger);
|
||||
|
||||
//log file for report database
|
||||
$logFile = PATH_DATA . 'log' . PATH_SEP . 'report.log';
|
||||
$logger = Log::singleton('file', $logFile, 'rp ' . SYS_SYS, null, PEAR_LOG_INFO);
|
||||
Propel::setLogger($logger);
|
||||
$con = Propel::getConnection('rp');
|
||||
if ($con instanceof DebugConnection) $con->setLogger($logger);
|
||||
}
|
||||
@@ -427,10 +445,6 @@ $startingTime = array_sum(explode(' ',microtime()));
|
||||
$fields = Translation::generateFileTranslation(SYS_LANG);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//********* Setup plugins *************
|
||||
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
|
||||
$avoidChangedWorkspaceValidation = false;
|
||||
|
||||
Reference in New Issue
Block a user