Permalink
Browse files

Add a step to the build to avoid git-based false deletions.

Fix upgrade steps.
  • Loading branch information...
1 parent ffeb71c commit bf18eddfd5dfdde4a4cfef3f42a274d491f8bf6b @cdujeu cdujeu committed Sep 16, 2016
Showing with 56 additions and 17 deletions.
  1. +33 −0 dist/phing/adhoctasks.xml
  2. +2 −0 dist/phing/build-pydio.xml
  3. +7 −6 dist/php/6.5.1-extractArchive-post.php
  4. +13 −9 dist/php/6.5.1.php
  5. +1 −2 dist/php/6.5.1.sql
@@ -99,6 +99,8 @@ class PydioParseGitSummarize extends Task
private $extPluginsFolder;
private $ignores = array("/.gitignore");
+ private $upgradeCleanFile = false;
+
public function setSummarizeFile($summarizeFile)
{
$this->summarizeFile = $summarizeFile;
@@ -134,8 +136,39 @@ class PydioParseGitSummarize extends Task
return $this->prefixPath;
}
+ public function setUpgradeCleanFile($clean){
+ if($clean === "true") $this->upgradeCleanFile = true;
+ }
+
+ public function getUpgradeCleanFile(){
+ return $this->upgradeCleanFile;
+ }
+
+ protected function checkCleanFileFalsePositive(){
+ $cF = $this->upgradeDir."/UPGRADE/CLEAN-FILES";
+ if(!file_exists($cF)){
+ $this->log("No CLEAN-FILES found, nothing to do");
+ }
+ $lines = file($cF, FILE_IGNORE_NEW_LINES);
+ $newLines = [];
+ foreach($lines as $line){
+ if(file_exists($this->upgradeDir.$line)){
+ $this->log("File $line was found in upgrade dir, we must ignore this git deletion.");
+ continue;
+ } else {
+ $newLines[] = $line;
+ }
+ }
+ file_put_contents($cF, implode("\n", $newLines));
+ }
+
public function main()
{
+ if($this->upgradeCleanFile){
+ $this->checkCleanFileFalsePositive();
+ return;
+ }
+
$summarizeLines = file($this->summarizeFile);
$toDelete = array();
if(isSet($this->prefixPath)) $this->sourceDir .= "/" . $this->prefixPath;
@@ -283,6 +283,8 @@
<property name="version" value="${build.version}"/>
</phingcall>
+ <!-- FINALY, RECHECK CLEAN-FILES AS GIT MAY HAVE REGISTERED SOME DELETIONS THAT WE DO REQUIRE -->
+ <pydio-parse-git-summarize upgradeCleanFile="true" upgradeDir="${upgrade_export}" />
</target>
<target name="zip" description="Package as Zip archive">
@@ -27,7 +27,7 @@ function checkPhpVersion($version){
if(version_compare(PHP_VERSION, $version) < 0){
throw new Exception("For Pydio 7, PHP version must be greater or equal to $version, detected version is ".PHP_VERSION." - Upgrade aborted.");
}else{
- echo "Checking Php Version (".PHP_VERSION.") : OK";
+ echo "Checking Php Version (".PHP_VERSION.") : OK\n";
}
}
@@ -43,7 +43,7 @@ function checkPluginUsed($type, $name){
if($p->getName() === $name){
throw new Exception("You are currently using $type.$name as configuration storage. This was deprecated in Pydio 6 and is now removed in Pydio7. Aborting upgrade");
}else{
- echo "Checking plugin $type ($name) : OK";
+ echo "Checking plugin $type ($name) : OK\n";
}
}else if($type === "auth") {
$p = ConfService::getAuthDriverImpl();
@@ -55,22 +55,23 @@ function checkPluginUsed($type, $name){
if (isSet($drivers[$name])) {
throw new Exception("You are currently using $type.$name for authentication backend. This was deprecated in Pydio 6 and is nowremoved in Pydio7. Aborting upgrade");
} else {
- echo "Checking plugin $type (" . implode(", ", array_keys($drivers)) . ") : OK";
+ echo "Checking plugin $type (" . implode(", ", array_keys($drivers)) . ") : OK\n";
}
}
- echo "Checking plugin $type ($name) : OK";
+ echo "Checking plugin $type ($name) : OK\n";
}
}else if($type === "access"){
// Check if a workspace is currently using this plugin
+ echo "Should check usage of plugin $type ($name) in active workspaces : TODO\n";
}else{
$plugs = AJXP_PluginsService::getInstance()->getActivePluginsForType($type);
if(isSet($plugs[$name])){
throw new Exception("You are currently using plugin $type.$name. This is removed in Pydio7. Please disable it before running upgrade. Aborting upgrade");
}
- echo "Checking plugin $type ($name) : OK";
+ echo "Checking plugin $type ($name) : OK\n";
}
}
@@ -86,7 +87,7 @@ function checkThemeUsed($themeName){
if(isSet($options["GUI_THEME"]) && $options["GUI_THEME"] === $themeName){
throw new Exception("You are currently using theme ".$options["GUI_THEME"]." which was removed from Pydio 7. If you want to be able to upgrade, you have to switch to Orbit theme. Aborting upgrade.");
}else{
- echo "Checking usage of remove theme ($themeName): OK";
+ echo "Checking usage of remove theme ($themeName): OK\n";
}
}
View
@@ -51,20 +51,24 @@ function updateHtAccessContent($htAccessPath){
return;
}
echo "Upgrading content of Htaccess file\n";
- $lines = file($htAccessPath);
- $startRemoving = false;
+ $lines = file($htAccessPath, FILE_IGNORE_NEW_LINES);
+ $removeFlag = false;
+ $newLines = [];
// Remove unnecessary lines
foreach($lines as $index => $line){
- if(!$startRemoving && strpos($line, "RewriteRule ") !== 0){
- continue;
- }
- if(trim($line) === 'RewriteRule (.*) index.php [L]'){
- break;
+ if(!$removeFlag){
+ $newLines[] = $line;
+ if(trim($line) === "RewriteCond %{REQUEST_FILENAME} !-d"){
+ $removeFlag = true;
+ }
}else{
- unset($lines[$index]);
+ if(trim($line) === 'RewriteRule (.*) index.php [L]'){
+ $newLines[] = $line;
+ $removeFlag = false;
+ }
}
}
- $contents = implode("\n", $lines);
+ $contents = implode("\n", $newLines);
if(is_writable($htAccessPath)){
file_put_contents($htAccessPath, $contents);
}else{
View
@@ -28,7 +28,6 @@ CREATE TABLE IF NOT EXISTS `ajxp_tasks` (
`status_update` int(11) NOT NULL DEFAULT '0' COMMENT 'Last time the status was updated',
PRIMARY KEY (`uid`),
KEY `userId` (`userId`,`status`),
- KEY `type` (`type`),
- FULLTEXT KEY `nodes` (`nodes`)
+ KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Task persistence layer';

0 comments on commit bf18edd

Please sign in to comment.