Fixed packageName for installation queue
authorAlexander Ebert <ebert@woltlab.com>
Fri, 19 Aug 2011 13:19:14 +0000 (15:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 19 Aug 2011 13:19:14 +0000 (15:19 +0200)
wcfsetup/install/files/lib/system/WCFSetup.class.php

index 36b7269c9c8587b21205c86a07b6178422cff6b8..3048dbab48016034b34865431b0cc04a85d42e7b 100644 (file)
@@ -999,7 +999,8 @@ class WCFSetup extends WCF {
                        
                        // register essential wcf package
                        $statementParameters[] = array(
-                               'packageName' => 'com.woltlab.wcf',
+                               'package' => 'com.woltlab.wcf',
+                               'packageName' => 'WoltLab Community Framework',
                                'archive' => TMP_DIR.'install/packages/'.$wcfPackageFile
                        );
                }
@@ -1007,15 +1008,27 @@ class WCFSetup extends WCF {
                // register all other delivered packages
                asort($otherPackages);
                foreach ($otherPackages as $packageName => $packageFile) {
+                       // extract packageName from archive's package.xml
+                       $archive = new PackageArchive(TMP_DIR.'install/packages/'.$packageFile);
+                       try {
+                               $archive->openArchive();
+                       }
+                       catch (\Exception $e) {
+                               // TODO: Maybe break the installation if archive is broken?
+                               // this is a broken archive, skip it
+                               continue;
+                       }
+                       
                        $statementParameters[] = array(
-                               'packageName' => $packageName,
+                               'package' => $packageName,
+                               'packageName' => $archive->getPackageInfo('packageName'),
                                'archive' => TMP_DIR.'install/packages/'.$packageFile
                        );
                }
                
                if (!empty($statementParameters)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_package_installation_queue
-                                               (processNo, userID, package, archive)
+                                               (processNo, userID, package, packageName, archive)
                                VALUES          (?, ?, ?, ?)";
                        $statement = self::getDB()->prepareStatement($sql);
                        
@@ -1023,6 +1036,7 @@ class WCFSetup extends WCF {
                                $statement->execute(array(
                                        $processNo,
                                        $admin->userID,
+                                       $parameter['package'],
                                        $parameter['packageName'],
                                        $parameter['archive']
                                ));