Differential D11419 Diff 27435 src/infrastructure/daemon/workers/action/PhabricatorLogTriggerAction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/action/PhabricatorLogTriggerAction.php
- This file was added.
<?php | |||||
/** | |||||
* Trivial action which logs a message. | |||||
* | |||||
* This action is primarily useful for testing triggers. | |||||
*/ | |||||
final class PhabricatorLogTriggerAction | |||||
extends PhabricatorTriggerAction { | |||||
public function validateProperties(array $properties) { | |||||
PhutilTypeSpec::checkMap( | |||||
$properties, | |||||
array( | |||||
'message' => 'string', | |||||
)); | |||||
} | |||||
public function execute($last_epoch, $this_epoch) { | |||||
$message = pht( | |||||
'(%s -> %s @ %s) %s', | |||||
$last_epoch ? date('Y-m-d g:i:s A', $last_epoch) : 'null', | |||||
date('Y-m-d g:i:s A', $this_epoch), | |||||
date('Y-m-d g:i:s A', PhabricatorTime::getNow()), | |||||
$this->getProperty('message')); | |||||
phlog($message); | |||||
} | |||||
} |