/** * Deletes old versions that were never active */ public static function deleteOldVersions() { $config = Configuration::getAppConfig(); $dbObj = DBPool::getInstance(); $maxVersionCount = $config['max version count']; $minVersionCount = $config['min version count']; if ($maxVersionCount <= $dbObj->get_var("SELECT COUNT(1) FROM version WHERE active=false AND was_active=false")) { $oldVersionsArray = array(); $oldVersions = $dbObj->get_results("SELECT id FROM version\n WHERE active=false AND was_active=false\n ORDER by id\n LIMIT " . ($maxVersionCount - $minVersionCount)); foreach ($oldVersions as $o) { $oldVersionsArray[] = $o->id; } if (count($oldVersionsArray) > 0) { $query = "DELETE FROM version WHERE id IN (" . implode(",", $oldVersionsArray) . ")"; $dbObj->query($query); //Delete data from the disk foreach ($oldVersionsArray as $version) { $dataDirPath = Configuration::getBasePath() . "www/data/" . Util::XML_FILE . "/{$version}"; $imageDirPath = Configuration::getBasePath() . "www/data/" . Util::IMAGE_FILE . "/{$version}"; $changeDirPath = Configuration::getBasePath() . "www/data/" . Util::CHANGE_FILE . "/{$version}"; Util::deleteAll($dataDirPath); Util::deleteAll($imageDirPath); Util::deleteAll($changeDirPath); } $logger = Logger::getInstance(); $logStr = "Deleted versions " . implode(",", $oldVersionsArray); $logger->log($logStr, Logger::INFO, Version::PACKAGE); } } }
function __construct($agency, $xml) { $this->xml = $xml; $this->agency = $agency; $this->logger = Logger::getInstance(); $this->appConfig = Configuration::getAppConfig(); }
function __construct($agency, $xml) { $this->xml = $xml; $this->agency = $agency; $this->appConfig = Configuration::getAppConfig(); }
function __construct() { $this->appConfig = Configuration::getAppConfig(); }
function __construct(Agency $agency, SimpleXMLElement $xml) { $this->xml = $xml; $this->agency = $agency; $this->appConfig = Configuration::getAppConfig(); }
public static function authCheck() { $config = Configuration::getAppConfig(); if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] != $config['user'] || $_SERVER['PHP_AUTH_PW'] != $config['password']) { header("WWW-Authenticate: Basic realm=\"Transporter Admin Console Login\""); header("HTTP/1.0 401 Unauthorized"); echo '<html><body> <h1>Rejected!</h1> <big>Wrong Username or Password!</big><br/> <br/> <big>Refresh the page to continue...</big> </body></html>'; exit; } }
function __construct($dataPath) { $this->dataPath = $dataPath; $this->appConfig = Configuration::getAppConfig(); }
function __construct(Agency $agency) { $this->agency = $agency; $this->appConfig = Configuration::getAppConfig(); }