Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Lib.FileDir.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Set of usefull system file functions
8  *
9  * @author Anakeen
10  * @version $Id: Lib.FileDir.php,v 1.3 2004/07/29 09:28:34 yannick Exp $
11  * @package FDL
12  * @subpackage CORE
13  */
14 /**
15  */
16 function create_dir($dir, $access, $owner = "", $group = "")
17 {
18  clearstatcache();
19  if (!file_exists($dir)) {
20  if (!file_exists(dirname($dir))) create_dir(dirname($dir) , "$access", $owner, $group);
21  $cmd = "mkdir(\"" . $dir . "\"," . $access . ");";
22  eval($cmd);
23  if ($owner != "") chown($dir, $owner);
24  if ($group != "") chgrp($dir, $group);
25  }
26 }
27 
28 function create_file($file, $access, $owner = "", $group = "")
29 {
30  clearstatcache();
31  if (!file_exists($file)) {
32  if (!file_exists(dirname($file))) create_dir(dirname($file) , "$access", $owner, $group);
33  touch($file);
34  if ($owner != "") chown($file, $owner);
35  if ($group != "") chgrp($file, $group);
36  }
37 }
38 
39 function install_file($from, $to, $access, $owner = "", $group = "")
40 {
41  clearstatcache();
42  if (file_exists($from)) {
43  create_dir(dirname($to) , "$access", $owner, $group);
44  copy($from, $to);
45  $cmd = "chmod(\"" . $to . "\"," . $access . ");";
46  eval($cmd);
47  chmod($to, $access);
48  if ($owner != "") chown($dir, $owner);
49  if ($group != "") chgrp($dir, $group);
50  }
51 }
52 
53 function remove_dir($dir)
54 {
55  $cmd = sprintf("rm -rf %s", escapeshellarg($dir));
56  system($cmd);
57 }
58 ?>
remove_dir($dir)
Definition: Lib.FileDir.php:53
create_file($file, $access, $owner="", $group="")
Definition: Lib.FileDir.php:28
$file
$to
foreach($argv as $arg) $cmd
install_file($from, $to, $access, $owner="", $group="")
Definition: Lib.FileDir.php:39
create_dir($dir, $access, $owner="", $group="")
Definition: Lib.FileDir.php:16
$dir
Definition: resizeimg.php:144
$from
← centre documentaire © anakeen