function delete() { if (!$this->isLocal()) { raiseError("Can delete only local stations"); } // delete files from the repository debug("deleting: ", $this->getDir()); sotf_Utils::erase($this->getDir()); // delete from sql db return parent::delete(); }
function delete() { global $db; if ($this->isLocal()) { // delete files from the repository debug("deleting: ", $this->getDir()); sotf_Utils::erase($this->getDir()); // delete from sql db // somehow foreign keys do not work in this case, so let's do it by hand: $db->query("DELETE FROM sotf_object_roles WHERE object_id='" . $this->id . "'"); } return parent::delete(); }
/** * Deletes a file or directory, even if directory is not empty. * * @param string $file File or directory to be deleted */ function erase($file) { if (is_dir($file)) { $handle = opendir($file); while ($filename = readdir($handle)) { if ($filename != "." && $filename != "..") { sotf_Utils::erase($file . "/" . $filename); } } closedir($handle); rmdir($file); } else { unlink($file); } }
/** * sotfShow::delete() * * purpose: to delete data from the tables * * @return (bool) */ function delete() { if (!$this->isLocal()) { error("Can delete only local stations"); return false; } // delete files from the repository sotf_Utils::erase($this->getDir()); // delete programmes of the station // TODO getallprogrammes: call delete // delete user permissions $this->db->query("DELETE FROM sotf_user_group WHERE station = '" . $this->id . "'"); // propagate deletion to other nodes $data = array('what' => 'station', 'del_time' => db_Wrap::getTimestampTZ(), 'node' => $GLOBALS['nodeId']); sotf_Base::saveDataWithId("sotf_deletions", 'id', $this->id, $data); // delete station description return parent::delete("sotf_stations", "station"); }
/** * Deletes a file or directory, even if directory is not empty. * * @param string $file File or directory to be deleted */ function erase($file) { if (is_dir($file)) { $handle = opendir($file); while ($filename = readdir($handle)) { if ($filename != "." && $filename != "..") { sotf_Utils::erase($file . "/" . $filename); } } closedir($handle); if (!rmdir($file)) { logger("Could not delete dir", $file); } } else { if (!unlink($file)) { logger("Could not delete file", $file); } } }
$phpDirFiles[] = realpath($file); } } closedir($dir); } if ($dir = opendir($config['classdir'])) { while (($file = readdir($dir)) !== false) { if (preg_match("/\\.class\\.php\$/", $file)) { $phpClassFiles[] = $config['classdir'] . "/{$file}"; } } closedir($dir); } $script = realpath("{$phpdocgendir}/phpdocgen.pl"); if (is_dir($docdir)) { sotf_Utils::erase($docdir); } ?> <html> <head> <title>Documentation generation</title> </head> <body> <p><b>Target dir</b>: <?php echo $docdir; ?> </p> <p><b>phpdocgen output</b>:</p> <pre> <?php passthru("{$perl} {$script} --output={$docdir} --defpack=StreamOnTheFly " . " " . implode(" ", $phpClassFiles) . " 2>&1");