This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 290
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
6 changed files
with
395 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,14 @@ | ||
<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.6 - RC3 for Pydio 7</h2> | ||
|
||
This is the beta 6 for Pydio 7, second release candidate. | ||
|
||
All requests are now blocked on page and you are disconnected, please reload to login. | ||
|
||
<p style="font-size: 14px;color: red;"> | ||
<b>Please update at your own risks.</b> | ||
</p> | ||
|
||
</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,58 @@ | ||
/* SEPARATOR */ | ||
DROP TABLE IF EXISTS ajxp_tasks; | ||
/* SEPARATOR */ | ||
CREATE TABLE IF NOT EXISTS ajxp_tasks ( | ||
uid VARCHAR(40) NOT NULL, | ||
`type` INTEGER NOT NULL, | ||
parent_uid VARCHAR(40) DEFAULT NULL, | ||
flags INTEGER NOT NULL, | ||
label VARCHAR(255) NOT NULL, | ||
user_id VARCHAR(255) NOT NULL, | ||
ws_id VARCHAR(32) NOT NULL, | ||
status INTEGER NOT NULL, | ||
status_msg VARCHAR(500) NOT NULL, | ||
progress INTEGER NOT NULL, | ||
schedule INTEGER NOT NULL, | ||
schedule_value VARCHAR(255) DEFAULT NULL, | ||
`action` VARCHAR(255) NOT NULL, | ||
parameters MEDIUMBLOB NOT NULL, | ||
creation_date INTEGER NOT NULL DEFAULT 0, | ||
status_update INTEGER NOT NULL DEFAULT 0, | ||
PRIMARY KEY (uid) | ||
) CHARACTER SET utf8 COLLATE utf8_unicode_ci; | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_usr_idx ON ajxp_tasks (user_id); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_status_idx ON ajxp_tasks (status); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_type ON ajxp_tasks (type); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_schedule ON ajxp_tasks (schedule); | ||
/* SEPARATOR */ | ||
CREATE TABLE IF NOT EXISTS `ajxp_tasks_nodes` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`task_uid` varchar(40) NOT NULL, | ||
`node_base_url` varchar(255) NOT NULL, | ||
`node_path` varchar(255) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) CHARACTER SET utf8 COLLATE utf8_unicode_ci; | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_taskn_tuid_idx ON ajxp_tasks_nodes (task_uid); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_taskn_base_idx ON ajxp_tasks_nodes (node_base_url); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_taskn_path_idx ON ajxp_tasks_nodes (node_path); | ||
/* SEPARATOR */ | ||
DROP TABLE IF EXISTS ajxp_mq_queues; | ||
/* SEPARATOR */ | ||
CREATE TABLE IF NOT EXISTS `ajxp_mq_queues` ( | ||
`channel_name` varchar(255) NOT NULL, | ||
`content` LONGBLOB NOT NULL, | ||
PRIMARY KEY (`channel_name`) | ||
) CHARACTER SET utf8 COLLATE utf8_unicode_ci; | ||
/* SEPARATOR */ | ||
DROP TRIGGER IF EXISTS `LOG_UPDATE`; | ||
/* SEPARATOR */ | ||
CREATE TRIGGER `LOG_UPDATE` AFTER UPDATE ON `ajxp_index` | ||
FOR EACH ROW INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type) | ||
VALUES (new.repository_identifier, new.node_id, old.node_path, new.node_path, CASE old.node_path COLLATE utf8_bin = new.node_path COLLATE utf8_bin WHEN true THEN 'content' ELSE 'path' END); |
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,49 @@ | ||
/* SEPARATOR */ | ||
DROP TABLE IF EXISTS ajxp_tasks; | ||
/* SEPARATOR */ | ||
CREATE TABLE IF NOT EXISTS ajxp_tasks ( | ||
uid VARCHAR(255) NOT NULL , | ||
type INTEGER NOT NULL, | ||
parent_uid VARCHAR(255) DEFAULT NULL, | ||
flags INTEGER NOT NULL, | ||
label VARCHAR(255) NOT NULL, | ||
user_id VARCHAR(255) NOT NULL, | ||
ws_id VARCHAR(32) NOT NULL, | ||
status INTEGER NOT NULL, | ||
status_msg VARCHAR(500) NOT NULL, | ||
progress INTEGER NOT NULL, | ||
schedule INTEGER NOT NULL, | ||
schedule_value VARCHAR(255) DEFAULT NULL, | ||
action VARCHAR(255) NOT NULL, | ||
parameters BYTEA NOT NULL, | ||
creation_date INTEGER NOT NULL DEFAULT 0, | ||
status_update INTEGER NOT NULL DEFAULT 0, | ||
PRIMARY KEY (uid) | ||
); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_usr_idx ON ajxp_tasks (user_id); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_status_idx ON ajxp_tasks (status); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_type ON ajxp_tasks (type); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_task_schedule ON ajxp_tasks (schedule); | ||
/* SEPARATOR */ | ||
CREATE TABLE IF NOT EXISTS ajxp_tasks_nodes ( | ||
id serial PRIMARY KEY, | ||
task_uid VARCHAR(40) NOT NULL, | ||
node_base_url VARCHAR(255) NOT NULL, | ||
node_path VARCHAR(255) NOT NULL | ||
); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_taskn_tuid_idx ON ajxp_tasks_nodes (task_uid); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_taskn_base_idx ON ajxp_tasks_nodes (node_base_url); | ||
/* SEPARATOR */ | ||
CREATE INDEX ajxp_taskn_path_idx ON ajxp_tasks_nodes (node_path); | ||
/* SEPARATOR */ | ||
CREATE TABLE IF NOT EXISTS ajxp_mq_queues ( | ||
channel_name varchar(255) NOT NULL, | ||
content bytea NOT NULL, | ||
PRIMARY KEY (channel_name) | ||
); |
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"); | ||
} |
Oops, something went wrong.