Loglevels are adjusted

This commit is contained in:
Michael 2022-08-30 19:45:30 +00:00
parent 312e4d8844
commit 757a5c2de9
32 changed files with 93 additions and 111 deletions

View file

@ -128,7 +128,7 @@ class Addon
{
$addon = Strings::sanitizeFilePathItem($addon);
Logger::notice("Addon {addon}: {action}", ['action' => 'uninstall', 'addon' => $addon]);
Logger::debug("Addon {addon}: {action}", ['action' => 'uninstall', 'addon' => $addon]);
DBA::delete('addon', ['name' => $addon]);
@include_once('addon/' . $addon . '/' . $addon . '.php');
@ -160,7 +160,7 @@ class Addon
return false;
}
Logger::notice("Addon {addon}: {action}", ['action' => 'install', 'addon' => $addon]);
Logger::debug("Addon {addon}: {action}", ['action' => 'install', 'addon' => $addon]);
$t = @filemtime($addon_file_path);
@include_once($addon_file_path);
if (function_exists($addon . '_install')) {
@ -200,7 +200,7 @@ class Addon
continue;
}
Logger::notice("Addon {addon}: {action}", ['action' => 'reload', 'addon' => $addon['name']]);
Logger::debug("Addon {addon}: {action}", ['action' => 'reload', 'addon' => $addon['name']]);
self::uninstall($addon['name']);
self::install($addon['name']);

View file

@ -493,30 +493,30 @@ class System
*
* @return boolean the directory is usable
*/
public static function isDirectoryUsable($directory, $check_writable = true)
private static function isDirectoryUsable($directory, $check_writable = true)
{
if ($directory == '') {
Logger::info('Directory is empty. This shouldn\'t happen.');
Logger::warning('Directory is empty. This shouldn\'t happen.');
return false;
}
if (!file_exists($directory)) {
Logger::info('Path "' . $directory . '" does not exist for user ' . static::getUser());
Logger::warning('Path does not exist', ['directory' => $directory, 'user' => static::getUser()]);
return false;
}
if (is_file($directory)) {
Logger::info('Path "' . $directory . '" is a file for user ' . static::getUser());
Logger::warning('Path is a file', ['directory' => $directory, 'user' => static::getUser()]);
return false;
}
if (!is_dir($directory)) {
Logger::info('Path "' . $directory . '" is not a directory for user ' . static::getUser());
Logger::warning('Path is not a directory', ['directory' => $directory, 'user' => static::getUser()]);
return false;
}
if ($check_writable && !is_writable($directory)) {
Logger::info('Path "' . $directory . '" is not writable for user ' . static::getUser());
Logger::warning('Path is not writable', ['directory' => $directory, 'user' => static::getUser()]);
return false;
}
@ -550,7 +550,7 @@ class System
{
$temppath = DI::config()->get("system", "temppath");
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
if (($temppath != "") && self::isDirectoryUsable($temppath)) {
// We have a temp path and it is usable
return BasePath::getRealPath($temppath);
}
@ -559,7 +559,7 @@ class System
$temppath = sys_get_temp_dir();
// Check if it is usable
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
if (($temppath != "") && self::isDirectoryUsable($temppath)) {
// Always store the real path, not the path through symlinks
$temppath = BasePath::getRealPath($temppath);
@ -570,7 +570,7 @@ class System
mkdir($new_temppath);
}
if (System::isDirectoryUsable($new_temppath)) {
if (self::isDirectoryUsable($new_temppath)) {
// The new path is usable, we are happy
DI::config()->set("system", "temppath", $new_temppath);
return $new_temppath;
@ -593,7 +593,7 @@ class System
public static function getSpoolPath()
{
$spoolpath = DI::config()->get('system', 'spoolpath');
if (($spoolpath != "") && System::isDirectoryUsable($spoolpath)) {
if (($spoolpath != "") && self::isDirectoryUsable($spoolpath)) {
// We have a spool path and it is usable
return $spoolpath;
}
@ -608,7 +608,7 @@ class System
mkdir($spoolpath);
}
if (System::isDirectoryUsable($spoolpath)) {
if (self::isDirectoryUsable($spoolpath)) {
// The new path is usable, we are happy
DI::config()->set("system", "spoolpath", $spoolpath);
return $spoolpath;

View file

@ -104,7 +104,7 @@ class Worker
foreach ($r as $entry) {
// The work will be done
if (!self::execute($entry)) {
Logger::notice('Process execution failed, quitting.');
Logger::warning('Process execution failed, quitting.');
return;
}

View file

@ -101,7 +101,7 @@ class Cron
// How long is the process already running?
$duration = (time() - strtotime($entry["executed"])) / 60;
if ($duration > $max_duration) {
Logger::notice('Worker process took too much time - killed', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]);
Logger::warning('Worker process took too much time - killed', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]);
posix_kill($entry["pid"], SIGTERM);
// We killed the stale process.