Files
Froxlor/install/lib/updateFunctions.php
Michael Kaufmann 3a99e10296 set version to 0.10.23 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-28 11:09:56 +01:00

89 lines
2.3 KiB
PHP

<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
/**
* Function showUpdateStep
*
* outputs and logs the current
* update progress
*
* @param
* string task/status
* @param
* bool needs_status (if false, a linebreak will be added)
*
* @return string formatted output and log-entry
*/
function showUpdateStep($task = null, $needs_status = true)
{
set_time_limit(30);
if (! $needs_status)
echo "<b>";
// output
echo $task;
if (! $needs_status) {
echo "</b><br />";
}
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, $task);
}
/**
* Function lastStepStatus
*
* outputs [OK] (success), [??] (warning) or [!!] (failure)
* of the last update-step
*
* @param
* int status (0 = success, 1 = warning, 2 = failure)
*
* @return string formatted output and log-entry
*/
function lastStepStatus($status = -1, $message = '')
{
switch ($status) {
case 0:
$status_sign = ($message != '') ? '[' . $message . ']' : '[OK]';
$status_color = 'ok';
break;
case 1:
$status_sign = ($message != '') ? '[' . $message . ']' : '[??]';
$status_color = 'warn';
break;
case 2:
$status_sign = ($message != '') ? '[' . $message . ']' : '[!!]';
$status_color = 'err';
break;
default:
$status_sign = '[unknown]';
$status_color = 'unknown';
break;
}
// output
echo "<span class=\"update-step update-step-" . $status_color . "\">" . $status_sign . "</span><br />";
if ($status == - 1 || $status == 2) {
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
} elseif ($status == 0 || $status == 1) {
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Success');
}
}