Skip to content

Commit

Permalink
Merge pull request #12659 from kenwest/strip-html-tags-from-joblog-de…
Browse files Browse the repository at this point in the history
…scription

Fix Job Log entries containing links so they will display properly
  • Loading branch information
colemanw authored Nov 14, 2018
2 parents 2f7f74b + 1194518 commit e79f71c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions CRM/Core/JobManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,21 @@ public function logEntry($message) {
$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;
Expand Down

0 comments on commit e79f71c

Please sign in to comment.