| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
/**
|
| 4 |
* All the jobs that should be done in cron-time
|
| 5 |
*
|
| 6 |
* @author Aron Novak <aaron@szentimre.hu>
|
| 7 |
* @version 0.1
|
| 8 |
* @package sna
|
| 9 |
*/
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Get sql access and important functions
|
| 13 |
*/
|
| 14 |
require_once './includes/bootstrap.inc';
|
| 15 |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
|
| 16 |
require_once 'common.php';
|
| 17 |
|
| 18 |
$at_start = res_start();
|
| 19 |
if (!function_exists('dba_open') && SNA_CACHE_ENABLED) {
|
| 20 |
die('Dba support is not available.');
|
| 21 |
}
|
| 22 |
|
| 23 |
clear_cache();
|
| 24 |
$edges = array();
|
| 25 |
$graph_source = variable_get('sna_data_source', GRAPH_SOURCE);
|
| 26 |
$build_edges = 'build_edges_from_' . $graph_source;
|
| 27 |
$num_interactions = $build_edges($edges);
|
| 28 |
$edges = transform_edges($edges);
|
| 29 |
if (!put_graph($edges)) {
|
| 30 |
die('Cannot save the network into file');
|
| 31 |
}
|
| 32 |
/* Cache the most popular vertex's minimal tree */
|
| 33 |
$most_popular = sort_by_popularity($edges);
|
| 34 |
$most_popular_size = sizeof($most_popular);
|
| 35 |
$size_cache = variable_get('sna_size_cache', NUM_CACHE);
|
| 36 |
$limit = $most_popular_size < $size_cache ? $most_popular_size : $size_cache;
|
| 37 |
$at_start = res_start();
|
| 38 |
for ($i = 0; $i < $limit; $i++) {
|
| 39 |
a_to_any($edges, $most_popular[$i][1], TRUE);
|
| 40 |
}
|
| 41 |
generate_graphviz_input($edges, $num_interactions);
|
| 42 |
generate_pajek_input($edges);
|
| 43 |
|
| 44 |
?>
|