From 96ad3d1dfbda38394a8a31b6fff5839428719106 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 4 Nov 2016 12:16:39 +0100 Subject: [PATCH] Added support for update from 2.1 --- com.woltlab.wcf/acpMenu.xml | 16 + com.woltlab.wcf/coreObject.xml | 3 + com.woltlab.wcf/objectType.xml | 5 + com.woltlab.wcf/objectTypeDefinition.xml | 14 +- com.woltlab.wcf/option.xml | 12 +- com.woltlab.wcf/package.xml | 40 +- com.woltlab.wcf/packageInstallationPlugin.xml | 5 + com.woltlab.wcf/update.sql | 615 ++++++++++++++++++ com.woltlab.wcf/userGroupOption.xml | 19 + ...> update_com.woltlab.wcf_3.0_post_sql.php} | 15 + .../update_com.woltlab.wcf_3.0_pre_sql.php | 30 + .../EventListenerCacheBuilder.class.php | 17 + .../FilePackageInstallationPlugin.class.php | 3 +- .../lib/system/style/StyleCompiler.class.php | 5 + wcfsetup/setup/db/install.sql | 1 - 15 files changed, 784 insertions(+), 16 deletions(-) create mode 100644 com.woltlab.wcf/update.sql rename wcfsetup/install/files/acp/{update_com.woltlab.wcf_3.0.0.php => update_com.woltlab.wcf_3.0_post_sql.php} (67%) create mode 100644 wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_pre_sql.php diff --git a/com.woltlab.wcf/acpMenu.xml b/com.woltlab.wcf/acpMenu.xml index a951c64058..a494499fa5 100644 --- a/com.woltlab.wcf/acpMenu.xml +++ b/com.woltlab.wcf/acpMenu.xml @@ -696,4 +696,20 @@ + + + + + + + + + + + + + + + + diff --git a/com.woltlab.wcf/coreObject.xml b/com.woltlab.wcf/coreObject.xml index d7bce7fc5f..d7cfa3471e 100644 --- a/com.woltlab.wcf/coreObject.xml +++ b/com.woltlab.wcf/coreObject.xml @@ -66,4 +66,7 @@ wcf\system\search\SearchEngine + + + diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 5e14c1269d..772f4ea941 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -1142,4 +1142,9 @@ + + + com.woltlab.wcf.collapsibleContent + + diff --git a/com.woltlab.wcf/objectTypeDefinition.xml b/com.woltlab.wcf/objectTypeDefinition.xml index cbdfc79f86..72bc7deeed 100644 --- a/com.woltlab.wcf/objectTypeDefinition.xml +++ b/com.woltlab.wcf/objectTypeDefinition.xml @@ -222,20 +222,12 @@ wcf\system\condition\IObjectListCondition - - - - com.woltlab.wcf.page - - - - com.woltlab.wcf.user.online.location - wcf\system\user\online\location\IUserOnlineLocation - - + + + diff --git a/com.woltlab.wcf/option.xml b/com.woltlab.wcf/option.xml index a64d841ffe..c16cdc4c13 100644 --- a/com.woltlab.wcf/option.xml +++ b/com.woltlab.wcf/option.xml @@ -1555,14 +1555,24 @@ DESC:wcf.global.sortOrder.descending + + diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0.0.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_post_sql.php similarity index 67% rename from wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0.0.php rename to wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_post_sql.php index e095d24219..c5564604fb 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0.0.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_post_sql.php @@ -1,4 +1,5 @@ prepareStatement($sql); +$statement->execute([ + 1, + 'com.woltlab.wcf.Dashboard' +]); diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_pre_sql.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_pre_sql.php new file mode 100644 index 0000000000..29aa19e952 --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.0_pre_sql.php @@ -0,0 +1,30 @@ +prepareStatement($sql); +$statement->execute(); + +// create wcf1_acp_session_virtual +$sql = "DROP TABLE IF EXISTS wcf".WCF_N."_acp_session_virtual"; +$statement = WCF::getDB()->prepareStatement($sql); +$statement->execute(); +$sql = "CREATE TABLE wcf".WCF_N."_acp_session_virtual ( + virtualSessionID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, + sessionID CHAR(40) NOT NULL, + ipAddress VARCHAR(39) NOT NULL DEFAULT '', + userAgent VARCHAR(191) NOT NULL DEFAULT '', + lastActivityTime INT(10) NOT NULL DEFAULT 0, + sessionVariables MEDIUMTEXT, + UNIQUE KEY (sessionID, ipAddress, userAgent) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci"; +$statement = WCF::getDB()->prepareStatement($sql); +$statement->execute(); + +// create virtual session for current user +$sql = "INSERT INTO wcf".WCF_N."_acp_session_virtual (sessionID, ipAddress, userAgent, lastActivityTime, sessionVariables) SELECT sessionID, ipAddress, userAgent, lastActivityTime, sessionVariables FROM wcf".WCF_N."_acp_session WHERE sessionID = ?"; +$statement = \wcf\system\WCF::getDB()->prepareStatement($sql); +$statement->execute([WCF::getSession()->sessionID]); + +// create session cookie +@header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX . 'cookieHash_acp').'='.rawurlencode(WCF::getSession()->sessionID).'; path=/'.(\wcf\system\request\RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false); diff --git a/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php index e14d7c203f..e057b0ebc3 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php @@ -1,6 +1,7 @@ $inheritedActions ]; } + + /** + * @inheritDoc + */ + public function getData(array $parameters = [], $arrayIndex = '') { + $data = parent::getData($parameters, $arrayIndex); + + // work-around for update from 2.1 (changed cache structure :-() + if (is_array($data['inheritedActions']['admin']['wcf\page\AbstractPage']['readParameters'][0])) { + $index = CacheHandler::getInstance()->getCacheIndex($parameters); + $data = $this->cache[$index] = $this->rebuild($parameters); + $this->reset(); + } + + return $data; + } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php index 52830a1430..dd19251576 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php @@ -2,6 +2,7 @@ namespace wcf\system\package\plugin; use wcf\data\application\Application; use wcf\data\package\Package; +use wcf\system\cache\CacheHandler; use wcf\system\exception\SystemException; use wcf\system\package\FilesFileHandler; use wcf\system\package\PackageArchive; @@ -49,7 +50,7 @@ class FilePackageInstallationPlugin extends AbstractPackageInstallationPlugin { // extract content of files.tar $fileInstaller = $this->installation->extractFiles($packageDir, $sourceFile, $fileHandler); - // if this a an application, write config.inc.php for this package + // if this is an application, write config.inc.php for this package if ($this->installation->getPackage()->isApplication == 1 && $this->installation->getPackage()->package != 'com.woltlab.wcf' && $this->installation->getAction() == 'install' && $abbreviation != 'wcf') { // touch file $fileInstaller->touchFile(PackageInstallationDispatcher::CONFIG_FILE); diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index 9b3c4ecdfd..e636f3b617 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -107,6 +107,11 @@ class StyleCompiler extends SingletonFactory { * Compiles SCSS stylesheets for ACP usage. */ public function compileACP() { + if (substr(WCF_VERSION, 0, 3) == '2.1') { + // work-around for wcf2.1 update + return; + } + $files = $this->getCoreFiles(); // ACP uses a slightly different layout diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 99f3897946..0a13ac1794 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -1992,7 +1992,6 @@ INSERT INTO wcf1_package_update_server (serverURL, status, isDisabled, errorMess INSERT INTO wcf1_package_update_server (serverURL, status, isDisabled, errorMessage, lastUpdateTime, loginUsername, loginPassword) VALUES ('http://store.woltlab.com/vortex/', 'online', 0, NULL, 0, '', ''); -- style default values - INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('individualScss', ''); INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('messageSidebarOrientation', 'left'); INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('overrideScss', ''); -- 2.20.1