Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 20ef244

Browse files
committed
6.5.6 update files
1 parent 75fe9ef commit 20ef244

File tree

6 files changed

+395
-0
lines changed

6 files changed

+395
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?php
2+
/*
3+
* Copyright 2007-2016 Abstrium <contact (at) pydio.com>
4+
* This file is part of Pydio.
5+
*
6+
* Pydio is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Pydio is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* The latest code can be found at <https://pydio.com/>.
20+
*/
21+
22+
/**
23+
* @param string $version
24+
* @throws Exception
25+
*/
26+
function checkPhpVersion($version){
27+
if(version_compare(PHP_VERSION, $version) < 0){
28+
throw new Exception("For Pydio 7, PHP version must be greater or equal to $version, detected version is ".PHP_VERSION." - Upgrade aborted.");
29+
}else{
30+
echo "<div class='upgrade_result success'>- Checking Php Version (".PHP_VERSION.") : OK</div>";
31+
}
32+
}
33+
34+
/**
35+
* @param string $type
36+
* @param string $name
37+
* @throws Exception
38+
*/
39+
function checkPluginUsed($type, $name){
40+
41+
if($type === "conf"){
42+
$p = ConfService::getConfStorageImpl();
43+
if($p->getName() === $name){
44+
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");
45+
}else{
46+
echo "<div class='upgrade_result success'>- Checking plugin $type ($name) : OK</div>";
47+
}
48+
}else if($type === "auth") {
49+
$p = ConfService::getAuthDriverImpl();
50+
if ($p->getName() === $name) {
51+
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");
52+
} else {
53+
if ($p->getName() === "multi") {
54+
$drivers = $p->drivers;
55+
if (isSet($drivers[$name])) {
56+
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");
57+
} else {
58+
echo "<div class='upgrade_result success'>- Checking plugin $type (" . implode(", ", array_keys($drivers)) . ") : OK</div>";
59+
}
60+
}
61+
echo "<div class='upgrade_result success'>- Checking plugin $type ($name) : OK</div>";
62+
}
63+
}else if($type === "access"){
64+
65+
// Check if a workspace is currently using this plugin
66+
echo "<div class='upgrade_result success'>- Should check usage of plugin $type ($name) in active workspaces : TODO</div>";
67+
68+
69+
}else{
70+
$plugs = AJXP_PluginsService::getInstance()->getActivePluginsForType($type);
71+
if(isSet($plugs[$name])){
72+
throw new Exception("You are currently using plugin $type.$name. This is removed in Pydio7. Please disable it before running upgrade. Aborting upgrade");
73+
}
74+
echo "<div class='upgrade_result success'>- Checking plugin $type ($name) : OK</div>";
75+
}
76+
77+
}
78+
79+
/**
80+
* @param string $themeName
81+
* @throws Exception
82+
*/
83+
function checkThemeUsed($themeName){
84+
85+
$p = AJXP_PluginsService::getInstance()->findPlugin("gui", "ajax");
86+
$options = $p->getConfigs();
87+
if(isSet($options["GUI_THEME"]) && $options["GUI_THEME"] === $themeName){
88+
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.");
89+
}else{
90+
echo "<div class='upgrade_result success'>- Checking usage of remove theme ($themeName): OK</div>";
91+
}
92+
93+
}
94+
95+
function blockAllXHRInPage(){
96+
print '
97+
<script type="text/javascript">
98+
(function(open) {
99+
parent.XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
100+
console.error("XHR Call to "+url+" blocked by upgrade process!");
101+
};
102+
})(parent.XMLHttpRequest.prototype.open);
103+
</script>
104+
<div class="upgrade_result success">Blocking all XHR in page: OK</div>
105+
';
106+
}
107+
108+
blockAllXHRInPage();
109+
checkPhpVersion('5.5.9');
110+
if(AJXP_VERSION === '6.4.2'){
111+
checkPluginUsed("conf", "serial");
112+
checkPluginUsed("auth", "serial");
113+
checkPluginUsed("auth", "cmsms");
114+
checkPluginUsed("access", "remote_fs");
115+
checkThemeUsed("vision");
116+
checkThemeUsed("umbra");
117+
}

dist/php/6.5.6.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<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;'
2+
xmlns="http://www.w3.org/1999/html">
3+
4+
<h2>Pydio Core 6.5.6 - RC3 for Pydio 7</h2>
5+
6+
This is the beta 6 for Pydio 7, second release candidate.
7+
8+
All requests are now blocked on page and you are disconnected, please reload to login.
9+
10+
<p style="font-size: 14px;color: red;">
11+
<b>Please update at your own risks.</b>
12+
</p>
13+
14+
</div>

dist/php/6.5.6.mysql

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/* SEPARATOR */
2+
DROP TABLE IF EXISTS ajxp_tasks;
3+
/* SEPARATOR */
4+
CREATE TABLE IF NOT EXISTS ajxp_tasks (
5+
uid VARCHAR(40) NOT NULL,
6+
`type` INTEGER NOT NULL,
7+
parent_uid VARCHAR(40) DEFAULT NULL,
8+
flags INTEGER NOT NULL,
9+
label VARCHAR(255) NOT NULL,
10+
user_id VARCHAR(255) NOT NULL,
11+
ws_id VARCHAR(32) NOT NULL,
12+
status INTEGER NOT NULL,
13+
status_msg VARCHAR(500) NOT NULL,
14+
progress INTEGER NOT NULL,
15+
schedule INTEGER NOT NULL,
16+
schedule_value VARCHAR(255) DEFAULT NULL,
17+
`action` VARCHAR(255) NOT NULL,
18+
parameters MEDIUMBLOB NOT NULL,
19+
creation_date INTEGER NOT NULL DEFAULT 0,
20+
status_update INTEGER NOT NULL DEFAULT 0,
21+
PRIMARY KEY (uid)
22+
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
23+
/* SEPARATOR */
24+
CREATE INDEX ajxp_task_usr_idx ON ajxp_tasks (user_id);
25+
/* SEPARATOR */
26+
CREATE INDEX ajxp_task_status_idx ON ajxp_tasks (status);
27+
/* SEPARATOR */
28+
CREATE INDEX ajxp_task_type ON ajxp_tasks (type);
29+
/* SEPARATOR */
30+
CREATE INDEX ajxp_task_schedule ON ajxp_tasks (schedule);
31+
/* SEPARATOR */
32+
CREATE TABLE IF NOT EXISTS `ajxp_tasks_nodes` (
33+
`id` int(11) NOT NULL AUTO_INCREMENT,
34+
`task_uid` varchar(40) NOT NULL,
35+
`node_base_url` varchar(255) NOT NULL,
36+
`node_path` varchar(255) NOT NULL,
37+
PRIMARY KEY (`id`)
38+
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
39+
/* SEPARATOR */
40+
CREATE INDEX ajxp_taskn_tuid_idx ON ajxp_tasks_nodes (task_uid);
41+
/* SEPARATOR */
42+
CREATE INDEX ajxp_taskn_base_idx ON ajxp_tasks_nodes (node_base_url);
43+
/* SEPARATOR */
44+
CREATE INDEX ajxp_taskn_path_idx ON ajxp_tasks_nodes (node_path);
45+
/* SEPARATOR */
46+
DROP TABLE IF EXISTS ajxp_mq_queues;
47+
/* SEPARATOR */
48+
CREATE TABLE IF NOT EXISTS `ajxp_mq_queues` (
49+
`channel_name` varchar(255) NOT NULL,
50+
`content` LONGBLOB NOT NULL,
51+
PRIMARY KEY (`channel_name`)
52+
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
53+
/* SEPARATOR */
54+
DROP TRIGGER IF EXISTS `LOG_UPDATE`;
55+
/* SEPARATOR */
56+
CREATE TRIGGER `LOG_UPDATE` AFTER UPDATE ON `ajxp_index`
57+
FOR EACH ROW INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type)
58+
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);

dist/php/6.5.6.pgsql

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* SEPARATOR */
2+
DROP TABLE IF EXISTS ajxp_tasks;
3+
/* SEPARATOR */
4+
CREATE TABLE IF NOT EXISTS ajxp_tasks (
5+
uid VARCHAR(255) NOT NULL ,
6+
type INTEGER NOT NULL,
7+
parent_uid VARCHAR(255) DEFAULT NULL,
8+
flags INTEGER NOT NULL,
9+
label VARCHAR(255) NOT NULL,
10+
user_id VARCHAR(255) NOT NULL,
11+
ws_id VARCHAR(32) NOT NULL,
12+
status INTEGER NOT NULL,
13+
status_msg VARCHAR(500) NOT NULL,
14+
progress INTEGER NOT NULL,
15+
schedule INTEGER NOT NULL,
16+
schedule_value VARCHAR(255) DEFAULT NULL,
17+
action VARCHAR(255) NOT NULL,
18+
parameters BYTEA NOT NULL,
19+
creation_date INTEGER NOT NULL DEFAULT 0,
20+
status_update INTEGER NOT NULL DEFAULT 0,
21+
PRIMARY KEY (uid)
22+
);
23+
/* SEPARATOR */
24+
CREATE INDEX ajxp_task_usr_idx ON ajxp_tasks (user_id);
25+
/* SEPARATOR */
26+
CREATE INDEX ajxp_task_status_idx ON ajxp_tasks (status);
27+
/* SEPARATOR */
28+
CREATE INDEX ajxp_task_type ON ajxp_tasks (type);
29+
/* SEPARATOR */
30+
CREATE INDEX ajxp_task_schedule ON ajxp_tasks (schedule);
31+
/* SEPARATOR */
32+
CREATE TABLE IF NOT EXISTS ajxp_tasks_nodes (
33+
id serial PRIMARY KEY,
34+
task_uid VARCHAR(40) NOT NULL,
35+
node_base_url VARCHAR(255) NOT NULL,
36+
node_path VARCHAR(255) NOT NULL
37+
);
38+
/* SEPARATOR */
39+
CREATE INDEX ajxp_taskn_tuid_idx ON ajxp_tasks_nodes (task_uid);
40+
/* SEPARATOR */
41+
CREATE INDEX ajxp_taskn_base_idx ON ajxp_tasks_nodes (node_base_url);
42+
/* SEPARATOR */
43+
CREATE INDEX ajxp_taskn_path_idx ON ajxp_tasks_nodes (node_path);
44+
/* SEPARATOR */
45+
CREATE TABLE IF NOT EXISTS ajxp_mq_queues (
46+
channel_name varchar(255) NOT NULL,
47+
content bytea NOT NULL,
48+
PRIMARY KEY (channel_name)
49+
);

dist/php/6.5.6.php

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?php
2+
/*
3+
* Copyright 2007-2016 Abstrium <contact (at) pydio.com>
4+
* This file is part of Pydio.
5+
*
6+
* Pydio is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Pydio is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* The latest code can be found at <https://pydio.com/>.
20+
*/
21+
22+
function updateSharePhpContent($installPath, $publicFolder){
23+
24+
$publicFolder = preg_replace("/^".str_replace(array("\\","/"), array("\\\\", "\/"), $installPath)."/", "", $publicFolder);
25+
$sharePhpPath = $installPath."/".trim($publicFolder, "/")."/"."share.php";
26+
if(!is_file($sharePhpPath)){
27+
echo "No share.php file was found in public folder. If it does exist, you may have to manually upgrade its content.\n";
28+
return;
29+
}
30+
echo "Upgrading content of $sharePhpPath file\n";
31+
$folders = array_map(function($value){
32+
return "..";
33+
}, explode("/", trim($publicFolder, "/")));
34+
$baseConfPath = implode("/", $folders);
35+
36+
$content = '<?php
37+
include_once("'.$baseConfPath.'/base.conf.php");
38+
define(\'AJXP_EXEC\', true);
39+
require_once AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/action.share/vendor/autoload.php";
40+
$base = rtrim(dirname($_SERVER["SCRIPT_NAME"]), "/");
41+
\Pydio\Share\ShareCenter::publicRoute($base, "/proxy", ["hash" => $_GET["hash"]]);';
42+
file_put_contents($sharePhpPath, $content);
43+
44+
}
45+
46+
function updateHtAccessContent($htAccessPath){
47+
48+
if(!is_file($htAccessPath)){
49+
echo "No htaccess file found. Skipping Htaccess update.\n";
50+
return;
51+
}
52+
echo "Upgrading content of Htaccess file\n";
53+
$lines = file($htAccessPath, FILE_IGNORE_NEW_LINES);
54+
$removeFlag = false;
55+
$newLines = [];
56+
// Remove unnecessary lines
57+
foreach($lines as $index => $line){
58+
if(!$removeFlag){
59+
$newLines[] = $line;
60+
if(trim($line) === "RewriteCond %{REQUEST_FILENAME} !-d"){
61+
$removeFlag = true;
62+
}
63+
}else{
64+
if(trim($line) === 'RewriteRule (.*) index.php [L]'){
65+
$newLines[] = $line;
66+
$removeFlag = false;
67+
}
68+
}
69+
}
70+
$contents = implode("\n", $newLines);
71+
if(is_writable($htAccessPath)){
72+
file_put_contents($htAccessPath, $contents);
73+
}else{
74+
echo "ERROR: Htaccess file could not be written. Update it manually to the following content: <pre>$contents</pre>";
75+
}
76+
77+
}
78+
79+
function awsSdkVersion(){
80+
81+
$s3Options = ConfService::getConfStorageImpl()->loadPluginConfig("access", "s3");
82+
if($s3Options["SDK_VERSION"] === "v2"){
83+
$s3Options["SDK_VERSION"] = "v3";
84+
ConfService::getConfStorageImpl()->savePluginConfig("access.s3", $s3Options);
85+
}
86+
87+
}
88+
89+
function forceRenameConfFile($prefix){
90+
91+
// FORCE bootstrap_repositories copy
92+
if (is_file(AJXP_INSTALL_PATH."/conf/$prefix.php".".new-".date("Ymd"))) {
93+
rename(AJXP_INSTALL_PATH."/conf/$prefix.php", AJXP_INSTALL_PATH."/conf/$prefix.php.pre-update");
94+
rename(AJXP_INSTALL_PATH."/conf/$prefix.php".".new-".date("Ymd"), AJXP_INSTALL_PATH."/conf/$prefix.php");
95+
}
96+
97+
98+
}
99+
100+
if(AJXP_VERSION === '6.4.2'){
101+
awsSdkVersion();
102+
updateHtAccessContent(AJXP_INSTALL_PATH."/.htaccess");
103+
updateSharePhpContent(AJXP_INSTALL_PATH, ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER"));
104+
forceRenameConfFile("bootstrap_conf");
105+
forceRenameConfFile("bootstrap_context");
106+
forceRenameConfFile("extensions.conf");
107+
}else if(AJXP_VERSION === '6.5.1' || AJXP_VERSION === '6.5.2'){
108+
forceRenameConfFile("bootstrap_context");
109+
}

0 commit comments

Comments
 (0)