Documentation is available at rebuild_sd_stats.php
- #!/usr/local/php/bin/php
- <?php
- /**
- * Rebuild Stats Pages
- *
- * This is a command-line script for generating the cached stats pages.
- * It expectes one commandline arguments
- * - a CompUnix name
- *
- * This file is normally run every minute by cron. It checks for
- * recent registrations and ensures that another instance of it
- * isn't already running.
- *
- * This file is part of CompInaBox.
- * @package CommandLine-Scripts
- * @author Eric D. Nielsen <nielsene@alum.mit.edu>
- * @copyright CompInaBox Copyright 2005, Eric D. Nielsen. All Rights Reserved.
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @todo Compare with current version running on production
- */
- /**
- * Inlucde the basic path information
- */
- ini_alter("include_path",".");
- include("../include/paths.inc");
- if ($argv[1]=="") die("No Comp Name provided\n");
- $unixname = $argv[1];
- ini_alter("include_path","$CIB_CLASS_PATH:$CIB_PREFIX/include:$CIB_PREFIX/www/register/$unixname/PrepStep_Generated_Files");
- $CIB_TOOL_ROLE="register";
- $updateTimeFileName = "$CIB_VAR_PATH/$unixname.updated";
- $updateLockFileName = "$CIB_VAR_PATH/$unixname.lock";
- $testFileName = "$CIB_WEB_PATH/stats/$unixname/affils.html";
- if (!file_exists($updateLockFileName))
- {
- touch($updateLockFileName);
- }
- if (filemtime($updateTimeFileName) > filemtime($testFileName))
- {
- include "$CIB_CONFIG_PATH/comps/{$unixname}_config.inc";
- ini_alter("include_path", "$CIB_CLASS_PATH:$CIB_PREFIX/include:$CIB_WEB_PATH/$CIB_TOOL_ROLE/$unixname/PREPARSED");
- include "$CIB_INCLUDE_PATH/tools/SlidingDoors_header.inc";
- echo "rebuilding stats";
- $fp = fopen($updateLockFileName,"r");
- $lock = flock($fp,LOCK_EX+LOCK_NB);
- if ($lock)
- {
- $db = new StatsDB($db->getDBName(),$db->getDBUser(), $db->getDBpass());
- $display = new StatsDisplay($db);
- $affilLut = $db->buildAffilLut();
- $affilList = $db->buildAffilList();
- $eventLut = $db->buildEventLut();
- $eventList = $db->buildEventList();
- $peopleList = $db->buildPeopleLut($affilLut);
- $details = $db->getStatsSummary();
- $display->generateStats($peopleList,$affilLut,$eventLut,
- $affilList, $eventList, $details);
- }
- flock($fp,LOCK_UN);
- fclose($fp);
- passthru("$CIB_PREFIX/bin/latex_invoices.php $unixname");
- }
- ?>
Documentation generated on Tue, 25 Apr 2006 13:08:47 -0400 by phpDocumentor 1.3.0RC3