예제 #1
0
#!/usr/bin/env php
<?php 
$autoloader_use_console = true;
require_once 'autoloader.php';
use NigeLib\Console;
use NigeLib\ConfigFacade as Config;
use NigeLib\DatabaseConnectionManagerFacade as DB;
Config::init('localconfig', null, 'config');
Console::info(DB::get('temp'));
예제 #2
0
 public function dump()
 {
     Console::debug("Configuration for {$this->environment} environment\n");
     Console::debug($this->config);
 }
예제 #3
0
#!/usr/bin/env php
<?php 
$autoloader_use_console = true;
require_once 'autoloader.php';
use NigeLib\ConfigFacade as Config;
use NigeLib\DatabaseConnectionManagerFacade as DB;
use NigeLib\Console;
use NigeLib\Environment;
Console::important('Test script for NigeLib.');
Config::init('localconfig', Environment::getEnvironmentName('envmap.php'), 'config');
Config::reload();
Config::dump();
Console::debug(DB::get('temp'));
// Invoke style...
$cfg = NigeLib\Config::getSingleton();
Console::info($cfg('app.logfile'));
Console::info(Config::get('app.logfile'));
 public function __destruct()
 {
     if (class_exists("Aura\\Sql\\ExtendedPdo", false)) {
         $cfg = Config::getSingleton();
         $write_console = $cfg->get('database.write_profile_to_console', false);
         $write_files = $cfg->get('database.write_profile_files', true);
         $file_directory = $cfg->get('database.profile_files_directory', '/tmp');
         if ($write_console || $write_files) {
             foreach ($this->connections as $name => $connection) {
                 $profiler = $connection->getProfiler();
                 if ($profiler) {
                     $profiles = $profiler->getProfiles();
                     $output = '';
                     foreach ($profiles as $query) {
                         $output .= "Statement: {$query['statement']}\n" . "Duration:  {$query['duration']}\n" . "Function:  {$query['function']}\n" . "Trace:\n{$query['trace']}\n\n";
                     }
                     if ($write_console) {
                         Console::output($output, Console::DEBUG);
                     }
                     if ($write_files) {
                         file_put_contents($file_directory . DIRECTORY_SEPARATOR . $name . '.profile.log', $output, FILE_APPEND);
                     }
                 }
             }
         }
     }
 }
예제 #5
0
#!/usr/bin/env php
<?php 
require_once 'autoloader.php';
use NigeLib\Console;
Console::important('Test script for NigeLib PharBuilder.');
$pb = new NigeLib\PharBuilder('phartest.phar', 'test.php', dirname(__FILE__));
$pb->addExcludePrefix('/.git');
$pb->addExcludePrefix('/composer');
$pb->addExcludePrefix('/phartest.php');
$pb->addExcludeSuffix('~');
$pb->compile();