BUG 9705 "upgrade ProcessMaker, creates temporary files" SOLVED

- Files created/uploaded to "PATH_DATA/upgrade" not are deleted, this
  in ProcessMaker (core) and Enterprise (plugin)
- Improved the creation/loaded of the files, once completed, are eliminated
* Available from version 2.0.44
This commit is contained in:
Victor Saisa Lopez
2012-09-07 13:56:34 -04:00
parent 5d30b356a9
commit 1f62ae3dd5
2 changed files with 114 additions and 150 deletions

View File

@@ -568,8 +568,8 @@ class System {
$oDirectory = dir($sDir);
while( $sObjectName = $oDirectory->read() ) {
if( ($sObjectName != '.') && ($sObjectName != '..') ) {
if( is_dir($sDir . PATH_SEP . $sObjectName) ) {
$this->rm_dir($sDir . PATH_SEP . $sObjectName);
if (is_dir($sDir . PATH_SEP . $sObjectName)) {
G::rm_dir($sDir . PATH_SEP . $sObjectName);
}
}
}
@@ -600,47 +600,9 @@ class System {
* param
* @return array
*/
function cleanupUpgradeDirectory()
public function cleanupUpgradeDirectory()
{
$this->rm_dir(PATH_DATA . 'upgrade' . PATH_SEP . 'processmaker');
}
/**
* This function removes a directory
*
*
* @name rm_dir
*
* @param string $dirName
* @return void
*/
function rm_dir($dirName)
{
if( empty($dirName) ) {
return;
}
if( file_exists($dirName) ) {
if( ! is_readable($dirName) ) {
throw (new Exception("directory '$dirName' is not readable"));
}
$dir = dir($dirName);
while( $file = $dir->read() ) {
if( $file != '.' && $file != '..' ) {
if( is_dir($dirName . PATH_SEP . $file) ) {
$this->rm_dir($dirName . PATH_SEP . $file);
} else {
//@unlink($dirName. PATH_SEP .$file) or die('File '.$dirName. PATH_SEP .$file.' couldn\'t be deleted!');
@unlink($dirName . PATH_SEP . $file);
}
}
}
$folder = opendir($dirName . PATH_SEP . $file);
closedir($folder);
@rmdir($dirName . PATH_SEP . $file);
} else {
//
}
G::rm_dir(PATH_DATA . "upgrade" . PATH_SEP . "processmaker");
}
/**

View File

@@ -936,6 +936,8 @@ class workspaceTools {
workspaceTools::printInfo((array)$workspaceData);
}
G::rm_dir($tempDirectory);
}
static public function dirPerms($filename, $owner, $group, $perms) {