Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
cron_job_expired_matrix_locks.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/system/cron/cron_job/cron_job.inc';
19 
29 {
30 
31 
38  function __construct($assetid=0)
39  {
40  parent::__construct($assetid);
41 
42  }//end constructor
43 
44 
56  public function create(Array &$link)
57  {
58  require_once SQ_CORE_PACKAGE_PATH.'/system/system_asset_fns.inc';
59  if (!system_asset_fns_create_pre_check($this)) {
60  return FALSE;
61  }
62  $GLOBALS['SQ_SYSTEM']->changeDatabaseConnection('db2');
63  $GLOBALS['SQ_SYSTEM']->doTransaction('BEGIN');
64 
65  if ($linkid = parent::create($link)) {
66  if (!system_asset_fns_create_cleanup($this)) {
67  $linkid = FALSE;
68  }
69  }
70 
71  if ($linkid) {
72  $GLOBALS['SQ_SYSTEM']->doTransaction('COMMIT');
73  } else {
74  $GLOBALS['SQ_SYSTEM']->doTransaction('ROLLBACK');
75  }
76 
77  $GLOBALS['SQ_SYSTEM']->restoreDatabaseConnection();
78  return $linkid;
79 
80  }//end create()
81 
82 
92  protected function _getName($short_name=FALSE)
93  {
94  return translate('cron_job_expired_matrix_locks');
95 
96  }//end _getName()
97 
98 
105  public function canClone()
106  {
107  return FALSE;
108 
109  }//end canClone()
110 
111 
120  public function canDelete()
121  {
122  return FALSE;
123 
124  }//end canDelete()
125 
126 
138  protected function _exec(&$msg)
139  {
140  $class_name = 'locking_method_'.SQ_CONF_LOCKING_METHOD;
141  $GLOBALS['SQ_SYSTEM']->am->includeAsset($class_name);
142 
143  $canDelete = call_user_func(array($class_name, 'supportsDeletingExpiredLocks'));
144 
145  if ($canDelete) {
146  $canDelete = call_user_func(array($class_name, 'deleteExpiredLocks'));
147  }
148 
149  return SQ_CRON_JOB_COMPLETED;
150 
151  }//end _exec()
152 
153 
163  public function run()
164  {
165  $res = parent::run();
166  if ($res & SQ_CRON_JOB_REMOVE) {
167  $res = $res - SQ_CRON_JOB_REMOVE;
168  }
169  return $res;
170 
171  }//end run()
172 
173 
174 }//end class
175 
176 
177 
178 ?>