From 20ef244f700b06e148feb113039ac7b67f30f6aa Mon Sep 17 00:00:00 2001 From: cdujeu Date: Mon, 17 Oct 2016 14:46:24 +0200 Subject: [PATCH] 6.5.6 update files --- dist/php/6.5.6-extractArchive-post.php | 117 +++++++++++++++++++++++++ dist/php/6.5.6.html | 14 +++ dist/php/6.5.6.mysql | 58 ++++++++++++ dist/php/6.5.6.pgsql | 49 +++++++++++ dist/php/6.5.6.php | 109 +++++++++++++++++++++++ dist/php/6.5.6.sqlite | 48 ++++++++++ 6 files changed, 395 insertions(+) create mode 100644 dist/php/6.5.6-extractArchive-post.php create mode 100644 dist/php/6.5.6.html create mode 100644 dist/php/6.5.6.mysql create mode 100644 dist/php/6.5.6.pgsql create mode 100644 dist/php/6.5.6.php create mode 100644 dist/php/6.5.6.sqlite diff --git a/dist/php/6.5.6-extractArchive-post.php b/dist/php/6.5.6-extractArchive-post.php new file mode 100644 index 0000000000..2671d30d6f --- /dev/null +++ b/dist/php/6.5.6-extractArchive-post.php @@ -0,0 +1,117 @@ + + * 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 . + * + * The latest code can be found at . + */ + +/** + * @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 "
- Checking Php Version (".PHP_VERSION.") : OK
"; + } +} + +/** + * @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 "
- Checking plugin $type ($name) : OK
"; + } + }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 "
- Checking plugin $type (" . implode(", ", array_keys($drivers)) . ") : OK
"; + } + } + echo "
- Checking plugin $type ($name) : OK
"; + } + }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
"; + + + }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
"; + } + +} + +/** + * @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 "
- Checking usage of remove theme ($themeName): OK
"; + } + +} + +function blockAllXHRInPage(){ + print ' + +
Blocking all XHR in page: OK
+ '; +} + +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"); +} diff --git a/dist/php/6.5.6.html b/dist/php/6.5.6.html new file mode 100644 index 0000000000..1e56ce3c35 --- /dev/null +++ b/dist/php/6.5.6.html @@ -0,0 +1,14 @@ +
+ +

Pydio Core 6.5.6 - RC3 for Pydio 7

+ + 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. + +

+ Please update at your own risks. +

+ +
\ No newline at end of file diff --git a/dist/php/6.5.6.mysql b/dist/php/6.5.6.mysql new file mode 100644 index 0000000000..605140aef5 --- /dev/null +++ b/dist/php/6.5.6.mysql @@ -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); \ No newline at end of file diff --git a/dist/php/6.5.6.pgsql b/dist/php/6.5.6.pgsql new file mode 100644 index 0000000000..f6f66ec9ba --- /dev/null +++ b/dist/php/6.5.6.pgsql @@ -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) +); diff --git a/dist/php/6.5.6.php b/dist/php/6.5.6.php new file mode 100644 index 0000000000..af63be1ec9 --- /dev/null +++ b/dist/php/6.5.6.php @@ -0,0 +1,109 @@ + + * 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 . + * + * The latest code can be found at . + */ + +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 = ' $_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:
$contents
"; + } + +} + +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"); +} \ No newline at end of file diff --git a/dist/php/6.5.6.sqlite b/dist/php/6.5.6.sqlite new file mode 100644 index 0000000000..cd08ff55da --- /dev/null +++ b/dist/php/6.5.6.sqlite @@ -0,0 +1,48 @@ +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 TEXT 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 integer NOT NULL primary key autoincrement, + task_uid TEXT NOT NULL, + node_base_url TEXT NOT NULL, + node_path TEXT 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 BLOB NOT NULL, + PRIMARY KEY (`channel_name`) +); \ No newline at end of file