Commit 45813a0c by Frederick d. Maus

D erweitert um $__mc_D_LOGFILE_ONLY_USER, das sie bei Ausgabefunktionen als dri…

…tten Parameter personifiziert in log Dateien schreibt
1 parent fe72102f
......@@ -47,10 +47,16 @@ class D {
public static function printToFile($param_filename, $param_kindof = null) {
global $__mc_D_LOGFILE_ONLY_USER;
if($param_filename && !empty(self::$echo_lines)) {
$file_content = '';
foreach(self::$echo_lines as $line_nr => $line) {
$file_content .= $line_nr.':'.mcCONST::TAB.self::html2text($line['line']).mcCONST::LINEBREAK;
if($__mc_D_LOGFILE_ONLY_USER === $line['print']) {
$file_content .= $line_nr.':'.mcCONST::TAB.self::html2text($line['line']).mcCONST::LINEBREAK;
}
}
mcFile::write($param_filename, $file_content, $param_kindof);
......@@ -59,10 +65,16 @@ class D {
public static function printToScreen() {
global $__mc_D_LOGFILE_ONLY_USER;
if(!empty(self::$echo_lines)) {
$screen_content = '<br /><br /><br />';
foreach(self::$echo_lines as $line_nr => $line) {
$screen_content .= $line['line'];
// echo '$__mc_D_LOGFILE_ONLY_USER = '.$__mc_D_LOGFILE_ONLY_USER.' == '.$line['print'].'<br/>';
// if($__mc_D_LOGFILE_ONLY_USER === $line['print']) {
$screen_content .= $line['line'];
// }
}
echo $screen_content;
}
......@@ -91,8 +103,10 @@ class D {
'force' => $param_force
);
if($param_force) {
echo 'FORCE:'.mcCONST::TAB.$param_string;
// echo 'FORCE:'.mcCONST::TAB.$param_string;
echo 'FORCE:'.mcCONST::TAB.$param_string.'<br/>';
}
// echo $param_string;
self::$echo_count++;
}
}
......@@ -159,7 +173,7 @@ class D {
}
public static function cf($param_string='', $param_print=true, $param_force=false) {
D::printCurrentFunction($param_print, $param_string, true);
D::printCurrentFunction($param_print, $param_string, true, $param_force);
}
/**
......@@ -204,7 +218,7 @@ class D {
* <ul><li>$param_string</li></ul>
*/
public static function ulli($param_string, $param_print=true, $param_force=false) {
self::printCurrentFunction($param_print);
// self::printCurrentFunction($param_print);
self::new_echo("<ul><li>".$param_string."</li></ul>", $param_print, $param_force);
}
/**
......@@ -253,13 +267,13 @@ class D {
* @static
*/
private static function printCurrentFunction($param_print, $param_string='', $param_onlyFunction=false) {
private static function printCurrentFunction($param_print, $param_string='', $param_onlyFunction=false, $param_force=false) {
if($param_print) {
$array = debug_backtrace();
$i=2;
if($param_onlyFunction) {
self::new_echo(''.$array[$i]["class"].$array[$i]["type"].$array[$i]["function"].'(Z'.$array[$i-1]["line"].'): '.$param_string);
self::new_echo(''.$array[$i]["class"].$array[$i]["type"].$array[$i]["function"].'(Z'.$array[$i-1]["line"].'): '.$param_string, $param_print, $param_force);
} else {
if(is_array($array) && array_key_exists($i,$array)){
......@@ -276,8 +290,8 @@ class D {
}
// D::ulli($v.': '.$array[$v]['class'].$array[$v]['type'].$array[$v]['function']);
}
self::new_echo($param_string." <i style=\"font-size:10;color:gray;\"><b>".$array[$i]["class"].$array[$i]["type"].$array[$i]["function"]."()</b> <span title='Rekursionstiefe'>(RT:$var_depth)</span> call in row ".$array[$i]["line"]." in <a href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a></i> => [<i style=\"font-size:10;color:gray;\">".$array[$i-1]['class'].$array[$i-1]['type'].$array[$i-1]['function']."() call in ".basename($array[$i-1]["file"])." Zeile: ".$array[$i-1]["line"]." </i>]");
//echo $param_string;
self::new_echo($param_string." <i style=\"font-size:10;color:gray;\"><b>".$array[$i]["class"].$array[$i]["type"].$array[$i]["function"]."()</b> <span title='Rekursionstiefe'>(RT:$var_depth)</span> call in row ".$array[$i]["line"]." in <a href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a></i> => [<i style=\"font-size:10;color:gray;\">".$array[$i-1]['class'].$array[$i-1]['type'].$array[$i-1]['function']."() call in ".basename($array[$i-1]["file"])." Zeile: ".$array[$i-1]["line"]." </i>]", $param_print);
//echo '___________<pre>';
//echo print_r($array[$i], true);
//echo '</pre>';
......
......@@ -110,15 +110,15 @@ class mcPerformance {
}
}
public static function showStats() {
public static function showStats($param_print=true, $param_force=false) {
global $_LOSP_DEV;
if($_LOSP_DEV) {
D::h2('static calls');
D::h2('static calls', $param_print, $param_force);
foreach(mcPerformance::$StaticCalls as $classname => $fnc) {
D::li('<b>'.$classname.'</b>');
D::ulli('<b>'.$classname.'</b>', $param_print, $param_force);
foreach($fnc as $fncname => $FncCalls) {
$count_diff_FncCalls = count($FncCalls);
D::ulli('<b>'.$fncname.' with '.$count_diff_FncCalls.' different fnc calls </b>');
D::ulli('<b>'.$fncname.' with '.$count_diff_FncCalls.' different fnc calls </b>', $param_print, $param_force);
$allFncCalls = 0;
foreach($FncCalls as $FncCall) {
$backtraceString = '';
......@@ -138,10 +138,10 @@ class mcPerformance {
}
D::ulli('<i>'.$fncname.'('.$string4param.') wurde '.$FncCall['count'].' aufgerufen</i>'.' backtrace '.$backtraceString);
D::ulli('<i>'.$fncname.'('.$string4param.') wurde '.$FncCall['count'].' aufgerufen</i>'.' backtrace '.$backtraceString, $param_print, $param_force);
$allFncCalls += $FncCall['count'];
}
D::ulli('<b>'.$fncname.' general: '.$allFncCalls.' (zu '.$count_diff_FncCalls.') </b>');
D::ulli('<b>'.$fncname.' general: '.$allFncCalls.' (zu '.$count_diff_FncCalls.') </b>', $param_print, $param_force);
}
}
......@@ -153,13 +153,13 @@ class mcPerformance {
$getIDFnc = false;
}
D::li('<b>'.$classname.'</b>');
D::ulli('<b>'.$classname.'</b>', $param_print, $param_force);
foreach($fnc as $fncname => $objects) {
if($getIDFnc) {
D::ulli('<b>'.$fncname.' mit '.count($objects).' unterschiedlichen objects </b>');
D::ulli('<b>'.$fncname.' mit '.count($objects).' unterschiedlichen objects </b>', $param_print, $param_force);
foreach($objects as $objID => $objIDArray) {
D::ulli('<b><i>'.$objID.' => wurde '.count($objIDArray).' geladen</i></b>');
D::ulli('<b><i>'.$objID.' => wurde '.count($objIDArray).' geladen</i></b>', $param_print, $param_force);
foreach($objIDArray as $obj) {
if(strlen($obj['param']) < 32) {
$string4param = "\t Param(".$obj['param'].")";
......@@ -175,11 +175,11 @@ class mcPerformance {
}
}
D::ulli($obj['object'].' => '.$obj['count'].' x '.$fncname. $string4param.' backtrace '.$backtraceString);
D::ulli($obj['object'].' => '.$obj['count'].' x '.$fncname. $string4param.' backtrace '.$backtraceString, $param_print, $param_force);
}
}
} else {
D::ulli('<b>'.$fncname.' mit '.count($objects).' objects</b>');
D::ulli('<b>'.$fncname.' mit '.count($objects).' objects</b>', $param_print, $param_force);
foreach($objects as $obj) {
$string_param = str_replace('"', '', $obj['param']);
if(strlen($string_param) < 32) {
......@@ -195,7 +195,7 @@ class mcPerformance {
$backtraceString .= '- <b><i title="'.$string_backtrace.'">'.$index.'</i></b> ';
}
}
D::ulli($obj['object'].' => '.$obj['count'].' x '.$fncname. $string4param.' backtrace '.$backtraceString);
D::ulli($obj['object'].' => '.$obj['count'].' x '.$fncname. $string4param.' backtrace '.$backtraceString, $param_print, $param_force);
}
}
}
......
......@@ -40,6 +40,10 @@ if(!isset($__mc_D_LOGFILE)) {
*/
$__mc_D_LOGFILE_RESET = true;
}
if(!isset($__mc_D_LOGFILE_ONLY_USER)) {
$__mc_D_LOGFILE_ONLY_USER = true;
}
}
if(!isset($__mc_D_SCREENOUTPUT)) {
......
......@@ -13,7 +13,7 @@ mcReport::distribute($__mc_Report);
* developer things
*/
if($_LOSP_DEV) {
mcPerformance::showStats();
mcPerformance::showStats($__mc_D_LOGFILE_ONLY_USER);
D::showStats($__mc_Report, $__BASEPATH_EX, $__mc_D_LOGFILE);
if($__mc_D_SCREENOUTPUT) {
D::printToScreen();
......
......@@ -88,6 +88,7 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
$this->PUIXHostObject = $PUIXHostObject;
$this->ThisClassName = get_class($this);
$this->setRootTable();
// D::cf($this);
}
protected $SearchAttributes = null;
......@@ -146,16 +147,17 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
}
if(mcArray::checkKeyHasFullArray($values, $this->ThisClassName, mcPUIX::PUIXArray, mcPUIX::FORM_POST_VALUES)) {
$this->manipulatePost_Data($param_HostAccount, $param_iStorable, $values[$this->ThisClassName][mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES]);
}
$this->setTableValues($param_tablename, $values[$this->ThisClassName]);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_CHANGED;
//D::cf($this);
}
public function savePDOTable(Account &$param_HostAccount, iStorable &$param_iStorable) {
D::cf(get_class($this).' '.$this->RootTable);
// D::cf(get_class($this).' '.$this->RootTable);
$param_tablename = $this->RootTable;
$DBUIArray_Values = $this->getTableValues($param_tablename);
......@@ -195,28 +197,43 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
return $formpath;
}
public function getObjDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, $param_KindOf=null, array $param_DOMElemente=null) {
public function getObjDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, $param_KindOf=null, array $param_DOMElemente=null, $param_BOOL_getDOMElement_show=true, $param_BOOL_getDOMElement_edit=true, $param_BOOL_getDOMElement_editSpecial=true) {
$HostObject = $this->PUIXHostObject->getHostObject();
$DOMElement = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX);
$DOMElement->setAttribute('class', get_class($this));
$DOMElement->setAttribute('label', Language::getWord(get_class($this)));
if($param_KindOf==='form') {
if($param_KindOf==='form' && ($param_BOOL_getDOMElement_edit || $param_BOOL_getDOMElement_editSpecial)) {
$DOMElement_edit = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_edit);
$DOMElement_edit->setAttribute('edit', true);
$DOMElement_edit->setAttribute('formpath', $this->getFormPathToThis());
$DOMElement->appendChild($DOMElement_edit);
$this->getDOMElement_edit($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_edit, $param_KindOf, $param_DOMElemente);
// D::cf("$HostObject .".get_class($this)." ..... ----- ".$this->PUIXHostObject->returnKindOf());
$DOMElement_edit_special = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_edit_special);
$this->getDOMElement_editSpecial($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_edit_special, $param_KindOf, $param_DOMElemente);
$DOMElement_edit->appendChild($DOMElement_edit_special);
if($param_BOOL_getDOMElement_edit) {
// if(Category2::isEnabled($HostObject, get_class($this), 'getDOMElement_edit')) {
$DOMElement->appendChild($DOMElement_edit);
$this->getDOMElement_edit($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_edit, $param_KindOf, $param_DOMElemente);
}
if($param_BOOL_getDOMElement_editSpecial) {
// if(Category2::isEnabled($HostObject, get_class($this), 'getDOMElement_editSpecial')) {
$DOMElement_edit_special = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_edit_special);
$this->getDOMElement_editSpecial($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_edit_special, $param_KindOf, $param_DOMElemente);
$DOMElement_edit->appendChild($DOMElement_edit_special);
}
}
$DOMElement_show = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_show);
$DOMElement->appendChild($DOMElement_show);
$this->getDOMElement_show($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_show, $param_KindOf, $param_DOMElemente);
// if(Category2::isEnabled($HostObject, get_class($this), 'getDOMElement_show')) {
if($param_BOOL_getDOMElement_show) {
$DOMElement_show = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_show);
$DOMElement->appendChild($DOMElement_show);
$this->getDOMElement_show($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_show, $param_KindOf, $param_DOMElemente);
}
return $DOMElement;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!