1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-05 18:35:01 +02:00

Admin-UI: Log Query, Page and Observer Methods to e_LOG when in debug mode.

This commit is contained in:
Cameron 2020-03-27 14:06:44 -07:00
parent 3173c9c173
commit 3f415f70c1
2 changed files with 43 additions and 3 deletions

View File

@ -1731,6 +1731,9 @@ class e_admin_controller
->setParams($params);
$this->checkAccess();
$this->_log(); // clear the log (when debug is enabled)
}
/**
@ -2080,6 +2083,7 @@ class e_admin_controller
$method = $this->toMethodName($action, 'page');
if(!method_exists($this, $method))
{
$this->_log("Skipping ".$method."() (not found)");
$this->getRequest()->setAction($this->getDefaultAction());
}
@ -2087,12 +2091,38 @@ class e_admin_controller
$method = $this->toMethodName($this->getRequest()->getActionName(), 'page');
if(!method_exists($this, $method))
{
$this->_log("Skipping ".$method."() (not found)");
$this->getRequest()->setAction('e404');
$message = e107::getParser()->lanVars(LAN_UI_404_METHOD_ERROR, $method, true);
e107::getMessage()->add($message, E_MESSAGE_ERROR);
}
}
/**
* Log Controller when e_DEBUG is active.
* @param string|null $message
* @return null
*/
protected function _log($message=null)
{
if(!deftrue('e_DEBUG'))
{
return null;
}
if($message === null) // clear the log.
{
file_put_contents(e_LOG."adminUI.log", '');
return null;
}
$date = (!empty($message)) ? date('c') : '';
file_put_contents(e_LOG."adminUI.log",$date."\t".$message."\n",FILE_APPEND);
}
/**
* Dispatch observer, check for triggers
*
@ -2118,8 +2148,12 @@ class e_admin_controller
$actionObserverName = $this->toMethodName($action, 'observer', e_AJAX_REQUEST);
if(method_exists($this, $actionObserverName))
{
$this->_log("Executing ".$actionObserverName."()");
$this->$actionObserverName();
}
else
{
$this->_log("Skipping ".$actionObserverName."() (not found)");
}
// check for triggers, not available in Ajax mode
@ -2213,9 +2247,14 @@ class e_admin_controller
$ret = '';
if(!method_exists($this, $actionName)) // pre dispatch already switched to default action/not found page if needed
{
$this->_log("Skipping ".$actionName."() (not found)");
e107::getMessage()->add('Action '.$actionName.' no found!', E_MESSAGE_ERROR);
return $response;
}
else
{
$this->_log("Executing ".$actionName."()");
}
if($action != 'Prefs' && $action != 'Create' && $action !='Edit' && $action != 'List') // Custom Page method in use, so add the title.
{
@ -3872,6 +3911,7 @@ class e_admin_controller_ui extends e_admin_controller
{
// Build query
$qry = $this->_modifyListQry(false, true, 0, 20, $listQry);
$this->_log("Filter ListQry: ".$qry);
//file_put_contents(e_LOG.'uiAjaxResponseSQL.log', $qry."\n\n", FILE_APPEND);
// Make query
@ -4573,7 +4613,7 @@ class e_admin_controller_ui extends e_admin_controller
// echo $qry.'<br />';
// print_a($this->fields);
$this->_log('listQry: '.str_replace('#', MPREFIX, $qry));
return $qry;
}

View File

@ -4308,7 +4308,7 @@ var_dump($select_options);*/
$cnt = 0;
$text = '';
foreach ($fieldarray as $field => $data)
{