<?
/**/ /**
* CVS_Clean.php - Clean CVS folder from the target path.
*
* Copyright (c) 2002-2005 mikespook & swill
*
*/
require_once( ' File/Find.php ' );
class CVS_Clean
{
var $br;
var $slash;
var $path;
var $r;
function CVS_Clean()
{
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
{
$this->slash = "\\";
}
else
{
$this->slash = "/";
}
if (isset($_SERVER['argc']))
{
$this->br = "\n";
}
else
{
$this->br = "<br/>";
}
if (isset($_GET['path']))
{
$this->path = $_GET['path'];
}
elseif (isset($_SERVER['argv'][1]))
{
$this->path = $_SERVER['argv'][1];
}
if (isset($_GET['r']))
{
$r = $_GET['r'];
}
elseif (isset($_SERVER['argv'][2]))
{
$r = $_SERVER['argv'][2];
}
$this->r = strtolower($r) !== '-nr';
}
function help()
{
echo "I will show you this message that you didn`t input the paramater <dir> or the paramater <dir> is not a valid directory.".$this->br.$this->br;
echo "mikespook <mikespook@gmail.com>".$this->br;
echo "http://www.xxiyy.com".$this->br.$this->br;
echo "Useage: CVS_Clean <dir> [Options]".$this->br;
echo "Clean CVS folder from the directory".$this->br.$this->br;
echo "<dir>\tThe directory you want to clean without slash (".$this->slash.") at the end.".$this->br;
echo "-nr\tDon`t remove the CVS folder recursively.";
}
function run()
{
if (!is_dir($this->path))
{
$this->help();
}
else
{
$this->clean($this->path);
}
}
function clean($path)
{
$finder = File_Find::mapTreemultiple($path, 2);
foreach($finder as $name => $item)
{
if (is_array($item))
{
if ($this->r)
{
$this->clean($path.$this->slash.$name);
}
if ($name === 'CVS')
{
$this->rm($path.$this->slash.$name);
}
}
}
}
function rm($path)
{
$finder = File_Find::mapTreemultiple($path, 1);
foreach($finder as $item)
{
unlink($path.$this->slash.$item);
}
rmdir($path);
}
}
$main = new CVS_Clean();
$main -> run();
?>
/**/ /**
* CVS_Clean.php - Clean CVS folder from the target path.
*
* Copyright (c) 2002-2005 mikespook & swill
*
*/
require_once( ' File/Find.php ' );
class CVS_Clean
{
var $br;
var $slash;
var $path;
var $r;
function CVS_Clean()
{
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
{
$this->slash = "\\";
}
else
{
$this->slash = "/";
}
if (isset($_SERVER['argc']))
{
$this->br = "\n";
}
else
{
$this->br = "<br/>";
}
if (isset($_GET['path']))
{
$this->path = $_GET['path'];
}
elseif (isset($_SERVER['argv'][1]))
{
$this->path = $_SERVER['argv'][1];
}
if (isset($_GET['r']))
{
$r = $_GET['r'];
}
elseif (isset($_SERVER['argv'][2]))
{
$r = $_SERVER['argv'][2];
}
$this->r = strtolower($r) !== '-nr';
}
function help()
{
echo "I will show you this message that you didn`t input the paramater <dir> or the paramater <dir> is not a valid directory.".$this->br.$this->br;
echo "mikespook <mikespook@gmail.com>".$this->br;
echo "http://www.xxiyy.com".$this->br.$this->br;
echo "Useage: CVS_Clean <dir> [Options]".$this->br;
echo "Clean CVS folder from the directory".$this->br.$this->br;
echo "<dir>\tThe directory you want to clean without slash (".$this->slash.") at the end.".$this->br;
echo "-nr\tDon`t remove the CVS folder recursively.";
}
function run()
{
if (!is_dir($this->path))
{
$this->help();
}
else
{
$this->clean($this->path);
}
}
function clean($path)
{
$finder = File_Find::mapTreemultiple($path, 2);
foreach($finder as $name => $item)
{
if (is_array($item))
{
if ($this->r)
{
$this->clean($path.$this->slash.$name);
}
if ($name === 'CVS')
{
$this->rm($path.$this->slash.$name);
}
}
}
}
function rm($path)
{
$finder = File_Find::mapTreemultiple($path, 1);
foreach($finder as $item)
{
unlink($path.$this->slash.$item);
}
rmdir($path);
}
}
$main = new CVS_Clean();
$main -> run();
?>