[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/tools/info/ -> lib.dir.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of Plume CMS, a website management application.
   4  # Copyright (C) 2001-2005 Loic d'Anterroches and contributors.
   5  #
   6  # Plume CMS is free software; you can redistribute it and/or modify
   7  # it under the terms of the GNU General Public License as published by
   8  # the Free Software Foundation; either version 2 of the License, or
   9  # (at your option) any later version.
  10  #
  11  # Plume CMS is distributed in the hope that it will be useful,
  12  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  # GNU General Public License for more details.
  15  #
  16  # You should have received a copy of the GNU General Public License
  17  # along with this program; if not, write to the Free Software
  18  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  19  #
  20  # ***** END LICENSE BLOCK *****
  21  
  22  /**
  23   * Get the total size of a directory
  24   */
  25  function dirSize($dir)
  26  {
  27      $totalsize = 0;
  28      if ($dirstream = @opendir($dir)) {
  29          while (false !== ($filename = readdir($dirstream))) {
  30              if ($filename != "." && $filename != "..") {
  31                  if (is_file($dir."/".$filename)) $totalsize += filesize($dir."/".$filename);
  32                  if (is_dir($dir."/".$filename)) $totalsize += dirSize($dir."/".$filename);
  33              }
  34          }
  35      }
  36      @closedir($dirstream);
  37      return $totalsize;
  38  }
  39  
  40  /**
  41   * Recursive delete of a folder
  42   * from a note on php.net
  43   * If you play stupid with it, you remove all the content of
  44   * your harddrive.
  45   */
  46  function recursiveDelete($dir)
  47  {
  48      if ($handle = @opendir($dir))  {
  49          while (($file = readdir($handle)) !== false) {
  50              if (($file == '.') || ($file == '..') 
  51                  || ($file == 'CVS') || ($file == 'empty.txt')
  52                  || ($file == '.svn')
  53                  ) {
  54                  continue;
  55              }
  56              if (is_dir($dir . '/' . $file)) {
  57                  // call self for this directory
  58                  recursiveDelete($dir . '/' . $file);
  59              } else {
  60                  @unlink($dir . '/' . $file); // remove this file
  61              }
  62          }
  63          @closedir($handle);
  64          @rmdir($dir);
  65      }
  66  }
  67  
  68  ?>


Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics