PHP Classes

File: web/SSO/modules/aggregator2/hooks/hook_cron.php

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/aggregator2/hooks/hook_cron.php   Download  
File: web/SSO/modules/aggregator2/hooks/hook_cron.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 763 bytes
 

Contents

Class file image Download
<?php

/**
 * cron hook to update aggregator2 metadata.
 *
 * @param array &$croninfo Output
 */
function aggregator2_hook_cron(&$croninfo) {
   
assert('is_array($croninfo)');
   
assert('array_key_exists("summary", $croninfo)');
   
assert('array_key_exists("tag", $croninfo)');

   
$cronTag = $croninfo['tag'];

   
$config = SimpleSAML_Configuration::getConfig('module_aggregator2.php');
   
$config = $config->toArray();

    foreach (
$config as $id => $c) {
        if (!isset(
$c['cron.tag'])) {
            continue;
        }
        if (
$c['cron.tag'] !== $cronTag) {
            continue;
        }

        try {
           
$a = sspmod_aggregator2_Aggregator::getAggregator($id);
           
$a->updateCache();
        } catch (
Exception $e) {
           
$croninfo['summary'][] = 'Error during aggregator2 cacheupdate: ' . $e->getMessage();
        }
    }
}