summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiderr <spiderr@bitweaver.org>2020-06-22 11:28:11 -0400
committerspiderr <spiderr@bitweaver.org>2020-06-22 11:28:11 -0400
commitbdbe36a9e9676b4beda552925ec5abb040a7708d (patch)
tree1c8c320e58f8d88d961d5c87a81eed83ce184de2
parentac49ca9208f95eb3cdbfb01393f7a645ec83ac47 (diff)
parenta3767ca7f774d0ec28b2b4a73bd18339a2c1a8e0 (diff)
downloadkernel-bdbe36a9e9676b4beda552925ec5abb040a7708d.tar.gz
kernel-bdbe36a9e9676b4beda552925ec5abb040a7708d.tar.bz2
kernel-bdbe36a9e9676b4beda552925ec5abb040a7708d.zip
Merge branch 'master' of github.com:bitweaver/kernel
-rw-r--r--BitBase.php4
-rw-r--r--BitDbBase.php14
-rw-r--r--config_defaults_inc.php28
-rw-r--r--kernel_lib.php2
4 files changed, 28 insertions, 20 deletions
diff --git a/BitBase.php b/BitBase.php
index ccdf176..67cc925 100644
--- a/BitBase.php
+++ b/BitBase.php
@@ -346,8 +346,8 @@ abstract class BitBase {
}
function debugOutput( $pString ) {
- global $gDebug;
- if( $gDebug || !defined( 'IS_LIVE' ) || !IS_LIVE ) {
+ global $gDebug, $gArgs, $argv;
+ if( $gDebug || !defined( 'IS_LIVE' ) || !IS_LIVE || !empty( $gArgs['log'] ) ) {
if( empty( $this->mLastOutputTime ) ) {
$elapsed = (float)0.000;
} else {
diff --git a/BitDbBase.php b/BitDbBase.php
index 64376b9..65d2246 100644
--- a/BitDbBase.php
+++ b/BitDbBase.php
@@ -233,11 +233,15 @@ class BitDb {
$this->mQueryTime += $interval;
if( $this->getDebugLevel() ) {
$style = ( $interval > .5 ) ? 'color:red;' : (( $interval > .15 ) ? 'color:orange;' : '');
- $querySpeed = ( $interval > .5 ) ? tra( 'VERY SLOW' ): (( $interval > .15 ) ? tra( 'SLOW' ) : 'complete');
- print '<p style="'.$style.'">
- <span style="display:inline-block;width:30%">### Query: <strong>'.$gNumQueries.'</strong> '.$querySpeed.'</span>
- <span style="display:inline-block;width:33%">Start time: '.round( $this->mQueryLap, 5 ).'</span>
- <span style="display:inline-block;width:33%">### Query run time: '.round( $interval, 5 ).'</span></p>';
+ $querySpeed = ( $interval > .5 ) ? tra( 'VERY SLOW' ): (( $interval > .15 ) ? tra( 'SLOW' ) : 'NORMAL');
+ if( ini_get( 'html_errors' ) ) {
+ print '<p style="'.$style.'">
+ <span style="display:inline-block;width:30%">### Query: <strong>'.$gNumQueries.'</strong> '.$querySpeed.'</span>
+ <span style="display:inline-block;width:33%">Start time: '.round( $this->mQueryLap, 5 ).'</span>
+ <span style="display:inline-block;width:33%">### Query run time: '.round( $interval, 5 ).'</span></p>';
+ } else {
+ print '('.$this->mDb->databaseType."): #$gNumQueries >> Start: ".round( $this->mQueryLap, 5 )."s > $querySpeed ".round( $interval, 5 )."s\n";
+ }
flush();
}
$this->mQueryLap = 0;
diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 51b8e73..4d30a8d 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -28,8 +28,8 @@ if( !empty( $gShellScript ) ) {
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => __FILE__,
'REQUEST_URI' => __FILE__,
- 'SCRIPT_URI' => __FILE__,
- 'SCRIPT_URL' => __FILE__,
+ 'SCRIPT_URI' => $_SERVER['SCRIPT_FILENAME'],
+ 'SCRIPT_URL' => $_SERVER['SCRIPT_NAME'],
'SERVER_ADDR' => $siteName,
'SERVER_ADMIN' => 'root@'.$siteName,
'SERVER_NAME' => '',
@@ -47,18 +47,22 @@ if( !empty( $gShellScript ) ) {
$gArgs = array();
if( $argv ) {
foreach( $argv AS $arg ) {
- switch( $arg ) {
- case '--debug':
- $gDebug = TRUE;
- break;
- case strpos( $arg, '--' ) === 0:
- if( strpos( $arg, '=' ) ) {
- $gArgs[substr( $arg, 2, strpos( $arg, '=' )-2 )] = (int)substr( $arg, (strpos( $arg, '=' ) +1) );
- } else {
- $gArgs[substr( $arg, 2 )] = TRUE;
- }
+ $argKey = $arg;
+ if( strpos( $arg, '--' ) === 0 ) {
+ $argKey = substr( $arg, 2 );
+ }
+ $argValue = TRUE;
+ if( strpos( $arg, '=' ) ) {
+ $argKey = substr( $arg, 2, strpos( $arg, '=' )-2 );
+ $argValue = substr( $arg, (strpos( $arg, '=' ) +1) );
+ }
+ switch( $argKey ) {
+ case 'debug':
+ $gDebug = $argValue;
break;
}
+ $gArgs[$argKey] = $argValue;
+ $_REQUEST[$argKey] = $argValue;
}
}
}
diff --git a/kernel_lib.php b/kernel_lib.php
index 664ded3..3ee7b45 100644
--- a/kernel_lib.php
+++ b/kernel_lib.php
@@ -491,7 +491,7 @@ function unlink_r( $pPath, $pFollowLinks = FALSE ) {
if( $dir = opendir( $pPath ) ) {
while( FALSE !== ( $entry = readdir( $dir ) ) ) {
if( is_file( "$pPath/$entry" ) || ( !$pFollowLinks && is_link( "$pPath/$entry" ) ) ) {
- unlink( "$pPath/$entry" );
+ @unlink( "$pPath/$entry" );
} elseif( is_dir( "$pPath/$entry" ) && $entry != '.' && $entry != '..' ) {
unlink_r( "$pPath/$entry" ) ;
}