Permalink
Browse files

Pre/post update hooks for 6.5.1

  • Loading branch information...
1 parent 3b6600c commit fd9f14b4d0c53085efd422915190d96d02ddf5c6 @cdujeu cdujeu committed Sep 14, 2016
Showing with 218 additions and 0 deletions.
  1. +92 −0 dist/php/6.5.1-extractArchive-post.php
  2. +9 −0 dist/php/6.5.1.html
  3. +80 −0 dist/php/6.5.1.php
  4. +37 −0 dist/php/6.5.1.sql
@@ -0,0 +1,92 @@
+<?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 "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
+
+
+ }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";
+ }
+
+}
View
@@ -0,0 +1,9 @@
+<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.1 - Beta1 for Pydio 7</h2>
+
+ This is a beta for next major upgrade Pydio 7.
+ <b>Please update at your own risks.</b>
+
+</div>
View
@@ -0,0 +1,80 @@
+<?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){
+
+ $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.";
+ }
+ $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.";
+ }
+ $lines = file($htAccessPath);
+ $startRemoving = false;
+ // Remove unnecessary lines
+ foreach($lines as $index => $line){
+ if(!$startRemoving && strpos($line, "RewriteRule ") !== 0){
+ continue;
+ }
+ if(trim($line) === 'RewriteRule (.*) index.php [L]'){
+ break;
+ }else{
+ unset($lines[$index]);
+ }
+ }
+ $contents = implode("\n", $lines);
+ 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 = \Pydio\Core\Services\ConfService::getConfStorageImpl()->loadPluginConfig("access", "s3");
+ if($s3Options["SDK_VERSION"] === "v2"){
+ $s3Options["SDK_VERSION"] = "v3";
+ \Pydio\Core\Services\ConfService::getConfStorageImpl()->savePluginConfig("access.s3", $s3Options);
+ }
+
+}
View
@@ -0,0 +1,37 @@
+
+
+
+ALTER TABLE `ajxp_log` CHANGE `dirname` `dirname` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
+CHANGE `basename` `basename` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
+
+ALTER TABLE `ajxp_log` DROP INDEX `basename`;
+ALTER TABLE `ajxp_log` DROP INDEX `dirname`;
+
+ALTER TABLE `ajxp_log` ADD INDEX ( `user` ) ;
+ALTER TABLE `ajxp_log` ADD INDEX ( `dirname`, `basename` ) ;
+
+
+CREATE TABLE IF NOT EXISTS `ajxp_tasks` (
+ `uid` varchar(255) NOT NULL,
+ `type` int(11) NOT NULL,
+ `parent_uid` varchar(255) DEFAULT NULL,
+ `flags` int(11) NOT NULL,
+ `label` varchar(255) NOT NULL,
+ `userId` varchar(255) NOT NULL,
+ `wsId` varchar(32) NOT NULL,
+ `status` int(11) NOT NULL,
+ `status_msg` mediumtext NOT NULL,
+ `progress` int(11) NOT NULL,
+ `schedule` int(11) NOT NULL,
+ `schedule_value` varchar(255) DEFAULT NULL,
+ `action` text NOT NULL,
+ `parameters` mediumtext NOT NULL,
+ `nodes` text NOT NULL,
+ `creation_date` int(11) NOT NULL DEFAULT '0' COMMENT 'Date of creation of the job',
+ `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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Task persistence layer';
+

0 comments on commit fd9f14b

Please sign in to comment.