Commit 8943aa4d authored by Côme Chilliet's avatar Côme Chilliet

Merge branch '6065-possibility-to-see-logs-in-server-logs-instead-of-the-interface' into '1.4-dev'

Resolve "Possibility to see logs in server logs instead of the interface"

See merge request fusiondirectory/fd!741
parents 03bfeb94 3ac26e51
......@@ -334,6 +334,12 @@ attributetype ( 1.3.6.1.4.1.38414.8.16.4 NAME 'fdDebugLevel'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.38414.8.16.5 NAME 'fdDebugLogging'
DESC 'FusionDirectory - Debug logging'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
# Snapshots
attributetype ( 1.3.6.1.4.1.38414.8.17.1 NAME 'fdEnableSnapshots'
......@@ -599,7 +605,7 @@ objectclass ( 1.3.6.1.4.1.38414.8.2.1 NAME 'fusionDirectoryConf'
fdModificationDetectionAttribute $ fdLogging $ fdLdapSizeLimit $ fdWildcardForeignKeys $
fdLoginAttribute $ fdForceSSL $ fdWarnSSL $ fdStoreFilterSettings $ fdSessionLifeTime $
fdHttpAuthActivated $ fdHttpHeaderAuthActivated $ fdHttpHeaderAuthHeaderName $
fdDisplayErrors $ fdLdapMaxQueryTime $ fdLdapStats $ fdDebugLevel $
fdDisplayErrors $ fdLdapMaxQueryTime $ fdLdapStats $ fdDebugLevel $ fdDebugLogging $
fdEnableSnapshots $ fdSnapshotBase $
fdTabHook $ fdShells $ fdDefaultShell $ fdDisplayHookOutput $
fdPluginsMenuBlacklist $ fdManagementConfig $ fdManagementUserConfig $
......
......@@ -105,7 +105,7 @@ if (!is_readable(CONFIG_DIR.'/'.CONFIG_FILE)) {
$config = new config(CONFIG_DIR.'/'.CONFIG_FILE, $BASE_DIR);
session::set('config', $config);
session::set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL'));
@DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
/* Configuration was reloaded, so plist needs to be as well */
session::un_set('plist');
unset($plist);
......
......@@ -40,9 +40,9 @@ session::start();
reset_errors();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@DEBUG(DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, '_POST');
logging::debug(DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, '_POST');
}
@DEBUG(DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, $_SESSION, '_SESSION');
logging::debug(DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, $_SESSION, '_SESSION');
/* Logged in? Simple security check */
if (!session::is_set('connected')) {
......@@ -86,7 +86,7 @@ if (session::get('_LAST_PAGE_REQUEST') != '') {
session::set('_LAST_PAGE_REQUEST', time());
@DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
/* Set template compile directory */
$smarty->compile_dir = $config->get_cfg_value("templateCompileDirectory", SPOOL_DIR);
......@@ -109,14 +109,14 @@ $smarty->assign('hideMenus', FALSE);
/* check user expiration status */
$expired = $ui->expired_status();
if (($expired == POSIX_WARN_ABOUT_EXPIRATION) && !session::is_set('POSIX_WARN_ABOUT_EXPIRATION__DONE')) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account ('.$ui->uid.') is about to expire');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account ('.$ui->uid.') is about to expire');
// The users password is about to expire soon, display a warning message.
logging::log('security', 'fusiondirectory', '', [], 'password for user "'.$ui->uid.'" is about to expire');
msg_dialog::display(_('Password change'), _('Your password is about to expire, please change your password!'), INFO_DIALOG);
session::set('POSIX_WARN_ABOUT_EXPIRATION__DONE', TRUE);
} elseif ($expired == POSIX_FORCE_PASSWORD_CHANGE) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account expired');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account expired');
// The password is expired, we are now going to enforce a new one from the user.
......
......@@ -72,7 +72,7 @@ class CopyPasteHandler
*/
function add_to_queue ($dn, $action, $type)
{
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'add_to_queue');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'add_to_queue');
if (!in_array($action, ['cut','copy'])) {
trigger_error(sprintf('Specified action "%s" does not exists for copy & paste.', $action));
......@@ -136,7 +136,7 @@ class CopyPasteHandler
*/
protected function load_entry_from_ldap ($entry)
{
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry['dn'], 'load_entry_from_ldap');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry['dn'], 'load_entry_from_ldap');
if (!isset($entry['tab_class']) && !isset($entry['type'])) {
return [];
}
......
......@@ -60,7 +60,7 @@ class Language
bindtextdomain($domain, LOCALE_DIR);
textdomain($domain);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, 'Setting language to');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, 'Setting language to');
}
$ret = FALSE;
......@@ -70,7 +70,7 @@ class Language
$ret = TRUE;
if (session::is_set('plist')) {
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, session::get('lang'), 'Plist already loaded with language');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, session::get('lang'), 'Plist already loaded with language');
}
session::un_set('plist');
session::set('lang', $lang);
......
......@@ -965,7 +965,7 @@ class config
if (($tabclass == 'GROUPTABS') && class_available('mixedGroup')) {
$tabclass = 'OGROUP-USERTABS';
}
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class to tab list");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class to tab list");
if (!isset($this->data['TABS'][$tabclass])) {
$this->data['TABS'][$tabclass] = [];
}
......@@ -1007,7 +1007,7 @@ class config
$value['tabClass'] = 'simpleTabs';
}
$this->data['OBJECTS'][strtoupper($key)] = $value;
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class as main tab of");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class as main tab of");
if (!isset($this->data['TABS'][$tabclass])) {
$this->data['TABS'][$tabclass] = [];
}
......@@ -1015,7 +1015,7 @@ class config
}
}
} elseif (class_available($class) && is_subclass_of($class, 'simpleService')) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class, "Adding service");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class, "Adding service");
if (!isset($this->data['TABS']['SERVERSERVICE'])) {
$this->data['TABS']['SERVERSERVICE'] = [];
}
......@@ -1057,7 +1057,7 @@ class config
];
/* Extract categories definitions from object types */
foreach ($this->data['OBJECTS'] as $key => $infos) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['aclCategory'], "ObjectType $key category");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['aclCategory'], "ObjectType $key category");
if (strtoupper($infos['aclCategory']) == $key) {
$cat = $infos['aclCategory'];
if (!isset($this->data['CATEGORIES'][$cat])) {
......@@ -1135,7 +1135,7 @@ class config
}
}
}
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(',', array_unique($acl)), "Class $class categories");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(',', array_unique($acl)), "Class $class categories");
/* Feed menu */
if (isset($plInfo['plSection'])) {
$section = $plInfo['plSection'];
......
This diff is collapsed.
......@@ -88,6 +88,66 @@ class logging
}
}
/*!
* \brief Debug output method
*
* Print a DEBUG level if specified debug level of the level matches the
* the configured debug level.
*
* \param int $level The log level of the message (one of the DEBUG_* constants)
*
* \param int $line Line of origin (using __LINE__ is common)
*
* \param string $function Function of origin (using __FUNCTION__ is common)
*
* \param string $file File of origin (using __FILE__ is common)
*
* \param mixed $data Operation result. Can be a message or an array, which is printed with print_a.
*
* \param string $info Operation description
*/
static function debug (int $level, int $line, string $function, string $file, $data, string $info = '')
{
global $config;
static $first = TRUE;
if (($_SERVER['REQUEST_METHOD'] == 'POST') && preg_match('/index.php$/', $_SERVER['REQUEST_URI'])) {
return;
}
if (session::get('DEBUGLEVEL') & $level) {
if ($first) {
echo '<div id="debug-handling" class="notice">'.
'<img src="geticon.php?context=status&amp;icon=dialog-information&amp;size=22" alt="Information" style="vertical-align:middle;margin-right:.2em;"/>'.
'There is some debug output '.
'<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle(); });">Toggle</button>'.
'</div>';
$first = FALSE;
}
$output = "DEBUG[$level] ";
if ($function != '') {
$output .= "($file:$function():$line) - $info: ";
} else {
$output .= "($file:$line) - $info: ";
}
echo '<div class="debug_div">';
echo $output;
$logline = $output;
if (is_array($data)) {
print_a($data);
$logline .= print_r($data, TRUE);
} else {
echo "'$data'";
$logline .= "'$data'";
}
echo "</div>\n";
if (is_object($config) && preg_match('/true/i', $config->get_cfg_value('debugLogging', ''))) {
fusiondirectory_log($logline);
}
}
}
/*!
* \brief Check the options
*
......
......@@ -338,7 +338,7 @@ class objects
$tabClass = $infos['tabClass'];
$tabObject = new $tabClass($type, $dn);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Openned as $type object");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Openned as $type object");
return $tabObject;
}
......@@ -406,7 +406,7 @@ class objects
$attrsObject->is_template = TRUE;
$tabObject = new $tabClass($type, 'new', $attrsObject);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Create template of $type");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Create template of $type");
return $tabObject;
}
......
......@@ -110,7 +110,7 @@ class passwordRecovery extends standAlonePage
msg_dialog::displayChecks($this->message);
}
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->step, "Step");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->step, "Step");
$smarty = get_smarty();
......@@ -149,7 +149,7 @@ class passwordRecovery extends standAlonePage
$this->loginAttribute = $config->get_cfg_value('passwordRecoveryLoginAttribute', 'uid');
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $config->get_cfg_value('passwordRecoveryActivated'), "passwordRecoveryActivated");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $config->get_cfg_value('passwordRecoveryActivated'), "passwordRecoveryActivated");
return ($config->get_cfg_value('passwordRecoveryActivated') == "TRUE");
}
......@@ -341,7 +341,7 @@ class passwordRecovery extends standAlonePage
$reinit_link .= '&login='.urlencode($this->login);
$reinit_link .= '&email_address='.urlencode($this->email_address);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $reinit_link, 'Setting link to');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $reinit_link, 'Setting link to');
/* Send the mail */
$body = sprintf($this->mail_body, $this->login, $reinit_link);
......
......@@ -129,7 +129,7 @@ class standAlonePage
/* Parse configuration file */
$config = new config(CONFIG_DIR.'/'.CONFIG_FILE, $BASE_DIR);
session::set('DEBUGLEVEL', $config->get_cfg_value('debuglevel'));
@DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
return $config;
}
......
......@@ -100,7 +100,7 @@ function __fusiondirectory_autoload ($class_name)
if (isset($class_mapping["$class_name"])) {
require_once($BASE_DIR.'/'.$class_mapping["$class_name"]);
} else {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class_name, 'Could not load');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class_name, 'Could not load');
if (isset($config) && is_object($config) &&
$config->get_cfg_value('displayerrors') == 'TRUE') {
list($trace, ) = html_trace();
......@@ -172,34 +172,7 @@ function plugin_available ($plugin)
*/
function DEBUG ($level, $line, $function, $file, $data, $info = '')
{
static $first = TRUE;
if (($_SERVER['REQUEST_METHOD'] == 'POST') && preg_match('/index.php$/', $_SERVER['REQUEST_URI'])) {
return;
}
if (session::get('DEBUGLEVEL') & $level) {
if ($first) {
echo '<div id="debug-handling" class="notice">'.
'<img src="geticon.php?context=status&amp;icon=dialog-information&amp;size=22" alt="Information" style="vertical-align:middle;margin-right:.2em;"/>'.
'There is some debug output '.
'<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle(); });">Toggle</button>'.
'</div>';
$first = FALSE;
}
$output = "DEBUG[$level] ";
if ($function != '') {
$output .= "($file:$function():$line) - $info: ";
} else {
$output .= "($file:$line) - $info: ";
}
echo '<div class="debug_div">';
echo $output;
if (is_array($data)) {
print_a($data);
} else {
echo "'$data'";
}
echo "</div>\n";
}
logging::debug($level, $line, $function, $file, $data, $info);
}
/*!
......
......@@ -440,7 +440,7 @@ class management
// Handle actions (POSTs and GETs)
$action = $this->detectPostActions();
if (!empty($action['action'])) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action, 'Action');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action, 'Action');
try {
$str = $this->handleAction($action);
if (!empty($str)) {
......@@ -670,7 +670,7 @@ class management
return;
} else {
if (!$cancel) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Template applied!');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Template applied!');
}
del_lock($this->currentDn);
if (empty($this->currentDns)) {
......@@ -711,7 +711,7 @@ class management
// Open object
$this->openTabObject(objects::create($type));
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create entry initiated');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create entry initiated');
}
function newEntryTemplate (array $action)
......@@ -725,7 +725,7 @@ class management
// Open object
$this->openTabObject(objects::createTemplate($type));
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create template entry initiated');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create template entry initiated');
}
function newEntryFromTemplate (array $action)
......@@ -834,7 +834,7 @@ class management
// Open object
$this->openTabObject(objects::open($this->currentDn, $entry->getTemplatedType()));
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Edit entry initiated');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Edit entry initiated');
if (isset($action['subaction'])
&& ($this->handleSubAction($action) === FALSE)) {
trigger_error('Was not able to handle subaction: '.$action['subaction']);
......@@ -874,7 +874,7 @@ class management
msg_dialog::displayChecks($msgs);
return;
} else {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry saved');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry saved');
$this->remove_lock();
$this->closeDialogs();
}
......@@ -892,7 +892,7 @@ class management
if (count($msgs)) {
msg_dialog::displayChecks($msgs);
} else {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Modifications applied');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Modifications applied');
$this->tabObject->re_init();
/* Avoid applying the POST a second time */
$_POST = [];
......@@ -909,7 +909,7 @@ class management
$disallowed = [];
$this->currentDns = [];
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Entry deletion requested');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Entry deletion requested');
// Check permissons for each target
foreach ($action['targets'] as $dn) {
......@@ -973,7 +973,7 @@ class management
function removeConfirmed (array $action)
{
global $ui;
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry deletion confirmed');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry deletion confirmed');
foreach ($this->currentDns as $dn) {
$entry = $this->listing->getEntry($dn);
......@@ -1028,11 +1028,11 @@ class management
$entry = $this->listing->getEntry($dn);
if (($action['action'] == 'copy') && $entry->checkAcl('r')) {
$this->cpHandler->add_to_queue($dn, 'copy', $entry->getTemplatedType());
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry copied!');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry copied!');
}
if (($action['action'] == 'cut') && $entry->checkAcl('rd')) {
$this->cpHandler->add_to_queue($dn, 'cut', $entry->getTemplatedType());
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry cut!');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry cut!');
}
}
}
......@@ -1065,7 +1065,7 @@ class management
function createSnapshotDialog (array $action)
{
global $config, $ui;
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Snapshot creation initiated!');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Snapshot creation initiated!');
$this->currentDn = array_pop($action['targets']);
if (empty($this->currentDn)) {
......@@ -1102,7 +1102,7 @@ class management
}
if ($ui->allow_snapshot_restore($this->currentDn, $aclCategories, empty($action['targets']))) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Snapshot restoring initiated!');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Snapshot restoring initiated!');
$this->dialogObject = new SnapshotRestoreDialog($this->currentDn, $this, empty($action['targets']), $aclCategories);
} else {
msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $this->currentDn),
......@@ -1192,7 +1192,7 @@ class management
$entry = $this->listing->getEntry($dn);
if ($entry->snapshotCreationAllowed()) {
$this->snapHandler->createSnapshot($dn, $description, $entry->type);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot created!');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot created!');
} else {
msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $dn),
ERROR_DIALOG);
......@@ -1209,7 +1209,7 @@ class management
global $ui;
if (!empty($dn) && $ui->allow_snapshot_restore($dn, $this->dialogObject->aclCategory, $this->dialogObject->global)) {
$dn = $this->snapHandler->restoreSnapshot($dn);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot restored');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot restored');
$this->closeDialogs();
if ($dn !== FALSE) {
$this->listing->focusDn($dn);
......@@ -1237,7 +1237,7 @@ class management
global $ui;
if (!empty($dn) && $ui->allow_snapshot_delete($dn, $this->dialogObject->aclCategory)) {
$this->snapHandler->removeSnapshot($dn);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot deleted');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot deleted');
} else {
msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to delete a snapshot for %s.'), $dn),
ERROR_DIALOG);
......
......@@ -144,7 +144,7 @@ class PropertiesColumn extends Column
'tab' => $class,
];
} else {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $pInfos['plShortName']." ($class)", 'No icon for');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $pInfos['plShortName']." ($class)", 'No icon for');
}
} else {
$icons[] = [
......
......@@ -199,7 +199,7 @@ class SnapshotHandler
{
global $config;
if (!$this->enabled()) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to create snapshot');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to create snapshot');
return;
}
......@@ -214,7 +214,7 @@ class SnapshotHandler
/* check if the dn exists */
if (!$ldap->dn_exists($dn)) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Tried to snapshot non-existing dn');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Tried to snapshot non-existing dn');
return;
}
......@@ -376,7 +376,7 @@ class SnapshotHandler
{
global $config;
if (!$this->enabled()) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to restore snapshot');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to restore snapshot');
return FALSE;
}
......
......@@ -246,7 +246,7 @@ class simplePlugin implements SimpleTab
/* Set the template flag according to the existence of objectClass fdTemplate */
if (isset($this->attrs['objectClass']) && in_array_ics('fdTemplate', $this->attrs['objectClass'])) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, 'found', 'Template check');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, 'found', 'Template check');
$this->setTemplate(TRUE);
$this->templateLoadAttrs($this->attrs);
}
......@@ -254,7 +254,7 @@ class simplePlugin implements SimpleTab
/* Is Account? */
if ($this->is_this_account($this->attrs)) {
$this->is_account = TRUE;
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, get_class($this), 'Tab active');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, get_class($this), 'Tab active');
}
}
......@@ -592,7 +592,7 @@ class simplePlugin implements SimpleTab
$ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $dst_dn));
if (!$ldap->rename_dn($src_dn, $dst_dn)) {
logging::log('error', 'ldap', "FROM: $src_dn -- TO: $dst_dn", [], 'Ldap Protocol v3 implementation error, ldap_rename failed: '.$ldap->get_error());
@DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, "Rename failed FROM: $src_dn -- TO: $dst_dn",
logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, "Rename failed FROM: $src_dn -- TO: $dst_dn",
'Ldap Protocol v3 implementation error. Error:'.$ldap->get_error());
return $ldap->get_error();
}
......@@ -647,7 +647,7 @@ class simplePlugin implements SimpleTab
*/
function execute (): string
{
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "execute");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "execute");
/* Reset Lock message POST/GET check array, to prevent preg_match errors */
session::set('LOCK_VARS_TO_USE', []);
......@@ -1125,7 +1125,7 @@ class simplePlugin implements SimpleTab
*/
function save_object ()
{
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'save_object');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'save_object');
if ($this->displayHeader && isset($_POST[get_class($this).'_modify_state'])) {
if ($this->is_account && $this->acl_is_removeable()) {
$this->is_account = FALSE;
......@@ -1243,7 +1243,7 @@ class simplePlugin implements SimpleTab
*/
function save (): array
{
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "save");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "save");
$errors = $this->prepare_save();
if (!empty($errors)) {
return $errors;
......@@ -1515,14 +1515,14 @@ class simplePlugin implements SimpleTab
$command = templateHandling::parseString($command, $addAttrs, 'escapeshellarg');
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execute');
logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execute');
exec($command, $arr, $returnCode);
$returnOutput = $arr;
if ($returnCode != 0) {
$str = implode("\n", $arr);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execution failed code: '.$returnCode);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execution failed code: '.$returnCode);
logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
$message = msgPool::cmdexecfailed($cmd, '', get_class($this));
$message .= '<br/><br/>'."\n";
$message .= 'Exit code: '.$returnCode.'<br/>'."\n";
......@@ -1532,7 +1532,7 @@ class simplePlugin implements SimpleTab
$messages[] = $message;
} elseif (is_array($arr)) {
$str = implode("\n", $arr);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
if (!empty($str) && $config->get_cfg_value('displayHookOutput', 'FALSE') == 'TRUE') {
msg_dialog::display('['.get_class($this).' '.strtolower($cmd).'trigger] '.$command, $str, INFO_DIALOG);
}
......@@ -1545,7 +1545,7 @@ class simplePlugin implements SimpleTab
*/
function check (): array
{
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'check');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'check');
$messages = [];
foreach ($this->attributesInfo as $sectionInfo) {
......
......@@ -162,11 +162,11 @@ class simpleTabs
global $ui;
$baseobject = $this->getBaseObject();
if (isset($baseobject->base)) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixing base');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixing base');
$baseobject->base = $ui->getCurrentBase();
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixed base');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixed base');
} else {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, '', 'no base');
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, '', 'no base');
}
}
......@@ -224,7 +224,7 @@ class simpleTabs
/* Save last tab */
if ($this->last != "") {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->last, "Saving");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->last, "Saving");
$this->by_object[$this->last]->save_object();
}
......@@ -349,7 +349,7 @@ class simpleTabs
foreach ($this->by_object as $key => $obj) {
$this->plNotify[$key] = FALSE;
if (($obj->is_account || $obj->ignore_account) && (!$obj->is_template)) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, "Checking");
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, "Checking");
$msg = $obj->check();