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