mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 09:38:48 +02:00
N°2982 - fix delta xml variables not used in themes
This commit is contained in:
@@ -119,4 +119,75 @@ class ItopTestCase extends TestCase
|
||||
|
||||
return $method->invokeArgs($oObject, $aArgs);
|
||||
}
|
||||
|
||||
public function RecurseRmdir($dir) {
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != "." && $object != "..") {
|
||||
if (is_dir($dir.DIRECTORY_SEPARATOR.$object))
|
||||
$this->RecurseRmdir($dir.DIRECTORY_SEPARATOR.$object);
|
||||
else
|
||||
unlink($dir.DIRECTORY_SEPARATOR.$object);
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
public function CreateTmpdir() {
|
||||
$sTmpDir=tempnam(sys_get_temp_dir(),'');
|
||||
if (file_exists($sTmpDir))
|
||||
{
|
||||
unlink($sTmpDir);
|
||||
}
|
||||
mkdir($sTmpDir);
|
||||
if (is_dir($sTmpDir))
|
||||
{
|
||||
return $sTmpDir;
|
||||
}
|
||||
|
||||
return sys_get_temp_dir();
|
||||
}
|
||||
|
||||
public function RecurseMkdir($sDir){
|
||||
if (strpos($sDir, DIRECTORY_SEPARATOR) === 0){
|
||||
$sPath = DIRECTORY_SEPARATOR;
|
||||
} else {
|
||||
$sPath = "";
|
||||
}
|
||||
|
||||
foreach (explode(DIRECTORY_SEPARATOR, $sDir) as $sSubDir){
|
||||
if (($sSubDir === '..')) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (( trim($sSubDir) === '' ) || ( $sSubDir === '.' )) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sPath .= $sSubDir . DIRECTORY_SEPARATOR;
|
||||
if (!is_dir($sPath)) {
|
||||
var_dump($sPath);
|
||||
@mkdir($sPath);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function RecurseCopy($src,$dst) {
|
||||
$dir = opendir($src);
|
||||
@mkdir($dst);
|
||||
while(false !== ( $file = readdir($dir)) ) {
|
||||
if (( $file != '.' ) && ( $file != '..' )) {
|
||||
if ( is_dir($src . '/' . $file) ) {
|
||||
$this->RecurseCopy($src . DIRECTORY_SEPARATOR . $file,$dst . DIRECTORY_SEPARATOR . $file);
|
||||
}
|
||||
else {
|
||||
copy($src . DIRECTORY_SEPARATOR . $file,$dst . DIRECTORY_SEPARATOR . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user