This commit is contained in:
Roly Rudy Gutierrez Pinto
2016-05-03 17:35:04 -04:00
parent 02dfd90a9e
commit 9779126ea3

View File

@@ -610,12 +610,8 @@ class workspaceTools
*/
public function upgradeCasesDirectoryStructure($workspace)
{
define('PATH_DOCUMENT', PATH_DATA . 'sites/' . $workspace . '/' . 'files/');
$doclevel = explode('/', PATH_DOCUMENT);
$length = sizeof(PATH_DOCUMENT);
$filesDir = $doclevel[$length - 1];
if (is_dir(PATH_DOCUMENT) && is_writable($filesDir)) {
define('PATH_DOCUMENT', PATH_DATA . 'sites' . DIRECTORY_SEPARATOR . $workspace . DIRECTORY_SEPARATOR . 'files');
if (!is_writable(PATH_DOCUMENT)) {
CLI::logging(CLI::error("Error:" . PATH_DOCUMENT . " is not writable... please check the su permissions.\n"));
return;
}
@@ -632,7 +628,7 @@ class workspaceTools
//Start migration
for ($index = 0; $index < $dirslength; $index++) {
$depthdirlevel = explode('/', $directory[$index]);
$depthdirlevel = explode(DIRECTORY_SEPARATOR, $directory[$index]);
$lastlength = sizeof($depthdirlevel);
$UIdDir = $depthdirlevel[$lastlength - 1];
$lenDir = strlen($UIdDir);
@@ -661,14 +657,14 @@ class workspaceTools
}
//Start '0' directory migration
$black = PATH_DOCUMENT . $blackHoleDir . '/';
$black = PATH_DOCUMENT . $blackHoleDir . DIRECTORY_SEPARATOR;
if (is_dir($black)) {
$newpattern = array();
$file = glob($black . '*.*'); //files only
$dirlen = count($file);
for ($index = 0; $index < $dirlen; $index++) {
$levelfile = explode('/', $file[$index]);
$levelfile = explode(DIRECTORY_SEPARATOR, $file[$index]);
$lastlevel = sizeof($levelfile);
$goalFile = $levelfile[$lastlevel - 1];
$newpattern = G::getPathFromFileUIDPlain($blackHoleDir, $goalFile);
@@ -676,7 +672,7 @@ class workspaceTools
G::mk_dir($blackHoleDir . PATH_SEP . $newpattern[0], 0777);
//echo `cp -R $black$goalFile $black$newpattern[0]/$newpattern[1]`;
if (copy($black . $goalFile, $black . $newpattern[0] . '/' . $newpattern[1])) {
if (copy($black . $goalFile, $black . $newpattern[0] . DIRECTORY_SEPARATOR . $newpattern[1])) {
unlink($file[$index]);
} else {
CLI::logging(CLI::error("Error: Failure at copy $file[$index] files...\n"));