Commit 26ab97b5 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Manual.rst: autocron report uses now {{DB_INDEX_QFQ:Y}}.

AutoCron.php: New constants   AUTOCRON_STATUS_OK, AUTOCRON_STATUS_ERROR. Status Length not limited anymore.
parent f6bb77b1
......@@ -6623,6 +6623,7 @@ Create / edit `autocron` jobs
Create a T3 page with a QFQ record. Such page should be access restricted and is only needed to edit `autocron` jobs: ::
form={{form:S}}
dbIndex={{DB_INDEX_QFQ:Y}}
10 {
# Table header.
......
......@@ -146,7 +146,7 @@ class AutoCron {
// Download page
$page = file_get_contents($job[AUTOCRON_CONTENT]);
if ($page === false) {
$job[AUTOCRON_LAST_STATUS] = htmlspecialchars('Error: failed to fetch "' . $job[AUTOCRON_CONTENT] . '"');
$job[AUTOCRON_LAST_STATUS] = htmlspecialchars(AUTOCRON_STATUS_ERROR . 'failed to fetch "' . $job[AUTOCRON_CONTENT] . '"');
return $job;
}
......@@ -159,8 +159,7 @@ class AutoCron {
Logger::logMessage($page, $job[AUTOCRON_OUTPUT_FILE], $job[AUTOCRON_OUTPUT_MODE] == 'append' ? FILE_MODE_APPEND : FILE_MODE_WRITE);
}
// Report the first 30 chars
$job[AUTOCRON_LAST_STATUS] = 'OK: ' . substr($page, 0, 30);
$job[AUTOCRON_LAST_STATUS] = AUTOCRON_STATUS_OK . $page;
// Check for pattern?
if (!empty($job[AUTOCRON_OUTPUT_PATTERN])) {
......@@ -168,11 +167,11 @@ class AutoCron {
$rc = preg_match($job[AUTOCRON_OUTPUT_PATTERN], $page);
if ($rc === false) {
$job[AUTOCRON_LAST_STATUS] = 'Error: preg_match() failed - "' . $job[AUTOCRON_OUTPUT_PATTERN] . '"';
$job[AUTOCRON_LAST_STATUS] = AUTOCRON_STATUS_ERROR . 'preg_match() failed - "' . $job[AUTOCRON_OUTPUT_PATTERN] . '"';
}
if ($rc === 0) {
$job[AUTOCRON_LAST_STATUS] = 'Error: pattern not found - "' . $job[AUTOCRON_OUTPUT_PATTERN] . '"';
$job[AUTOCRON_LAST_STATUS] = AUTOCRON_STATUS_ERROR . 'pattern not found - "' . $job[AUTOCRON_OUTPUT_PATTERN] . '"';
}
}
}
......
......@@ -1379,6 +1379,8 @@ const AUTOCRON_SQL1 = 'sql1';
const AUTOCRON_OUTPUT_FILE = 'outputFile';
const AUTOCRON_OUTPUT_MODE = 'outputMode';
const AUTOCRON_OUTPUT_PATTERN = 'outputPattern';
const AUTOCRON_STATUS_OK = 'OK: ';
const AUTOCRON_STATUS_ERROR = 'Error: ';
const AUTOCRON_UNIT = 'unit';
const AUTOCRON_COUNT = 'count';
......
Supports Markdown
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