ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
hook_cron.php File Reference

Go to the source code of this file.

Functions

 riak_hook_cron (&$croninfo)
 Hook to run a cron job. More...
 

Function Documentation

◆ riak_hook_cron()

riak_hook_cron ( $croninfo)

Hook to run a cron job.

Parameters
array&$croninfoOutput

Definition at line 31 of file hook_cron.php.

References $croninfo, $message, $result, $store, SimpleSAML\Logger\info(), time, and SimpleSAML\Logger\warning().

31  {
32  assert('is_array($croninfo)');
33  assert('array_key_exists("summary", $croninfo)');
34  assert('array_key_exists("tag", $croninfo)');
35 
36  if ($croninfo['tag'] !== 'hourly') return;
37 
38  try {
40  $result = $store->bucket->indexSearch('expires', 'int',
41  1, time() - 30);
42  foreach ($result as $link) {
43  $link->getBinary()->delete();
44  }
45 
46  SimpleSAML\Logger::info(sprintf("deleted %s riak key%s",
47  sizeof($result), sizeof($result) == 1 ? '' : 's'));
48  } catch (Exception $e) {
49  $message = 'riak threw exception: ' . $e->getMessage();
51  $croninfo['summary'][] = $message;
52  }
53 }
$result
$croninfo
Definition: cron.php:23
if(! $oauthconfig->getBoolean('getUserInfo.enable', FALSE)) $store
Definition: getUserInfo.php:11
static info($string)
Definition: Logger.php:201
catch(Exception $e) $message
static warning($string)
Definition: Logger.php:179
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function: