Example #1
0
 /**
  * Creates a new instance of DirectoryBaker.
  */
 public function __construct(IPieCrust $pieCrust, $bakeDir, array $parameters = array(), $logger = null)
 {
     $this->pieCrust = $pieCrust;
     $this->tmpDir = $this->pieCrust->isCachingEnabled() ? $this->pieCrust->getCacheDir() . 'bake_t/' : rtrim(sys_get_temp_dir(), '/\\') . '/piecrust/bake_t/';
     $this->bakeDir = rtrim(str_replace('\\', '/', $bakeDir), '/') . '/';
     $this->parameters = array_merge(array('smart' => true, 'mounts' => array(), 'skip_patterns' => array(), 'force_patterns' => array(), 'processors' => array('copy')), $parameters);
     if ($logger == null) {
         $logger = \Log::singleton('null', '', '');
     }
     $this->logger = $logger;
     // Add a special mount point for the theme directory, if any.
     if ($this->pieCrust->getThemeDir()) {
         $this->parameters['mounts']['theme'] = $this->pieCrust->getThemeDir();
     }
     // Validate skip patterns.
     $this->parameters['skip_patterns'] = self::validatePatterns($this->parameters['skip_patterns'], array('/^_cache/', '/^_content/', '/^_counter/', '/^theme_info\\.yml/', '/(\\.DS_Store)|(Thumbs.db)|(\\.git)|(\\.hg)|(\\.svn)/'));
     // Validate force-bake patterns.
     $this->parameters['force_patterns'] = self::validatePatterns($this->parameters['force_patterns']);
     // Compute the number of characters we need to remove from file paths
     // to get their relative paths.
     $rootDir = $this->pieCrust->getRootDir();
     $this->rootDirLength = strlen(rtrim($rootDir, '/\\')) + 1;
     $this->mountDirLengths = array();
     foreach ($this->parameters['mounts'] as $name => $dir) {
         $this->mountDirLengths[$name] = strlen(rtrim($dir, '/\\')) + 1;
     }
     $this->bakedFiles = array();
     if (!is_dir($this->bakeDir) or !is_writable($this->bakeDir)) {
         throw new PieCrustException('The bake directory is not writable, or does not exist: ' . $this->bakeDir);
     }
 }
 /**
  * @name recherche( $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri )
  * @param string nom de la table
  * @param string Le type de critère de recherche
  * @param array(string) champs à récupérer dans la table
  * @param array(array(string, object)) Dictionnaire(champ, valeur)) contenant les champs à filtrer ainsi que la valeur du filtre
  * @param array(array(string, string)) Dictionnaire(champ, sens) contenant les tris à appliquer
  * @return array(GestionListeCommandeEnCoursViewVO)
  * @desc Récupères les lignes de la table selon le critère de recherche puis trie et renvoie la liste de résultat sous forme d'une collection de GestionListeCommandeEnCoursViewVO
  */
 public static function recherche($pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri)
 {
     // Initialisation du Logger
     $lLogger =& Log::singleton('file', CHEMIN_FICHIER_LOGS);
     $lLogger->setMask(Log::MAX(LOG_LEVEL));
     // Préparation de la requète
     $lChamps = array(CommandeManager::CHAMP_COMMANDE_ID . "," . CommandeManager::CHAMP_COMMANDE_NOM . "," . CommandeManager::CHAMP_COMMANDE_NUMERO . "," . CommandeManager::CHAMP_COMMANDE_DATE_FIN_RESERVATION . "," . CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_DEBUT . "," . CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_FIN);
     // Préparation de la requète de recherche
     $lRequete = DbUtils::prepareRequeteRecherche(GestionListeCommandeEnCoursViewManager::VUE_LISTECOMMANDEENCOURS, $lChamps, $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri);
     $lListeGestionListeCommandeEnCours = array();
     if ($lRequete !== false) {
         $lLogger->log("Execution de la requete : " . $lRequete, PEAR_LOG_DEBUG);
         // Maj des logs
         $lSql = Dbutils::executerRequete($lRequete);
         if (mysql_num_rows($lSql) > 0) {
             while ($lLigne = mysql_fetch_assoc($lSql)) {
                 array_push($lListeGestionListeCommandeEnCours, GestionListeCommandeEnCoursViewManager::remplir($lLigne[CommandeManager::CHAMP_COMMANDE_ID], $lLigne[CommandeManager::CHAMP_COMMANDE_NOM], $lLigne[CommandeManager::CHAMP_COMMANDE_NUMERO], $lLigne[CommandeManager::CHAMP_COMMANDE_DATE_FIN_RESERVATION], $lLigne[CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_DEBUT], $lLigne[CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_FIN]));
             }
         } else {
             $lListeGestionListeCommandeEnCours[0] = new GestionListeCommandeEnCoursViewVO();
         }
         return $lListeGestionListeCommandeEnCours;
     }
     $lListeGestionListeCommandeEnCours[0] = new GestionListeCommandeEnCoursViewVO();
     return $lListeGestionListeCommandeEnCours;
 }
 function ob_show_and_log($type)
 {
     $log =& Log::singleton('file', USERBASE . 'log.txt', $type, array('locking' => true, 'timeFormat' => '%Y-%m-%d %H:%M:%S'));
     $length = $GLOBALS['filesize'];
     $num_queries = isset($GLOBALS['db']) ? $GLOBALS['db']->num_queries : 0;
     switch ($type) {
         case 'file':
             // {
             $location = $_SERVER['REQUEST_URI'];
             break;
             // }
         // }
         case 'menu':
             // {
             $location = 'menu';
             break;
             // }
         // }
         case 'page':
             // {
             $location = $GLOBALS['PAGEDATA']->id . '|' . $GLOBALS['PAGEDATA']->getRelativeUrl();
             break;
             // }
         // }
         default:
             // {
             $location = 'unknown_type_' . $type;
             //}
     }
     $log->log($_SERVER['REMOTE_ADDR'] . '	' . $location . '	' . $_SERVER['HTTP_USER_AGENT'] . '	' . $_SERVER['HTTP_REFERER'] . '	' . memory_get_peak_usage() . '	' . $length . '	' . (microtime(true) - START_TIME) . '	' . $num_queries);
     ob_flush();
 }
 /**
  * Creates a new instance of PieCrustImporter.
  */
 public function __construct(IPieCrust $pieCrust, $logger = null)
 {
     $this->pieCrust = $pieCrust;
     if ($logger == null) {
         $logger = \Log::singleton('null', '', '');
     }
     $this->logger = $logger;
 }
Example #5
0
function &get_logger()
{
    global $klogger;
    if ($klogger == null) {
        $klogger =& Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'kauth');
    }
    return $klogger;
}
Example #6
0
 public function initialize(IPieCrust $pieCrust, $logger = null)
 {
     $this->pieCrust = $pieCrust;
     if ($logger == null) {
         $logger = \Log::singleton('null', '', '');
     }
     $this->logger = $logger;
 }
Example #7
0
 function WordPressOpenID()
 {
     $this->log =& Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'OpenID');
     //$this->log = &Log::singleton('file', ABSPATH . get_option('upload_path') . '/php.log', 'WPOpenID');
     // Set the log level
     $wpopenid_log_level = constant('PEAR_LOG_' . strtoupper(WPOPENID_LOG_LEVEL));
     $this->log->setMask(Log::UPTO($wpopenid_log_level));
 }
Example #8
0
File: log.php Project: joestump/jax
 function &singleton()
 {
     static $log = null;
     if (is_null($log)) {
         $log =& Log::singleton('file', JX_BASE_LOG, 'JAX');
     }
     return $log;
 }
Example #9
0
 private static function getInst()
 {
     if (BBLog::$inst == null) {
         $conf = array('error_prepend' => '<font color="#ff0000"><tt>', 'error_append' => '</tt></font>', 'buffering' => true);
         BBLog::$inst = Log::singleton("display", '', 'BBLog', $conf, PEAR_LOG_ERR);
     }
     return BBLog::$inst;
 }
 public function __construct(array $processors, $logger = null)
 {
     $this->processors = $processors;
     if ($logger == null) {
         $logger = \Log::singleton('null', '', '');
     }
     $this->logger = $logger;
 }
Example #11
0
 /**
  * Creates a new instance of PageBaker.
  */
 public function __construct($bakeDir, array $parameters = array(), $logger = null)
 {
     $this->bakeDir = rtrim(str_replace('\\', '/', $bakeDir), '/') . '/';
     $this->parameters = array_merge(array('copy_assets' => false, 'bake_record' => null), $parameters);
     if ($logger == null) {
         $logger = \Log::singleton('null', '', '');
     }
     $this->logger = $logger;
 }
Example #12
0
 function logger($key, $log_file)
 {
     $mask = Log::MAX(PEAR_LOG_DEBUG);
     $conf = array('mode' => 0600, 'dirmode' => 777, 'lineFormat' => '%{timestamp} [%{priority}]: %{message}', 'timeFormat' => '%d/%m/%Y %H:%M:%S');
     $this->_key = $key;
     $this->_log_file = $log_file;
     $this->_logger =& Log::singleton('file', $this->_log_file, $this->_key, $conf);
     $this->_logger->setMask($mask);
 }
Example #13
0
 /**
  *
  */
 private static function _singleton()
 {
     static $instance;
     if (!isset($instance) || !$instance instanceof Log) {
         $options = array('append' => true, 'locking' => false, 'mode' => 0640, 'timeFormat' => '[%Y-%m-%d %H:%M:%S]', 'lineFormat' => '%1$s [%3$s] [' . uniqid() . '] %4$s');
         $instance = parent::singleton('file', CINTIENT_LOG_FILE, 'cintient', $options, PEAR_LOG_DEBUG);
     }
     return $instance;
 }
 /**
  * Run a full system test based on phpcs output.
  *
  * @return void
  */
 public function test__main()
 {
     $controller = new CbCLIController(null, array(PHPCB_SOURCE), PHPCB_TEST_OUTPUT, array(), array(), array(), new CbIOHelper(), Log::singleton('null'), array('php'));
     $controller->addErrorPlugins(array('CbErrorCheckstyle', 'CbErrorPMD', 'CbErrorCPD', 'CbErrorPadawan', 'CbErrorCoverage', 'CbErrorCRAP'));
     $controller->run();
     $this->assertFileExists(PHPCB_TEST_OUTPUT . '/index.html');
     $this->assertFileExists(PHPCB_TEST_OUTPUT . '/CLIController.php.html');
     $this->assertFileExists(PHPCB_TEST_OUTPUT . '/css');
 }
Example #15
0
 function __construct()
 {
     // create Log object
     $this->pearLogger =& Log::singleton("sql", "log_table", __FILE__, array('dsn' => "mysql://" . dbuser . ":" . dbpassword . "@" . mysqlServerIP . "/" . dbname, 'identLimit' => 300));
     $mask = Log::MIN(PEAR_LOG_ERR);
     $this->pearLogger->setMask($mask);
     set_error_handler(array($this, 'errorHandler'));
     set_exception_handler(array($this, 'exceptionHandler'));
 }
Example #16
0
 public function setUp()
 {
     self::$verificationErrors = array();
     self::$log = \Log::singleton('file', $GLOBALS['settings']['logname'], $this->getName());
     self::$selenium = \SaunterPHP_Framework_SeleniumConnection::RemoteControl();
     self::$selenium->start();
     self::$selenium->windowMaximize();
     $this->sessionId = self::$selenium->getEval("selenium.sessionId");
 }
Example #17
0
 function log($message, $priority = PEAR_LOG_INFO)
 {
     global $conf;
     if (!$conf['log']['enabled']) {
         return;
     }
     $logger =& Log::singleton('file', $conf['log']['name'], 'evoadmin');
     $logger->log($message, $priority);
 }
Example #18
0
 /**
  * Log the passed message to the framework's log folder in the filename specified.
  * @param string The filename to log the message to. The exact string will be used for the filename; no extension will be appended.
  * @param mixed string Log message to log.
  *              object WFFunction A WFFunction which will be lazy-evaluated to produce the message to log. This level of decoupling allows the log infrastructure
  *                                to be much faster when a message won't be logged as the message creation won't occur at all.
  */
 public static function logToFile($fileName, $message)
 {
     $logger = WFWebApplication::sharedWebApplication()->logger($fileName);
     if (!$logger) {
         $logFileDir = WFWebApplication::sharedWebApplication()->appDirPath(WFWebApplication::DIR_LOG);
         $logger = Log::singleton('file', $logFileDir . '/' . $fileName, 'log', array('mode' => 0666));
     }
     $logger->log(self::buildLogMessage($message));
 }
Example #19
0
 /**
  * Get the shared instance for the logger
  * @return \Log
  */
 public static function GetLogger()
 {
     $log = new \Log("this message is ignored, however not supplying one throws an error :o/");
     $logger = $log->singleton('file', Setup::Configuration()->CachingDirectory . "/log.log", '   ');
     if (!self::Configuration()->EnableDebugLogging) {
         $mask = \Log::UPTO(\PEAR_LOG_INFO);
         $logger->setMask($mask);
     }
     return $logger;
 }
Example #20
0
/**
 * デバッグ用ログ保存
 */
function m_debug_log($msg, $priority = PEAR_LOG_WARNING)
{
    if (!MAIL_DEBUG_LOG) {
        return;
    }
    $log_path = OPENPNE_VAR_DIR . '/log/mail.log';
    $file =& Log::singleton('file', $log_path, 'MAIL');
    mb_convert_encoding($msg, 'JIS', 'auto');
    $file->log($msg, $priority);
}
 /**
  * Creates a new instance of the runner.
  */
 public function __construct($rootDir, $tmpDir, $outDir, $logger = null)
 {
     $this->rootDir = $rootDir;
     $this->tmpDir = $tmpDir;
     $this->outDir = $outDir;
     if ($logger == null) {
         $logger = \Log::singleton('null', '', '');
     }
     $this->logger = $logger;
 }
Example #22
0
function logger($progressValue, &$obj)
{
    include_once 'Log.php';
    $logger =& Log::singleton('file', 'monitor.log', $_SERVER['REMOTE_ADDR']);
    if (fmod($progressValue, 25) == 0) {
        $logger->info("{$progressValue} % has been reached");
    } else {
        $logger->debug("Progress ... {$progressValue} %");
    }
}
 public function getLog()
 {
     if (!isset($this->_logfile)) {
         return false;
     }
     $file_name = $this->_logfile . date('Ym') . '.log';
     if (!isset($this->_log)) {
         $this->_log =& Log::singleton('file', $file_name);
     }
     return $this->_log;
 }
Example #24
0
function logger($progressValue, &$bar)
{
    include_once 'Log.php';
    $logger =& Log::singleton('file', 'monitor.log', $_SERVER['REMOTE_ADDR']);
    $percent = $bar->getPercentComplete(false);
    if (fmod($progressValue, 25) == 0) {
        $logger->info("{$percent}% has been reached");
    } else {
        $logger->debug("Progress ... {$progressValue}");
    }
}
 /**
  * Gets the PEAR Log object to use.
  *
  * @return Log  A Log object, either provided by the user or
  *              created by this function.
  */
 function &getLogger()
 {
     if (!$this->_logger) {
         $file = $this->_logDir . '/' . date('Ymd') . '.PayPalSamples.log';
         if (is_link($file) || file_exists($file) && !is_writable($file)) {
             // Don't overwrite symlinks.
             // return PayPal::raiseError('bad logfile');
         }
         $this->_logger =& Log::singleton('file', $file, 'php_samples', array('append' => true));
     }
     return $this->_logger;
 }
Example #26
0
 public function __construct($pidFile = null, $logfile = null)
 {
     if ($pidFile !== null) {
         $this->pidFile = $pidFile;
     }
     if ($logfile === null) {
         $logfile = '/var/log/php-daemon';
     }
     //prepare our logger
     $conf = array('lineFormat' => '[%{timestamp}] [%{priority}] %{message}', 'timeFormat' => '%Y-%m-%d %T');
     self::$logger =& Log::singleton('file', $logfile, 'daemon', $conf);
 }
Example #27
0
 public function testLoggerInit()
 {
     $rand = mt_rand();
     $logfile = Config::$logFile;
     $logger =& Log::singleton('file', $logfile);
     $logger->debug("Testing logger: {$rand}");
     $logfile_contents = file($logfile);
     $pattern = "/{$rand}/";
     $matches = preg_grep($pattern, $logfile_contents);
     $num_matches = count($matches);
     $this->assertSame(1, $num_matches, "Num matches = {$num_matches}, {$logfile_contents} = " . print_r($logfile_contents, true));
 }
Example #28
0
 public function __construct()
 {
     // Set a path to the spark root that we can reference
     $spark_path = dirname(__DIR__) . '/';
     // Include the CodeIgniter database config file
     // Is the config file in the environment folder?
     if (!defined('ENVIRONMENT') or !file_exists($file_path = APPPATH . 'config/' . ENVIRONMENT . '/database.php')) {
         if (!file_exists($file_path = APPPATH . 'config/database.php')) {
             show_error('PHPActiveRecord: The configuration file database.php does not exist.');
         }
     }
     require $file_path;
     // Include the ActiveRecord bootstrapper
     require_once $spark_path . 'vendor/php-activerecord/ActiveRecord.php';
     // PHPActiveRecord allows multiple connections.
     $connections = array();
     if ($db && $active_group) {
         foreach ($db as $conn_name => $conn) {
             // Build the DSN string for each connection
             $connections[$conn_name] = $conn['dbdriver'] . '://' . $conn['username'] . ':' . $conn['password'] . '@' . $conn['hostname'] . '/' . $conn['database'] . '?charset=' . $conn['char_set'];
         }
         // Initialize PHPActiveRecord
         ActiveRecord\Config::initialize(function ($cfg) use($connections, $active_group) {
             $cfg->set_model_directories(APPPATH . 'models/core/', APPPATH . 'models/', APPPATH . 'models/delete/');
             // $cfg->set_model_directory(APPPATH.'models/');
             $cfg->set_connections($connections);
             // This connection is the default for all models
             $cfg->set_default_connection($active_group);
             // To enable logging and profiling, install the Log library
             // from pear, create phpar.log inside of your application/logs
             // directory, then uncomment the following block:
             if (is_writable(APPPATH . 'logs/query.log')) {
                 $log_file = APPPATH . 'logs/query.log';
                 include_once BASEPATH . 'log/log.php';
                 $logger = Log::singleton('file', $log_file, 'ident', array('mode' => 0664, 'timeFormat' => '%Y-%m-%d %H:%M:%S'));
                 $cfg->set_logging(true);
                 $cfg->set_logger($logger);
             }
             /*
             $log_file = $_SERVER['DOCUMENT_ROOT'].'/application/logs/phpar.log';
             
             if (file_exists($log_file) and is_writable($log_file)) {
                 include 'Log.php';
                 $logger = Log::singleton('file', $log_file ,'ident',array('mode' => 0664, 'timeFormat' =>  '%Y-%m-%d %H:%M:%S'));
                 $cfg->set_logging(true);
                 $cfg->set_logger($logger);
             } else {
                 log_message('warning', 'Cannot initialize logger. Log file does not exist or is not writeable');
             }
             */
         });
     }
 }
 /**
  * Inserta en el Log el mensaje.
  * @param string $message Mensaje a guardar en el Log
  * @param string $ident   Identificador de 'usuario'.
  * @param string $priority Nivel de log
  */
 function log($message, $ident, $priority = PEAR_LOG_WARNING)
 {
     if (MIGUELBASE_LOG_ACTIVE) {
         switch (MIGUELBASE_LOG_TYPE) {
             case 'file':
                 $conf = array('mode' => 0600, 'timeFormat' => '%Y/%m/%d %H:%M:%S');
                 $logger =& Log::singleton('file', MIGUELBASE_LOG_FILE, 'miguelOO_' . $ident, $conf);
                 break;
             case 'adodb':
                 $db_conf = array('ddbbSgbd' => Session::getContextValue('ddbbSgbd'), 'ddbbServer' => Session::getContextValue('ddbbServer'), 'ddbbUser' => Session::getContextValue('ddbbUser'), 'ddbbPassword' => Session::getContextValue('ddbbPassword'), 'ddbbMainDb' => Session::getContextValue('ddbbMainDb'));
                 $conf = array('dsn' => $db_conf);
                 $logger =& Log::singleton('adodb', MIGUELBASE_LOG_TABLE, 'miguelOO_' . $ident, $conf);
                 break;
             default:
                 $logger =& Log::singleton('error_log', 0, 'miguelOO_' . $ident);
         }
         switch (MIGUELBASE_LOG_LEVEL) {
             case 'ALL':
                 $mask = Log::UPTO(PEAR_LOG_DEBUG);
                 break;
             case 'EMERG':
                 $mask = Log::UPTO(PEAR_LOG_EMERG);
                 break;
             case 'ALERT':
                 $mask = Log::UPTO(PEAR_LOG_ALERT);
                 break;
             case 'CRITIC':
                 $mask = Log::UPTO(PEAR_LOG_CRIT);
                 break;
             case 'ERROR':
                 $mask = Log::UPTO(PEAR_LOG_ERR);
                 break;
             case 'WARNING':
                 $mask = Log::UPTO(PEAR_LOG_WARNING);
                 break;
             case 'NOTICE':
                 $mask = Log::UPTO(PEAR_LOG_NOTICE);
                 break;
             case 'INFO':
                 $mask = Log::UPTO(PEAR_LOG_INFO);
                 break;
             case 'DEBUG':
                 $mask = Log::UPTO(PEAR_LOG_DEBUG);
                 break;
             default:
                 $mask = PEAR_LOG_NONE;
         }
         $logger->setMask($mask);
         //Debug::oneVar($logger,__FILE__,__LINE__);
         $logger->log($message, $priority);
     }
 }
Example #30
0
 function run()
 {
     try {
         $this->initialize();
         $this->handle();
     } catch (VoiceException $ex) {
         $path = LOG_DIR . 'web/' . $this->name . date('Ymd') . '.log';
         Log::singleton('file', $path, 'ERR', array('mode' => 0777))->log($ex->getMessage() . " @" . $ex->location . " :" . var_export($ex->array, true));
         $this->array = array('status' => 'fail', 'error' => $ex->getMessage());
     }
     $this->display();
     $this->finalize();
 }