20 include_once (
"Class.QueryDb.php");
21 include_once (
"Class.DbObj.php");
22 include_once (
"VAULT/Class.VaultDiskDir.php");
44 create table vaultdiskfs%s ( id_fs int not null,
51 max_entries_by_dir int,
54 create sequence seq_id_vaultdiskfs%s start 10;";
59 $this->dbtable = sprintf($this->dbtable_tmpl, $this->specific);
60 $this->sqlcreate = sprintf($this->sqlcreate_tmpl, $this->specific, $this->specific);
61 $this->seq = sprintf($this->seq_tmpl, $this->specific);
67 if (!is_dir(
$path))
$err = sprintf(_(
"%s directory not found") ,
$path);
68 elseif (!is_writable(
$path))
$err = sprintf(_(
"%s directory not writable") ,
$path);
71 $this->max_size = $maxsize;
72 $this->free_size = $maxsize;
74 $this->subdir_deep = 1;
76 $this->r_path =
$path;
85 if ($this->
Exists($this->r_path))
return (_(
"File System already exists"));
88 $this->id_fs = $arr[
"nextval"];
96 $query->basic_elem->sup_where = array(
97 "r_path='" .
$path .
"'"
106 $id_fs = $id_dir = - 1;
110 $qs[0] =
"free_size>" . $f_size;
112 $qs[1] =
"fsname='" . pg_escape_string(
$fsname) .
"'";
114 $query->basic_elem->sup_where = $qs;
120 while (!$dirfound && ($ifs < $query->nb)) {
121 $sd =
new VaultDiskDir($this->dbaccess,
'', $this->specific);
122 $msg = $sd->SetFreeDir(
$t[$ifs]);
123 if ($msg ==
'') $dirfound = TRUE;
128 $id_fs = $this->id_fs;
129 $id_dir = $sd->id_dir;
130 $f_path = $this->r_path .
"/" . $sd->l_path;
136 return (_(
"no empty vault file system found"));
141 function Show($id_fs, $id_dir, &$f_path)
145 $query->basic_elem->sup_where = array(
146 sprintf(
"id_fs=%d", $id_fs)
150 $sd =
new VaultDiskDir($this->dbaccess, $id_dir, $this->specific);
151 if ($sd->IsAffected()) {
152 $f_path =
$t[0][
"r_path"] .
"/" . $sd->l_path;
154 return (_(
"no vault directory found"));
157 return (_(
"no vault file system found"));
165 $this->free_size = $this->free_size - $fs;
173 if ($this->IsAffected()) {
174 $this->free_size = $this->free_size + $fs;
176 $sd =
new VaultDiskDir($this->dbaccess, $id_dir, $this->specific);
177 if ($sd->IsAffected()) {
180 return (_(
"no vault directory found"));
183 return (_(
"no vault file system found"));
193 while (
$query->nb > 0 && (list($k, $v) = each(
$t))) {
194 $s[
"fs$k"][
"root_dir"] = $v[
"r_path"];
195 $s[
"fs$k"][
"allowed_size"] = $v[
"max_size"];
196 $s[
"fs$k"][
"free_size"] = $v[
"free_size"];
197 $sd =
new VaultDiskDir($this->dbacces,
'', $this->specific);
198 $s[
"fs$k"][
"free_entries"] = $sd->FreeEntries($v[
"id_fs"]);