Project

General

Profile

« Previous | Next » 

Revision 2133

Added by darkviper about 9 years ago

+ new error_handler added
+ var/log/error.log added
+ new class LogRotation added

View differences:

initialize.php
236 236
            $bRetval = true;
237 237
        }
238 238
        $aBt= debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
239
        $x = sizeof($aBt) -1;
240
        $x = $x < 2 ? $x : 2;
239 241
        $sEntry = date('c').' '.'['.$sErrorType.'] '.str_replace(dirname(__DIR__), '', $sErrorFile).':['.$iErrorLine.'] '
240
                . ' from '.str_replace(dirname(__DIR__), '', $aBt[2]['file']).':['.$aBt[2]['line'].'] '
241
                . (@$aBt[2]['class'] ? $aBt[2]['class'].$aBt[2]['type'] : '').$aBt[2]['function'].' '
242
                . ' from '.str_replace(dirname(__DIR__), '', $aBt[$x]['file']).':['.$aBt[$x]['line'].'] '
243
                . (@$aBt[$x]['class'] ? $aBt[$x]['class'].$aBt[$x]['type'] : '').$aBt[$x]['function'].' '
242 244
                . '"'.$sErrorText.'"'.PHP_EOL;
243
        file_put_contents(dirname(__DIR__).'/temp/ERROR.LOG', $sEntry, FILE_APPEND);
245
        file_put_contents(dirname(__DIR__).'/var/log/error.log', $sEntry, FILE_APPEND);
244 246
        return $bRetval;
245 247
    }
246 248
/* ***************************************************************************************
......
307 309
    if(!function_exists('globalExceptionHandler')) {
308 310
        include(__DIR__.'/globalExceptionHandler.php');
309 311
    }
312
// check logfiles and compress it if needed
313
    $oLogRotate = new LogRotation($oReg);
314
    $oLogRotate->execute();
315
    unset($oLogRotate);
310 316
// ---------------------------
311 317
// get Database connection data from configuration
312 318
    $aSqlData = initGetDbConnectData($aCfg, $sDbConnectType);
......
339 345
                    case 'STRING_FILE_MODE':
340 346
                        $iTmp = ((intval(octdec($aRecords[$i]['value'])) & ~0111)|0600);
341 347
                        if(!defined('OCTAL_FILE_MODE')) { define('OCTAL_FILE_MODE', $iTmp); } // deprecated
342
                        if(!defined('FILE_MODE_OCTAL')) { define('FILE_MODE_OCTAL', $iTmp); }
348
                        if(!defined('FILE_MODE_OCTAL')) { define('FILE_MODE_OCTAL', $iTmp); } // deprecated
343 349
                        if(!defined('STRING_FILE_MODE')) { define('STRING_FILE_MODE', sprintf('0%03o', $iTmp)); } // deprecated
350
                        if(!defined('FILE_MODE')) { define('FILE_MODE', $iTmp); }
344 351
                        if(!defined('FILE_MODE_STRING')) { define('FILE_MODE_STRING', sprintf('0%03o', $iTmp)); }
345 352
                        break;
346 353
                    case 'STRING_DIR_MODE':
347 354
                        $iTmp = (intval(octdec($aRecords[$i]['value'])) |0711);
348 355
                        if(!defined('OCTAL_DIR_MODE')) { define('OCTAL_DIR_MODE', $iTmp); } // deprecated
349
                        if(!defined('DIR_MODE_OCTAL')) { define('DIR_MODE_OCTAL', $iTmp); }
356
                        if(!defined('DIR_MODE_OCTAL')) { define('DIR_MODE_OCTAL', $iTmp); } // deprecated
350 357
                        if(!defined('STRING_DIR_MODE')) { define('STRING_DIR_MODE', sprintf('0%03o', $iTmp)); } // deprecated
358
                        if(!defined('DIR_MODE')) { define('DIR_MODE', $iTmp); }
351 359
                        if(!defined('DIR_MODE_STRING')) { define('DIR_MODE_STRING', sprintf('0%03o', $iTmp)); }
352 360
                        break;
353 361
                    case 'PAGES_DIRECTORY':
......
463 471
// load and activate new global translation table
464 472
    $oTrans = Translate::getInstance();
465 473
/* initializise Translate old style *************************************************** */
474

  
466 475
    $oTrans->initialize(
467 476
        'en',
468 477
        (defined('DEFAULT_LANGUAGE') ? DEFAULT_LANGUAGE : ''),
......
471 480
//        (Translate::CACHE_DISABLED|Translate::KEEP_MISSING),
472 481
        (DEBUG ? Translate::CACHE_DISABLED|Translate::KEEP_MISSING : 0)
473 482
    );
483

  
474 484
/* initializise Translate new style *************************************************** */
475 485
/*
476 486
    $oTrans->initialize(
477
        new TranslateAdaptorWbOldStyle,
487
        new TranslateAdaptorWbOldStyle($oReg),
478 488
        'en',
479 489
        (defined('DEFAULT_LANGUAGE') ? DEFAULT_LANGUAGE : ''),
480 490
        (defined('LANGUAGE') ? LANGUAGE : ''),
481
//        (Translate::CACHE_DISABLED|Translate::KEEP_MISSING),
482 491
        (DEBUG ? Translate::CACHE_DISABLED|Translate::KEEP_MISSING : 0),
483 492
        $oReg->DirModeOctal,
484 493
        $oReg->TempPath
485 494
    );
486
 */
495
*/
487 496
/* ****** */
488 497
    $oReg->setDatabase(WbDatabase::getInstance());
489 498
    $oReg->setTranslate(Translate::getInstance());

Also available in: Unified diff