Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
cron_job_sync_cmis_bridges.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/system/cron/cron_job/cron_job.inc';
19 
33 {
34 
35 
42  function __construct($assetid=0)
43  {
44  $this->_ser_attrs = TRUE;
45  parent::__construct($assetid);
46 
47  }//end constructor
48 
49 
61  public function create(Array &$link)
62  {
63  require_once SQ_CORE_PACKAGE_PATH.'/system/system_asset_fns.inc';
64  if (!system_asset_fns_create_pre_check($this)) {
65  return FALSE;
66  }
67  $GLOBALS['SQ_SYSTEM']->changeDatabaseConnection('db2');
68  $GLOBALS['SQ_SYSTEM']->doTransaction('BEGIN');
69 
70  if ($linkid = parent::create($link)) {
71  if (!system_asset_fns_create_cleanup($this)) {
72  $linkid = FALSE;
73  }
74  }
75 
76  if ($linkid) {
77  $GLOBALS['SQ_SYSTEM']->doTransaction('COMMIT');
78  } else {
79  $GLOBALS['SQ_SYSTEM']->doTransaction('ROLLBACK');
80  }
81 
82  $GLOBALS['SQ_SYSTEM']->restoreDatabaseConnection();
83  return $linkid;
84 
85  }//end create()
86 
87 
97  function _getName($short_name=FALSE)
98  {
99  return $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name');
100 
101  }//end _getName()
102 
103 
110  function canClone()
111  {
112  return FALSE;
113 
114  }//end canClone()
115 
116 
128  function morph($new_type_code)
129  {
130  trigger_localised_error('CRON0024', E_USER_WARNING, $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name'));
131  return FALSE;
132 
133  }//end morph()
134 
135 
144  function canDelete()
145  {
146  return FALSE;
147 
148  }//end canDelete()
149 
150 
162  protected function _exec(&$msg)
163  {
164  $bridge_ids = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetids('cmis_bridge', TRUE, TRUE);
165  foreach ($bridge_ids as $bridge_id => $type) {
166  if ($GLOBALS['SQ_SYSTEM']->am->assetInTrash($bridge_id, TRUE)) continue;
167 
168  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
169  $running_vars = Array (
170  'bridge_id' => $bridge_id
171  );
172  $errors = $hh->freestyleHipo('hipo_job_sync_cmis_bridge', $running_vars, SQ_PACKAGES_PATH.'/sharepoint/hipo_jobs/');
173  if (!empty($errors)) trigger_error("CMIS Bridge (Id #:$bridge_id) HIPO errors:\n".print_r($errors, TRUE), E_USER_WARNING);
174  }
175 
176  return SQ_CRON_JOB_COMPLETED;
177 
178  }//end _exec()
179 
180 
191  public function run()
192  {
193  $res = parent::run();
194  if ($res & SQ_CRON_JOB_REMOVE) {
195  $res = $res - SQ_CRON_JOB_REMOVE;
196  }
197  return $res;
198 
199  }//end run()
200 
201 
202 }//end class
203 
204 ?>