PM-365 Upgrade de ls PM2.5 + enterprise 2.0.17 puede dar conflictos SOLVED

- The enterprise plugin files cause conflicts.
- A validation was added in function upgrade moving the files to the shared.
This commit is contained in:
Marco Antonio Nina
2014-09-26 13:00:16 -04:00
parent a56fade470
commit 2327b76190
4 changed files with 66 additions and 5 deletions

View File

@@ -62,6 +62,13 @@ class workspaceTools
*/
public function upgrade($first = false, $buildCacheView = false, $workSpace = SYS_SYS, $onedb = false, $lang = 'en')
{
$start = microtime(true);
CLI::logging("> Verify enterprise old...\n");
$this->verifyEnterprise($workSpace);
$stop = microtime(true);
$final = $stop - $start;
CLI::logging("<*> Verify took $final seconds.\n");
$start = microtime(true);
CLI::logging("> Updating database...\n");
$this->upgradeDatabase($onedb);
@@ -1630,5 +1637,59 @@ class workspaceTools
G::LoadClass("enterprise");
enterpriseClass::setHashPassword($response);
}
public function verifyEnterprise ($workspace)
{
$this->initPropel( true );
$pathBackup = PATH_DATA . 'backups';
if (!file_exists($pathBackup)) {
G::mk_dir($pathBackup, 0777);
}
$pathNewFile = PATH_DATA . 'backups' . PATH_SEP . 'enterpriseBackup';
$pathDirectoryEnterprise = PATH_CORE . 'plugins' . PATH_SEP . 'enterprise';
$pathFileEnterprise = PATH_CORE . 'plugins' . PATH_SEP . 'enterprise.php';
if (!file_exists($pathDirectoryEnterprise) && !file_exists(PATH_PLUGIN . 'enterprise.php')) {
CLI::logging(" Without changes... \n");
return true;
}
CLI::logging(" Migrating version Enterprise Core...\n");
if (!file_exists($pathNewFile)) {
CLI::logging(" Creating folder in $pathNewFile\n");
G::mk_dir($newDiretory, 0777);
}
$shared_stat = stat(PATH_DATA);
if (file_exists($pathDirectoryEnterprise)) {
CLI::logging(" Copying Directory Enterprise to $pathNewFile...\n");
if ($shared_stat !== false) {
workspaceTools::dirPerms($pathDirectoryEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
} else {
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
}
if (G::recursive_copy($pathDirectoryEnterprise, $pathNewFile . PATH_SEP. 'enterprise')) {
CLI::logging(" Removing $pathDirectoryEnterprise...\n");
G::rm_dir($pathDirectoryEnterprise);
} else {
CLI::logging(CLI::error(" Error: Failure at coping from $pathDirectoryEnterprise...\n"));
}
if (file_exists($pathDirectoryEnterprise)) {
CLI::logging(CLI::info(" Remove manually $pathDirectoryEnterprise...\n"));
}
}
if (file_exists($pathFileEnterprise)) {
CLI::logging(" Copying file Enterprise.php to $pathNewFile...\n");
if ($shared_stat !== false) {
workspaceTools::dirPerms($pathFileEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
} else {
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
}
CLI::logging(" Removing $pathFileEnterprise...\n");
copy($pathFileEnterprise , $pathNewFile. PATH_SEP . 'enterprise.php');
if (file_exists($pathFileEnterprise)) {
CLI::logging(CLI::info(" Remove manually $pathFileEnterprise...\n"));
}
}
}
}