ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
An exception for terminatinating execution or to throw for unit testing.
static info($string)
Definition: Logger.php:199
static warning($string)
Definition: Logger.php:177
if(! $oauthconfig->getBoolean('getUserInfo.enable', FALSE)) $store
Definition: getUserInfo.php:11
$croninfo
Definition: cron.php:23
catch(Exception $e) $message
riak_hook_cron(&$croninfo)
Hook to run a cron job.
Definition: hook_cron.php:31