Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
BaseJob.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
41  abstract class BaseJob
42  {
46  const JOB_QUEUE_PAGE_SIZE = 100;
47 
53  protected static $loadJobQueueOnCleanupAndFallback = false;
54 
59  protected $errorMessage;
60 
64  private $messageLogger;
65 
69  abstract public function run();
70 
71  public static function shouldLoadJobQueueOnCleanupAndFallback()
72  {
73  return static::$loadJobQueueOnCleanupAndFallback;
74  }
75 
79  public static function getDisplayName()
80  {
81  throw new NotImplementedException();
82  }
83 
87  public static function getType()
88  {
89  throw new NotImplementedException();
90  }
91 
96  public static function resolveJobsForQueue()
97  {
98  static::loadJobQueue();
99  }
100 
101  public static function loadJobQueue()
102  {
103  Yii::app()->jobQueue->add(static::getType(), 5);
104  }
105 
109  public static function getRecommendedRunFrequencyContent()
110  {
111  throw new NotImplementedException();
112  }
113 
117  public static function getDefaultMessageLogger()
118  {
119  return 'MessageLogger';
120  }
121 
125  public function getErrorMessage()
126  {
127  return $this->errorMessage;
128  }
129 
135  public static function getRunTimeThresholdInSeconds()
136  {
137  return 900;
138  }
139 
140  public function setMessageLogger(MessageLogger $messageLogger)
141  {
142  $this->messageLogger = $messageLogger;
143  }
144 
145  public function getMessageLogger()
146  {
147  if ($this->messageLogger == null)
148  {
149  $this->messageLogger = new MessageLogger();
150  }
151  return $this->messageLogger;
152  }
153 
157  public static function showInJobManagerToRunManually()
158  {
159  return true;
160  }
161 
168  public static function jobExecutionInQueueDependsOnTime()
169  {
170  return false;
171  }
172  }
173 ?>
static showInJobManagerToRunManually()
Definition: BaseJob.php:157
static resolveJobsForQueue()
Definition: BaseJob.php:96
getErrorMessage()
Definition: BaseJob.php:125
static getDisplayName()
Definition: BaseJob.php:79
static getRecommendedRunFrequencyContent()
Definition: BaseJob.php:109
static getType()
Definition: BaseJob.php:87
static jobExecutionInQueueDependsOnTime()
Definition: BaseJob.php:168
const JOB_QUEUE_PAGE_SIZE
Definition: BaseJob.php:46
static getRunTimeThresholdInSeconds()
Definition: BaseJob.php:135
static getDefaultMessageLogger()
Definition: BaseJob.php:117
Generated on Wed Oct 21 2020 07:10:31
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.