|
From: Joe z. <jz...@at...> - 2002-07-15 07:26:16
|
I've been looking hard at your suggestions and code this weekend. I'm
very impressed with your ini parsing to create html pages in
class_config, and class_tree.php.
I see what you want to do by converting the ini file to php, but I don't
understand the "depends" part of it:
$server_defs["nfs_share"]["depends"]["value"]["0"] = "nfs";
$server_defs["nfs_share"]["depends"]["value"]["1"] = "nfs";
$server_defs["nfs_share"]["depends"]["rule"]["0"] = "0:TRUE";
$server_defs["nfs_share"]["depends"]["rule"]["1"] = "1:TRUE";
I'm thinking we could still use an ini file. If I pass a second
parameter of TRUE to the parse_ini_file() function, I could use an ini
file like this to put the variables into a two-dimensional array:
---- begin example ---
[active]
type = choice
description = "Should I create backups from this server"
[login]
type = text
description = "Users login name"
[password]
type = encrypted
description = "Users password"
[server]
type = text
description = "The servers network name"
[server_ip]
type = ip
description = "The servers ip address"
[share]
type = text
description = "The descriptive name of the share"
[nfs_share]
type = path
description = "The path the nfs share is mounted under"
depends = "$backup_method == nfs || $restore_method == nfs"
[smb_share]
type = text
description = "The name of the smb share"
depends = "$backup_method == smb || $restore_method == smb"
[rsync_share]
type = text
description = "The name of the rsync share"
depends = "$backup_method == rsync"
[backup_method]
type = list <-- (note: this will be a new data type for a drop-down
list)
description = "What should I use for making backups"
list = "nfs,rsync,smb"
[restore_method]
type = list
description = "What should I use for restoring files"
list = "nfs,smb"
[compress]
type = choice
description = "Compress incremental files?"
[incrementals]
type = number
description = "How many incrementals to keep ( 0 = infinite )"
[run_days]
type = number
description = "Which days to backup. ( 0 = monday, 1 = tuesday ..
etc)" = "The servers network name"
---- end example ---
But I don't know if I can turn this line
depends = "$backup_method == nfs || $restore_method == nfs"
into an executable statement that will return TRUE or FALSE.
Do you think it can work? Think it's a good idea?
I'll work on rewriting admin.php and class_config.php. It will be a
worthy challenge with my limited php experience, and it's only the two
files affected, so I'm pretty safe.
|