Skip to content
Code-Schnipsel Gruppen Projekte
Commit d3335217 erstellt von Florian Bogner's avatar Florian Bogner
Dateien durchsuchen

fix: Minor bugfixes and improvements for the cronservice client.

Übergeordneter 6bf5df4a
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -9,6 +9,7 @@ QUI::$Ajax->registerFunction(
'package_quiqqer_cron_ajax_cronservice_getStatus',
function () {
$CronService = new \QUI\Cron\CronService();
return $CronService->getStatus();
},
array(),
......
......@@ -69,17 +69,16 @@ define('package/quiqqer/cron/bin/CronServiceWindow', [
this.Loader.show();
QUIAjax.get('package_quiqqer_cron_ajax_cronservice_getStatus', function (result) {
console.log(result);
var status = result;
var statusText = QUILocale.get(lg, 'cron.window.cronservice.status.text.unregistered');
if (status['status'] == 1) {
statusText = QUILocale.get(lg, 'cron.window.cronservice.status.text.registered');
}
if (status['status'] == 2) {
statusText = QUILocale.get(lg, 'cron.window.cronservice.status.text.inactive');
}
console.log(status);
Content.set('html', Mustache.render(template, {
cron_window_cronservice_content_title : QUILocale.get(lg, 'cron.window.cronservice.content.title'),
......@@ -94,7 +93,7 @@ define('package/quiqqer/cron/bin/CronServiceWindow', [
cron_window_cronservice_content_register_lbl_stats_lastExecution: QUILocale.get(lg, 'cron.window.cronservice.content.register.lbl.stats.lastExecution'),
statusText : statusText,
status : status['status'],
statusErrors : status['errors'],
statusErrors : status['current_failures'], //== 0 ? "0": status['errors'].toString(),
statusLastExecution : status['last_execution'],
registered : (status['status'] != 0),
active : (status['status'] == 1),
......@@ -175,6 +174,8 @@ define('package/quiqqer/cron/bin/CronServiceWindow', [
self.register(Email.value).then(function () {
self.refresh();
Sheet.destroy();
}).catch(function () {
self.Loader.hide();
});
});
},
......
......@@ -64,13 +64,16 @@
</locale>
<locale name="exception.registration.empty.email">
<de><![CDATA[Es muss eine Email angegeben sein.]]></de>
<en><![CDATA[A email must be given.]]></en>
<en><![CDATA[An email must be given.]]></en>
</locale>
<locale name="exception.registration.empty.packageDir">
<de><![CDATA[Konnte den "package" Pfad nicht auslesen!]]></de>
<en><![CDATA[Could not parse the "package" folder path.]]></en>
</locale>
<locale name="cron.window.cronservice.status.text.last_execution.never">
<de><![CDATA[Nie]]></de>
<en><![CDATA[Never]]></en>
</locale>
</groups>
<groups name="quiqqer/cron" datatype="js">
<locale name="cron.id">
......
......@@ -8,7 +8,8 @@ use QUI\System\Log;
class CronService
{
const CRONSERVICE_URL = "https://cron.quiqqer.com";
const CRONSERVICE_URL = "http://server.local"; // TODO DEBUG REMOVE
//const CRONSERVICE_URL = "https://cron.quiqqer.com";
private $domain;
private $https;
......@@ -56,7 +57,9 @@ class CronService
* 'status' => 0, (0=unregistered; 1=active; 2=inactive)
* 'current_failures' => int,
* 'total_failures' => int,
* 'last_execution' => string (mysql dateformat)
* 'last_execution' => string (mysql dateformat | Localized 'never')
* )
*
* @return mixed
*/
public function getStatus()
......@@ -65,6 +68,13 @@ class CronService
'domain' => $this->domain
));
if (empty($status['last_execution'])) {
$status['last_execution'] = QUI::getLocale()->get(
'quiqqer/cron',
'cron.window.cronservice.status.text.last_execution.never'
);
}
return $status;
}
......@@ -171,8 +181,6 @@ class CronService
$url .= '&' . $param . '=' . urlencode($value);
}
Log::addDebug("Ajax Request : " . $url);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
......@@ -182,8 +190,6 @@ class CronService
$response = curl_exec($curl);
Log::addDebug($response);
curl_close($curl);
// Process raw ajax response
......@@ -195,8 +201,6 @@ class CronService
throw new QUI\Exception($response[$function]['Exception']['message']);
}
Log::writeRecursive($response);
return $response[$function]['result'];
}
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren