function createHeyuSubdir($dirNum) { global $config; if ($dirNum == "default") { return false; } if (!file_exists($config['heyu_base_real'] . $dirNum)) { mkdir($config['heyu_base_real'] . "/" . $dirNum); if (file_exists($config['heyu_base_real'] . $config['heyuconf'])) { copy($config['heyu_base_real'] . $config['heyuconf'], $config['heyu_base_real'] . $dirNum . "/" . $config['heyuconf']); } else { touch($config['heyu_base_real'] . $dirNum . "/" . $config['heyuconf']); } ## Instantiate heyuConf class and get schedule file with absolute path $heyuconf = new heyuConf($config['heyuconfloc']); $schedfileloc = $config['heyu_base_real'] . $heyuconf->getSchedFileValue(); if (file_exists($schedfileloc)) { copy($schedfileloc, $config['heyu_base_real'] . $dirNum . "/" . $heyuconf->getSchedFileValue()); } else { touch($config['heyu_base_real'] . $dirNum . "/" . $heyuconf->getSchedFileValue()); } return true; } else { return false; } }
<?php require_once "../../include.php"; require_once FUNC_FILE_LOCATION . "debug.func.php"; require_once CLASS_FILE_LOCATION . "heyuconf.class.php"; require_once CLASS_FILE_LOCATION . "user.class.php"; //$testLine = "section timers"; echo "-------------------- Test bed for heyu conf classes --------------------<br/>"; echo "<br/>"; echo "The heyu conf file [x10.conf]<br/>"; echo "<br/>"; echo "* Test Heyu Conf file<br/>"; try { $aHeyuConf = new heyuConf("/etc/heyu/x10.conf"); echo " The return of heyu conf get alias objects<br/>"; $aUser = new User(); $aUser->setSecurityLevel(0); pr($aHeyuConf->getAliases($aUser)); echo " The return of heyu conf file<br/>"; pr($aHeyuConf); } catch (Exception $e) { echo " E!: " . $e->getMessage() . "<br/>"; } echo "-------------------- End Test bed for heyu conf classes --------------------<br/>";
$fileCheck[5]["targetname"] = "/var/lock"; $fileCheck[5]["exists"] = file_exists("/var/lock"); $fileCheck[5]["writable"] = is_writable("/var/lock"); $i = 5; if (file_exists(ALIASMAP_FILE_LOCATION)) { $i++; $fileCheck[$i]["targetname"] = ALIASMAP_FILE_LOCATION; $fileCheck[$i]["exists"] = true; $fileCheck[$i]["writable"] = is_writable(ALIASMAP_FILE_LOCATION); } // Check tty and sched file priveleges if ($fileCheck[3]["exists"] && $fileCheck[3]["writable"]) { try { // This check is in place until heyu incorporates not starting on getting the conflist. // It does have the benefit of checking first if the tty device is accessible. $heyuConf = new heyuConf($config["heyuconfloc"]); try { $schedFile = $heyuConf->getSchedFile(); $i++; $fileCheck[$i]["targetname"] = $schedFile; $fileCheck[$i]["exists"] = file_exists($schedFile); $fileCheck[$i]["writable"] = is_writable($schedFile); } catch (Exception $e) { // noop } // Commented out device checks for now since access to /dev is prohibited // $ttyObjects = $heyuConf->getElementObjects("tty"); // foreach($ttyObjects as $ttyObject) { // if($ttyObject->isEnabled()) { // list($label, $device) = explode(" ", $ttyObject->getElementLine()); // if(strtolower($device) != "dummy") {