WP_CLI
6 years ago
abstracts
4 years ago
actions
4 years ago
data-stores
4 years ago
migration
4 years ago
schedules
6 years ago
schema
4 years ago
ActionScheduler_ActionClaim.php
6 years ago
ActionScheduler_ActionFactory.php
6 years ago
ActionScheduler_AdminView.php
6 years ago
ActionScheduler_AsyncRequest_QueueRunner.php
6 years ago
ActionScheduler_Compatibility.php
6 years ago
ActionScheduler_DataController.php
6 years ago
ActionScheduler_DateTime.php
6 years ago
ActionScheduler_Exception.php
6 years ago
ActionScheduler_FatalErrorMonitor.php
6 years ago
ActionScheduler_InvalidActionException.php
6 years ago
ActionScheduler_ListTable.php
6 years ago
ActionScheduler_LogEntry.php
6 years ago
ActionScheduler_NullLogEntry.php
6 years ago
ActionScheduler_OptionLock.php
6 years ago
ActionScheduler_QueueCleaner.php
4 years ago
ActionScheduler_QueueRunner.php
6 years ago
ActionScheduler_Versions.php
6 years ago
ActionScheduler_WPCommentCleaner.php
6 years ago
ActionScheduler_wcSystemStatus.php
4 years ago
ActionScheduler_LogEntry.php
68 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class ActionScheduler_LogEntry |
| 5 | */ |
| 6 | class ActionScheduler_LogEntry { |
| 7 | |
| 8 | /** |
| 9 | * @var int $action_id |
| 10 | */ |
| 11 | protected $action_id = ''; |
| 12 | |
| 13 | /** |
| 14 | * @var string $message |
| 15 | */ |
| 16 | protected $message = ''; |
| 17 | |
| 18 | /** |
| 19 | * @var Datetime $date |
| 20 | */ |
| 21 | protected $date; |
| 22 | |
| 23 | /** |
| 24 | * Constructor |
| 25 | * |
| 26 | * @param mixed $action_id Action ID |
| 27 | * @param string $message Message |
| 28 | * @param Datetime $date Datetime object with the time when this log entry was created. If this parameter is |
| 29 | * not provided a new Datetime object (with current time) will be created. |
| 30 | */ |
| 31 | public function __construct( $action_id, $message, $date = null ) { |
| 32 | |
| 33 | /* |
| 34 | * ActionScheduler_wpCommentLogger::get_entry() previously passed a 3rd param of $comment->comment_type |
| 35 | * to ActionScheduler_LogEntry::__construct(), goodness knows why, and the Follow-up Emails plugin |
| 36 | * hard-codes loading its own version of ActionScheduler_wpCommentLogger with that out-dated method, |
| 37 | * goodness knows why, so we need to guard against that here instead of using a DateTime type declaration |
| 38 | * for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE. |
| 39 | */ |
| 40 | if ( null !== $date && ! is_a( $date, 'DateTime' ) ) { |
| 41 | _doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' ); |
| 42 | $date = null; |
| 43 | } |
| 44 | |
| 45 | $this->action_id = $action_id; |
| 46 | $this->message = $message; |
| 47 | $this->date = $date ? $date : new Datetime; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Returns the date when this log entry was created |
| 52 | * |
| 53 | * @return Datetime |
| 54 | */ |
| 55 | public function get_date() { |
| 56 | return $this->date; |
| 57 | } |
| 58 | |
| 59 | public function get_action_id() { |
| 60 | return $this->action_id; |
| 61 | } |
| 62 | |
| 63 | public function get_message() { |
| 64 | return $this->message; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 |