+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* by every scheduled job (cron task) in CiviCRM.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Core_JobManager {
/**
* @var array ($id => CRM_Core_ScheduledJob)
*/
- var $jobs = NULL;
+ public $jobs = NULL;
/**
* @var CRM_Core_ScheduledJob
*/
- var $currentJob = NULL;
+ public $currentJob = NULL;
- var $singleRunParams = array();
-
- var $_source = NULL;
+ public $singleRunParams = [];
+ public $_source = NULL;
/**
* Class constructor.
$this->logEntry('Finishing scheduled jobs execution.');
// Set last cron date for the status check
- $statusPref = array(
+ $statusPref = [
'name' => 'checkLastCron',
'check_info' => gmdate('U'),
- );
+ ];
CRM_Core_BAO_StatusPreference::create($statusPref);
}
//Disable outBound option after executing the job.
$environment = CRM_Core_Config::environment(NULL, TRUE);
if ($environment != 'Production' && !empty($job->apiParams['runInNonProductionEnvironment'])) {
- Civi::settings()->set('mailing_backend', array('outBound_option' => CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED));
+ Civi::settings()->set('mailing_backend', ['outBound_option' => CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED]);
}
}
* ($id => CRM_Core_ScheduledJob)
*/
private function _getJobs() {
- $jobs = array();
+ $jobs = [];
$dao = new CRM_Core_DAO_Job();
$dao->orderBy('name');
$dao->domain_id = CRM_Core_Config::domainID();
$dao->find();
while ($dao->fetch()) {
- $temp = array();
+ $temp = [];
CRM_Core_DAO::storeValues($dao, $temp);
$jobs[$dao->id] = new CRM_Core_ScheduledJob($temp);
}
$dao = new CRM_Core_DAO_JobLog();
$dao->domain_id = $domainID;
- $dao->description = substr($message, 0, 235);
- if (strlen($message) > 235) {
- $dao->description .= " (...)";
+
+ /*
+ * The description is a summary of the message.
+ * HTML tags are stripped from the message.
+ * The description is limited to 240 characters
+ * and has an ellipsis added if it is truncated.
+ */
+ $maxDescription = 240;
+ $ellipsis = " (...)";
+ $description = strip_tags($message);
+ if (strlen($description) > $maxDescription) {
+ $description = substr($description, 0, $maxDescription - strlen($ellipsis)) . $ellipsis;
}
+ $dao->description = $description;
+
if ($this->currentJob) {
$dao->job_id = $this->currentJob->id;
$dao->name = $this->currentJob->name;