diff --git a/Controller/Adminhtml/Cron/LongJobChecker.php b/Controller/Adminhtml/Cron/LongJobChecker.php index 280d391..c8f9116 100644 --- a/Controller/Adminhtml/Cron/LongJobChecker.php +++ b/Controller/Adminhtml/Cron/LongJobChecker.php @@ -79,7 +79,7 @@ public function execute() foreach ($jobs as $job) { $pid = $job->getPid(); - $finished_at = strftime('%Y-%m-%d %H:%M:%S', $this->dateTime->gmtTimestamp()); + $finished_at = date('Y-m-d H:i:s', $this->dateTime->gmtTimestamp()); if (function_exists('posix_getsid') && posix_getsid($pid) === false) { $job->setData('status', \Magento\Cron\Model\Schedule::STATUS_ERROR); $job->setData('messages', __('Execution stopped due to some error.')); diff --git a/Controller/Adminhtml/Schedule/MassKill.php b/Controller/Adminhtml/Schedule/MassKill.php index f995ed9..bf9e0d0 100644 --- a/Controller/Adminhtml/Schedule/MassKill.php +++ b/Controller/Adminhtml/Schedule/MassKill.php @@ -119,7 +119,7 @@ public function execute() if (function_exists('posix_getsid') && posix_getsid($pid) === false) { $errorScheduleIds[] = $scheduleId; } else { - $finished_at = strftime('%Y-%m-%d %H:%M:%S', $this->dateTime->gmtTimestamp()); + $finished_at = date('Y-m-d H:i:s', $this->dateTime->gmtTimestamp()); $dbrunningjobs->setData('status', self::STATUS_KILLED); $dbrunningjobs->setData('messages', __('It is killed by admin.')); $dbrunningjobs->setData('finished_at', $finished_at); diff --git a/Helper/Schedule.php b/Helper/Schedule.php index e97c7ea..f6cda37 100644 --- a/Helper/Schedule.php +++ b/Helper/Schedule.php @@ -125,7 +125,7 @@ public function filterTimeInput($time) $matches = []; preg_match('/(\d+-\d+-\d+)T(\d+:\d+)/', $time, $matches); $time = $matches[1] . " " . $matches[2]; - return strftime('%Y-%m-%d %H:%M:00', strtotime($time)); + return date('Y-m-d H:i:s:00', strtotime($time)); } /** diff --git a/Observer/ProcessCronQueueObserver.php b/Observer/ProcessCronQueueObserver.php index 68ae9fc..cb73a33 100644 --- a/Observer/ProcessCronQueueObserver.php +++ b/Observer/ProcessCronQueueObserver.php @@ -144,7 +144,7 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, ); } - $schedule->setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', $this->dateTime->gmtTimestamp()))->save(); + $schedule->setExecutedAt(date('Y-m-d H:i:s', $this->dateTime->gmtTimestamp()))->save(); $this->startProfiling(); try { @@ -176,8 +176,8 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, $schedule->setStatus( Schedule::STATUS_SUCCESS )->setFinishedAt( - strftime( - '%Y-%m-%d %H:%M:%S', + date( + 'Y-m-d H:i:s', $this->dateTime->gmtTimestamp() ) ); diff --git a/Ui/DataProvider/JobProvider.php b/Ui/DataProvider/JobProvider.php index 3c6d6e6..90280d9 100644 --- a/Ui/DataProvider/JobProvider.php +++ b/Ui/DataProvider/JobProvider.php @@ -119,11 +119,7 @@ public function getData() $sortField = $this->sortField; $sortDir = $this->sortDir; usort($data, function ($a, $b) use ($sortField, $sortDir) { - if ($sortDir == "asc") { - return $a[$sortField] > $b[$sortField]; - } else { - return $a[$sortField] < $b[$sortField]; - } + return ($a[$sortField] <=> $b[$sortField]) * ($sortDir == 'desc' ? -1 : 1); }); #filters diff --git a/composer.json b/composer.json index e69c8f4..31417f5 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "kiwicommerce/module-cron-scheduler", "description": "Easily set up and manage cron jobs from the backend with a beautiful and managed timeline feature. Find the actual load on CPU/Memory by cron job execution.", "type": "magento2-module", - "version": "1.0.8", + "version": "1.0.9", "license": [ "OSL-3.0" ], diff --git a/etc/module.xml b/etc/module.xml index 60fbfc1..2425b8a 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -14,7 +14,7 @@ */ --> - +