Commit 0127edc7 authored by dmorley's avatar dmorley

status of all the things in the db

parent 85e06ae2
Pipeline #547 passed with stage
in 1 minute and 40 seconds
......@@ -49,4 +49,4 @@ while ($entry = $dirh->read()) {
);
}
updateStatus('backup_data');
updateStatus('backup_data', date('Y-m-d H:i:s'));
......@@ -84,4 +84,4 @@ foreach ($softwares as $software => $details) {
printf('%s:%s:%s ', $software, $masterversion, $devlastcommit ?: 'n/a');
}
updateStatus('masterversions_updated');
updateStatus('masterversions_updated', date('Y-m-d H:i:s'));
......@@ -55,4 +55,4 @@ foreach ($monthly_totals as $monthly) {
}
}
updateStatus('monthlystats_updated');
updateStatus('monthlystats_updated', date('Y-m-d H:i:s'));
......@@ -54,4 +54,4 @@ foreach ($results as $result) {
echo exec("php-cgi add.php domain={$result}") . "\r\n";
}
updateStatus('federation_crawldate');
updateStatus('federation_crawldate', date('Y-m-d H:i:s'));
......@@ -430,7 +430,7 @@ foreach ($pods as $pod) {
echo $newline;
}
updateStatus('pods_updated');
updateStatus('pods_updated', date('Y-m-d H:i:s'));
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
updateStatus('pods_update_runtime', $execution_time);
updateStatus('pods_update_runtime', round($execution_time));
......@@ -26,7 +26,8 @@ try {
$dbstatus = R::getRow('
SELECT pods_updated
FROM status
ORDER BY pods_updated
WHERE pods_updated is not null
ORDER BY id DESC
LIMIT 1
');
} catch (\RedBeanPHP\RedException $e) {
......
......@@ -219,14 +219,9 @@ function debugToConsole($data): void
*/
function updateStatus($colname, $value = null)
{
if ($value) {
$colvalue = $value;
} else {
$colvalue = date('Y-m-d H:i:s');
}
try {
$u = R::dispense('status');
$u[$colname] = $colvalue;
$u[$colname] = $value;
R::store($u);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......
......@@ -11,7 +11,8 @@ try {
$updbstatus = R::getRow('
SELECT pods_updated
FROM status
ORDER BY pods_updated
WHERE pods_updated is not null
ORDER BY id DESC
LIMIT 1
');
} catch (\RedBeanPHP\RedException $e) {
......@@ -21,7 +22,8 @@ try {
$durdbstatus = R::getRow('
SELECT pods_update_runtime
FROM status
ORDER BY pods_update_runtime
WHERE pods_update_runtime is not null
ORDER BY id DESC
LIMIT 1
');
} catch (\RedBeanPHP\RedException $e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment