ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
hook_cron.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * Copyright (c) 2012 The University of Queensland
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /*
20  * Written by David Gwynne <dlg@uq.edu.au> as part of the IT
21  * Infrastructure Group in the Faculty of Engineering, Architecture
22  * and Information Technology.
23  */
24 
25 
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
riak_hook_cron(&$croninfo)
Hook to run a cron job.
Definition: hook_cron.php:31
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.