From: Alexander Ebert Date: Wed, 5 Dec 2012 01:52:23 +0000 (+0100) Subject: Installation is now working, but still things are broken X-Git-Tag: 2.0.0_Beta_1~741^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b8e1429fe8371fdda74aa930c736ab51dbd9503d;p=GitHub%2FWoltLab%2FWCF.git Installation is now working, but still things are broken Fixes #960 --- diff --git a/wcfsetup/install/files/lib/data/application/ApplicationEditor.class.php b/wcfsetup/install/files/lib/data/application/ApplicationEditor.class.php index 696a95703c..f67913e680 100644 --- a/wcfsetup/install/files/lib/data/application/ApplicationEditor.class.php +++ b/wcfsetup/install/files/lib/data/application/ApplicationEditor.class.php @@ -32,7 +32,7 @@ class ApplicationEditor extends DatabaseObjectEditor implements IEditableCachedO $sql = "UPDATE wcf".WCF_N."_application SET isPrimary = ? - WHERE applicationID = ?"; + WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array( 1, diff --git a/wcfsetup/install/files/lib/data/language/Language.class.php b/wcfsetup/install/files/lib/data/language/Language.class.php index b1811afadc..a8d94e3251 100644 --- a/wcfsetup/install/files/lib/data/language/Language.class.php +++ b/wcfsetup/install/files/lib/data/language/Language.class.php @@ -139,7 +139,7 @@ class Language extends DatabaseObject { } // search language file - $filename = WCF_DIR.'language/'.$this->packageID.'_'.$this->languageID.'_'.$category.'.php'; + $filename = WCF_DIR.'language/'.$this->languageID.'_'.$category.'.php'; if (!@file_exists($filename)) { if ($this->editor === null) { $this->editor = new LanguageEditor($this); @@ -147,7 +147,7 @@ class Language extends DatabaseObject { // rebuild language file $languageCategory = LanguageFactory::getInstance()->getCategory($category); - $this->editor->updateCategory(array($languageCategory->languageCategoryID), array($this->packageID)); + $this->editor->updateCategory(array($languageCategory->languageCategoryID)); } // include language file diff --git a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php index c2316430c1..8c12b75ea9 100644 --- a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php +++ b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php @@ -45,10 +45,9 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje /** * Updates the language files for the given category. * - * @param array $categoryIDs - * @param array $packageIDs + * @param array $categoryIDs */ - public function updateCategory(array $categoryIDs = array(), array $packageIDs = array()) { + public function updateCategory(array $categoryIDs = array()) { if (empty($categoryIDs)) { // get all categories $sql = "SELECT languageCategoryID @@ -60,16 +59,15 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje } } - $this->writeLanguageFiles($categoryIDs, $packageIDs); + $this->writeLanguageFiles($categoryIDs); } /** * Write the languages files. * * @param array $categoryIDs - * @param array $packageIDs */ - protected function writeLanguageFiles(array $categoryIDs, array $packageIDs) { + protected function writeLanguageFiles(array $categoryIDs) { // get categories $conditions = new PreparedStatementConditionBuilder(); $conditions->add("languageCategoryID IN (?)", array($categoryIDs)); @@ -83,48 +81,44 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje $categoryName = $category['languageCategory']; $categoryID = $category['languageCategoryID']; - // loop packages - foreach ($packageIDs as $packageID) { - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("languageID = ?", array($this->languageID)); - $conditions->add("languageCategoryID = ?", array($categoryID)); - - // get language items - $conditions->add("packageID IS NULL"); - $sql = "SELECT languageItem, languageItemValue, languageCustomItemValue, languageUseCustomValue - FROM wcf".WCF_N."_language_item - ".$conditions; - - $statement2 = WCF::getDB()->prepareStatement($sql); - $statement2->execute($conditions->getParameters()); - $items = array(); - while ($row = $statement2->fetchArray()) { - if ($row['languageUseCustomValue'] == 1) { - $items[$row['languageItem']] = $row['languageCustomItemValue']; - } - else { - $items[$row['languageItem']] = $row['languageItemValue']; - } + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("languageID = ?", array($this->languageID)); + $conditions->add("languageCategoryID = ?", array($categoryID)); + + // get language items + $sql = "SELECT languageItem, languageItemValue, languageCustomItemValue, languageUseCustomValue + FROM wcf".WCF_N."_language_item + ".$conditions; + + $statement2 = WCF::getDB()->prepareStatement($sql); + $statement2->execute($conditions->getParameters()); + $items = array(); + while ($row = $statement2->fetchArray()) { + if ($row['languageUseCustomValue'] == 1) { + $items[$row['languageItem']] = $row['languageCustomItemValue']; } + else { + $items[$row['languageItem']] = $row['languageItemValue']; + } + } + + if (!empty($items)) { + $content = "languageCode."\n* encoding: UTF-8\n* category: ".$categoryName."\n* generated at ".gmdate("r")."\n* \n* DO NOT EDIT THIS FILE\n*/\n"; - if (!empty($items)) { - $content = "languageCode."\n* encoding: UTF-8\n* category: ".$categoryName."\n* generated at ".gmdate("r")."\n* \n* DO NOT EDIT THIS FILE\n*/\n"; + foreach ($items as $languageItem => $languageItemValue) { + $content .= "\$this->items['".$languageItem."'] = '".str_replace("'", "\'", $languageItemValue)."';\n"; - foreach ($items as $languageItem => $languageItemValue) { - $content .= "\$this->items['".$languageItem."'] = '".str_replace("'", "\'", $languageItemValue)."';\n"; - - // compile dynamic language variables - if ($categoryName != 'wcf.global' && strpos($languageItemValue, '{') !== false) { - $output = LanguageFactory::getInstance()->getScriptingCompiler()->compileString($languageItem, $languageItemValue); - $content .= "\$this->dynamicItems['".$languageItem."'] = '".str_replace("'", "\'", $output['template'])."';\n"; - } + // compile dynamic language variables + if ($categoryName != 'wcf.global' && strpos($languageItemValue, '{') !== false) { + $output = LanguageFactory::getInstance()->getScriptingCompiler()->compileString($languageItem, $languageItemValue); + $content .= "\$this->dynamicItems['".$languageItem."'] = '".str_replace("'", "\'", $output['template'])."';\n"; } - - $file = new File(WCF_DIR.'language/'.$packageID.'_'.$this->languageID.'_'.$categoryName.'.php'); - @$file->chmod(0777); - $file->write($content . '?>'); - $file->close(); } + + $file = new File(WCF_DIR.'language/'.$this->languageID.'_'.$categoryName.'.php'); + @$file->chmod(0777); + $file->write($content . '?>'); + $file->close(); } } } diff --git a/wcfsetup/install/files/lib/data/package/Package.class.php b/wcfsetup/install/files/lib/data/package/Package.class.php index 31baa4df1e..1db6dbb941 100644 --- a/wcfsetup/install/files/lib/data/package/Package.class.php +++ b/wcfsetup/install/files/lib/data/package/Package.class.php @@ -368,7 +368,7 @@ class Package extends DatabaseObject { // write general information $file->write("// general info\n"); $file->write("if (!defined('RELATIVE_WCF_DIR')) define('RELATIVE_WCF_DIR', RELATIVE_".$prefix."_DIR.'".FileUtil::getRelativePath($packageDir, WCF_DIR)."');\n"); - $file->write("if (!defined('PACKAGE_ID')) define('PACKAGE_ID', ".$row['packageID'].");\n"); + $file->write("if (!defined('PACKAGE_ID')) define('PACKAGE_ID', ".($row === false ? $packageID : $row['packageID']).");\n"); $file->write("if (!defined('PACKAGE_NAME')) define('PACKAGE_NAME', '".str_replace("'", "\'", $package->getName())."');\n"); $file->write("if (!defined('PACKAGE_VERSION')) define('PACKAGE_VERSION', '".$package->packageVersion."');\n"); diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 0f1b9c004b..389f8e6064 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -5,6 +5,9 @@ use wcf\data\package\PackageCache; use wcf\system\application\ApplicationHandler; use wcf\system\cache\CacheHandler; use wcf\system\cronjob\CronjobScheduler; +use wcf\system\exception\IPrintableException; +use wcf\system\exception\PermissionDeniedException; +use wcf\system\exception\SystemException; use wcf\system\language\LanguageFactory; use wcf\system\package\PackageInstallationDispatcher; use wcf\system\session\SessionFactory; @@ -12,7 +15,6 @@ use wcf\system\session\SessionHandler; use wcf\system\style\StyleHandler; use wcf\system\template\TemplateEngine; use wcf\system\user\storage\UserStorageHandler; -use wcf\system\exception; use wcf\util; // try to disable execution time limit @@ -237,13 +239,13 @@ class WCF { */ public static final function handleException(\Exception $e) { try { - if ($e instanceof exception\IPrintableException) { + if ($e instanceof IPrintableException) { $e->show(); exit; } // repack Exception - self::handleException(new exception\SystemException($e->getMessage(), $e->getCode(), '', $e)); + self::handleException(new SystemException($e->getMessage(), $e->getCode(), '', $e)); } catch (\Exception $exception) { die("
WCF::handleException() Unhandled exception: ".$exception->getMessage()."\n\n".$exception->getTraceAsString());
@@ -268,7 +270,7 @@ class WCF {
 					break;
 			}
 			
-			throw new exception\SystemException('PHP '.$type.' in file '.$filename.' ('.$lineNo.'): '.$message, 0);
+			throw new SystemException('PHP '.$type.' in file '.$filename.' ('.$lineNo.'): '.$message, 0);
 		}
 	}
 	
@@ -389,17 +391,17 @@ class WCF {
 	protected function initBlacklist() {
 		if (defined('BLACKLIST_IP_ADDRESSES') && BLACKLIST_IP_ADDRESSES != '') {
 			if (!util\StringUtil::executeWordFilter(WCF::getSession()->ipAddress, BLACKLIST_IP_ADDRESSES)) {
-				throw new exception\PermissionDeniedException();
+				throw new PermissionDeniedException();
 			}
 		}
 		if (defined('BLACKLIST_USER_AGENTS') && BLACKLIST_USER_AGENTS != '') {
 			if (!util\StringUtil::executeWordFilter(WCF::getSession()->userAgent, BLACKLIST_USER_AGENTS)) {
-				throw new exception\PermissionDeniedException();
+				throw new PermissionDeniedException();
 			}
 		}
 		if (defined('BLACKLIST_HOSTNAMES') && BLACKLIST_HOSTNAMES != '') {
 			if (!util\StringUtil::executeWordFilter(@gethostbyaddr(WCF::getSession()->ipAddress), BLACKLIST_HOSTNAMES)) {
-				throw new exception\PermissionDeniedException();
+				throw new PermissionDeniedException();
 			}
 		}
 	}
@@ -465,7 +467,7 @@ class WCF {
 				require_once($configPath);
 			}
 			else {
-				throw new exception\SystemException('Unable to load configuration for '.$package->package);
+				throw new SystemException('Unable to load configuration for '.$package->package);
 			}
 			
 			// load options
@@ -483,7 +485,7 @@ class WCF {
 		}
 		else {
 			unset(self::$autoloadDirectories[$abbreviation]);
-			throw new exception\SystemException("Unable to run '".$package->package."', '".$className."' is missing or does not implement 'wcf\system\application\IApplication'.");
+			throw new SystemException("Unable to run '".$package->package."', '".$className."' is missing or does not implement 'wcf\system\application\IApplication'.");
 		}
 		
 		// register template path in ACP
@@ -533,7 +535,7 @@ class WCF {
 			return $this->$method();
 		}
 		
-		throw new exception\SystemException("method '".$method."' does not exist in class WCF");
+		throw new SystemException("method '".$method."' does not exist in class WCF");
 	}
 	
 	/**
@@ -592,12 +594,12 @@ class WCF {
 		
 		$objectName = self::getCoreObject($className);
 		if ($objectName === null) {
-			throw new exception\SystemException("Core object '".$className."' is unknown.");
+			throw new SystemException("Core object '".$className."' is unknown.");
 		}
 		
 		if (class_exists($objectName)) {
 			if (!(util\ClassUtil::isInstanceOf($objectName, 'wcf\system\SingletonFactory'))) {
-				throw new exception\SystemException("class '".$objectName."' does not implement the interface 'SingletonFactory'");
+				throw new SystemException("class '".$objectName."' does not implement the interface 'SingletonFactory'");
 			}
 			
 			self::$coreObject[$className] = call_user_func(array($objectName, 'getInstance'));
diff --git a/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php
index 4ddbfb309b..afef04fb96 100644
--- a/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php
+++ b/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php
@@ -75,7 +75,6 @@ class ACPMenuCacheBuilder implements ICacheBuilder {
 			$statement->execute($conditions->getParameters());
 			while ($row = $statement->fetchArray()) {
 				$data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array(
-					'packageID' => $packageID,
 					'menuItem' => 'wcf.acp.option.category.'.$row['categoryName'],
 					'parentMenuItem' => 'wcf.acp.menu.link.option.category',
 					'menuItemLink' => 'index.php/Option/'.$row['categoryID'].'/',
diff --git a/wcfsetup/install/files/lib/system/cache/builder/ApplicationCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ApplicationCacheBuilder.class.php
index e298511a34..1014a43084 100644
--- a/wcfsetup/install/files/lib/system/cache/builder/ApplicationCacheBuilder.class.php
+++ b/wcfsetup/install/files/lib/system/cache/builder/ApplicationCacheBuilder.class.php
@@ -55,6 +55,7 @@ class ApplicationCacheBuilder implements ICacheBuilder {
 		// assign wcf pseudo-application
 		if (PACKAGE_ID) {
 			$data['wcf'] = $data['application'][1];
+			unset($data['application'][1]);
 		}
 		
 		return $data;
diff --git a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php
index 6ab710f3d0..8485a3d84f 100644
--- a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php
+++ b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php
@@ -17,7 +17,7 @@ class TemplateListenerCodeCacheBuilder implements ICacheBuilder {
 	 * @see	wcf\system\cache\ICacheBuilder::getData()
 	 */
 	public function getData(array $cacheResource) {
-		list($packageID, $environment, $templateName) = explode('-', $cacheResource['cache']); 
+		list($environment, $templateName) = explode('-', $cacheResource['cache']); 
 		
 		// get template codes for specified template
 		$templateListenerList = new TemplateListenerList();