Update of /cvsroot/bobs/bobs/inc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2771/inc
Modified Files:
class_server.php
Log Message:
New interface for editing list of files to exclude from backups.
Index: class_server.php
===================================================================
RCS file: /cvsroot/bobs/bobs/inc/class_server.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- class_server.php 23 May 2004 21:25:38 -0000 1.10
+++ class_server.php 1 Jun 2004 06:18:38 -0000 1.11
@@ -294,7 +294,7 @@
// Note: set_config() should have been previously called.
// ---------------------------------------------------------
function get_incrementals(){
-
+
$days = intval($this->config['incrementals']);
$days_per_week = strlen($this->config['run_days']);
if (($days > 0) && ($days_per_week > 0)){
@@ -306,6 +306,67 @@
}
// ---------------------------------------------------------
+// get_excludes - Retrieve the exclude list
+// Parms: server, share
+// Returns: The entire exclude list file
+// Note: This function does NOT require a prior set_config() function call
+// ---------------------------------------------------------
+function get_excludes($server, $share){
+
+ $exlist = ""; // Initialize exclude list
+
+ $exfile = $this->get_excludes_filename($server, $share);
+ // Get file name of exclude list
+
+ if (file_exists($exfile)) // Read the exclude file
+ $exlist = file_get_contents($exfile);
+
+ return "$exlist"; // Return it's contents
+}
+
+// ---------------------------------------------------------
+// set_excludes - Write the exclude list to the file
+// Parms: server, share, text to write (formatted as a string)
+// Returns: TRUE on success, FALSE on error
+// Note: This function does NOT require a prior set_config() function call
+// ---------------------------------------------------------
+function set_excludes($server, $share, $text){
+
+ // Get file name of exclude list
+
+ $exfile = $this->get_excludes_filename($server, $share);
+
+ // Write the exclude list to the file
+
+ if(!$handle = fopen($exfile, "w")) return FALSE;
+ if(!fwrite($handle,"$text")) return FALSE;
+ fclose($handle);
+
+ return TRUE;
+}
+
+// ---------------------------------------------------------
+// get_excludes_filename - Retrieve the file name of the exclude list
+// Parms: server, share
+// Returns: The full path of the exclude file
+// Note: This function does NOT require a prior set_config() function call
+// ---------------------------------------------------------
+function get_excludes_filename($server, $share){
+
+ $siteroot = $this->get_siteroot(); // bobs www root directory
+
+ // Build full path to exclude file
+
+ $exfile = $siteroot . '/inc/excludes/'; // file name of exclude list
+ if ($server == ""){ // default exclude list
+ $exfile = $exfile . 'default.excludelist';
+ } else {
+ $exfile = $exfile . $server . '.' . $share;
+ }
+ return $exfile;
+}
+
+// ---------------------------------------------------------
} // Class end bracket
?>
|