This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?php | ||
/* | ||
* Copyright 2007-2016 Abstrium <contact (at) pydio.com> | ||
* This file is part of Pydio. | ||
* | ||
* Pydio is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pydio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Pydio. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* The latest code can be found at <https://pydio.com/>. | ||
*/ | ||
|
||
/** | ||
* @param string $version | ||
* @throws Exception | ||
*/ | ||
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 "<div class='upgrade_result success'>- Checking Php Version (".PHP_VERSION.") : OK</div>"; | ||
} | ||
} | ||
|
||
/** | ||
* @param string $type | ||
* @param string $name | ||
* @throws Exception | ||
*/ | ||
function checkPluginUsed($type, $name){ | ||
|
||
if($type === "conf"){ | ||
$p = ConfService::getConfStorageImpl(); | ||
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 "<div class='upgrade_result success'>- Checking plugin $type ($name) : OK</div>"; | ||
} | ||
}else if($type === "auth") { | ||
$p = ConfService::getAuthDriverImpl(); | ||
if ($p->getName() === $name) { | ||
throw new Exception("You are currently using $type.$name for authentication backend. This was deprecated in Pydio 6 and is now removed in Pydio7. Aborting upgrade"); | ||
} else { | ||
if ($p->getName() === "multi") { | ||
$drivers = $p->drivers; | ||
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 "<div class='upgrade_result success'>- Checking plugin $type (" . implode(", ", array_keys($drivers)) . ") : OK</div>"; | ||
} | ||
} | ||
echo "<div class='upgrade_result success'>- Checking plugin $type ($name) : OK</div>"; | ||
} | ||
}else if($type === "access"){ | ||
|
||
// Check if a workspace is currently using this plugin | ||
echo "<div class='upgrade_result success'>- Should check usage of plugin $type ($name) in active workspaces : TODO</div>"; | ||
|
||
|
||
}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 "<div class='upgrade_result success'>- Checking plugin $type ($name) : OK</div>"; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @param string $themeName | ||
* @throws Exception | ||
*/ | ||
function checkThemeUsed($themeName){ | ||
|
||
$p = AJXP_PluginsService::getInstance()->findPlugin("gui", "ajax"); | ||
$options = $p->getConfigs(); | ||
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 "<div class='upgrade_result success'>- Checking usage of remove theme ($themeName): OK</div>"; | ||
} | ||
|
||
} | ||
|
||
function blockAllXHRInPage(){ | ||
print ' | ||
<script type="text/javascript"> | ||
(function(open) { | ||
parent.XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { | ||
console.error("XHR Call to "+url+" blocked by upgrade process!"); | ||
}; | ||
})(parent.XMLHttpRequest.prototype.open); | ||
</script> | ||
<div class="upgrade_result success">Blocking all XHR in page: OK</div> | ||
'; | ||
} | ||
|
||
blockAllXHRInPage(); | ||
checkPhpVersion('5.5.9'); | ||
if(AJXP_VERSION === '6.4.2'){ | ||
checkPluginUsed("conf", "serial"); | ||
checkPluginUsed("auth", "serial"); | ||
checkPluginUsed("auth", "cmsms"); | ||
checkPluginUsed("access", "remote_fs"); | ||
checkThemeUsed("vision"); | ||
checkThemeUsed("umbra"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div style='font-family: "Open sans", "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif; font-size: 13px;line-height: 1.5em;' | ||
xmlns="http://www.w3.org/1999/html"> | ||
|
||
<h2>Pydio Core 6.5.3 - Beta3 for Pydio 7</h2> | ||
|
||
This is the third beta for next major release. | ||
<p style="font-size: 14px;color: red;"> | ||
<b>Please update at your own risks!! Do not update servers that are live in production!</b> | ||
</p> | ||
|
||
If you want to participate to the beta program and get access to dedicated resources, please fill in <a target="_blank" href="https://pydio.typeform.com/to/hf6K4O">this small form</a>, we will be in contact soon. | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
/* | ||
* Copyright 2007-2016 Abstrium <contact (at) pydio.com> | ||
* This file is part of Pydio. | ||
* | ||
* Pydio is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pydio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Pydio. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* The latest code can be found at <https://pydio.com/>. | ||
*/ | ||
|
||
function updateSharePhpContent($installPath, $publicFolder){ | ||
|
||
$publicFolder = preg_replace("/^".str_replace(array("\\","/"), array("\\\\", "\/"), $installPath)."/", "", $publicFolder); | ||
$sharePhpPath = $installPath."/".trim($publicFolder, "/")."/"."share.php"; | ||
if(!is_file($sharePhpPath)){ | ||
echo "No share.php file was found in public folder. If it does exist, you may have to manually upgrade its content.\n"; | ||
return; | ||
} | ||
echo "Upgrading content of $sharePhpPath file\n"; | ||
$folders = array_map(function($value){ | ||
return ".."; | ||
}, explode("/", trim($publicFolder, "/"))); | ||
$baseConfPath = implode("/", $folders); | ||
|
||
$content = '<?php | ||
include_once("'.$baseConfPath.'/base.conf.php"); | ||
define(\'AJXP_EXEC\', true); | ||
require_once AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/action.share/vendor/autoload.php"; | ||
$base = rtrim(dirname($_SERVER["SCRIPT_NAME"]), "/"); | ||
\Pydio\Share\ShareCenter::publicRoute($base, "/proxy", ["hash" => $_GET["hash"]]);'; | ||
file_put_contents($sharePhpPath, $content); | ||
|
||
} | ||
|
||
function updateHtAccessContent($htAccessPath){ | ||
|
||
if(!is_file($htAccessPath)){ | ||
echo "No htaccess file found. Skipping Htaccess update.\n"; | ||
return; | ||
} | ||
echo "Upgrading content of Htaccess file\n"; | ||
$lines = file($htAccessPath, FILE_IGNORE_NEW_LINES); | ||
$removeFlag = false; | ||
$newLines = []; | ||
// Remove unnecessary lines | ||
foreach($lines as $index => $line){ | ||
if(!$removeFlag){ | ||
$newLines[] = $line; | ||
if(trim($line) === "RewriteCond %{REQUEST_FILENAME} !-d"){ | ||
$removeFlag = true; | ||
} | ||
}else{ | ||
if(trim($line) === 'RewriteRule (.*) index.php [L]'){ | ||
$newLines[] = $line; | ||
$removeFlag = false; | ||
} | ||
} | ||
} | ||
$contents = implode("\n", $newLines); | ||
if(is_writable($htAccessPath)){ | ||
file_put_contents($htAccessPath, $contents); | ||
}else{ | ||
echo "ERROR: Htaccess file could not be written. Update it manually to the following content: <pre>$contents</pre>"; | ||
} | ||
|
||
} | ||
|
||
function awsSdkVersion(){ | ||
|
||
$s3Options = ConfService::getConfStorageImpl()->loadPluginConfig("access", "s3"); | ||
if($s3Options["SDK_VERSION"] === "v2"){ | ||
$s3Options["SDK_VERSION"] = "v3"; | ||
ConfService::getConfStorageImpl()->savePluginConfig("access.s3", $s3Options); | ||
} | ||
|
||
} | ||
|
||
function forceRenameConfFile($prefix){ | ||
|
||
// FORCE bootstrap_repositories copy | ||
if (is_file(AJXP_INSTALL_PATH."/conf/$prefix.php".".new-".date("Ymd"))) { | ||
rename(AJXP_INSTALL_PATH."/conf/$prefix.php", AJXP_INSTALL_PATH."/conf/$prefix.php.pre-update"); | ||
rename(AJXP_INSTALL_PATH."/conf/$prefix.php".".new-".date("Ymd"), AJXP_INSTALL_PATH."/conf/$prefix.php"); | ||
} | ||
|
||
|
||
} | ||
|
||
if(AJXP_VERSION === '6.4.2'){ | ||
awsSdkVersion(); | ||
updateHtAccessContent(AJXP_INSTALL_PATH."/.htaccess"); | ||
updateSharePhpContent(AJXP_INSTALL_PATH, ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER")); | ||
forceRenameConfFile("bootstrap_conf"); | ||
forceRenameConfFile("bootstrap_context"); | ||
forceRenameConfFile("extensions.conf"); | ||
}else if(AJXP_VERSION === '6.5.1' || AJXP_VERSION === '6.5.2'){ | ||
forceRenameConfFile("bootstrap_context"); | ||
} |