Packages are now continuously added to queue.
authorAlexander Ebert <ebert@woltlab.com>
Fri, 4 Nov 2011 20:38:06 +0000 (21:38 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 4 Nov 2011 20:38:06 +0000 (21:38 +0100)
The previous installation added packages without any kind of relation, thus rendering WCF unable to install them in a row (since there was no perceptible relation among them).

wcfsetup/install/files/lib/system/WCFSetup.class.php

index 59e16ffbbf60336b30fdcfd5993f2ff086e2425d..43acf1480d13cd72361baeae507107e18a160ba6 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\system;
 use wcf\data\language\LanguageEditor;
 use wcf\data\language\SetupLanguage;
+use wcf\data\package\installation\queue\PackageInstallationQueueEditor;
 use wcf\data\user\User;
 use wcf\data\user\UserAction;
 use wcf\system\cache\CacheHandler;
@@ -975,7 +976,6 @@ class WCFSetup extends WCF {
                $statement->execute();
                $result = $statement->fetchArray();
                $processNo = intval($result['processNo']) + 1;
-               $statementParameters = array();
                
                // search existing wcf package
                $sql = "SELECT  COUNT(*) AS count
@@ -990,11 +990,11 @@ class WCFSetup extends WCF {
                        }
                        
                        // register essential wcf package
-                       $statementParameters[] = array(
+                       $queue = PackageInstallationQueueEditor::create(array(
                                'package' => 'com.woltlab.wcf',
                                'packageName' => 'WoltLab Community Framework',
                                'archive' => TMP_DIR.'install/packages/'.$wcfPackageFile
-                       );
+                       ));
                }
                
                // register all other delivered packages
@@ -1011,28 +1011,12 @@ class WCFSetup extends WCF {
                                continue;
                        }
                        
-                       $statementParameters[] = array(
+                       $queue = PackageInstallationQueueEditor::create(array(
+                               'parentQueueID' => $queue->queueID,
                                '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, packageName, archive)
-                               VALUES          (?, ?, ?, ?, ?)";
-                       $statement = self::getDB()->prepareStatement($sql);
-                       
-                       foreach ($statementParameters as $parameter) {
-                               $statement->execute(array(
-                                       $processNo,
-                                       $admin->userID,
-                                       $parameter['package'],
-                                       $parameter['packageName'],
-                                       $parameter['archive']
-                               ));
-                       }
+                       ));
                }
                
                // login as admin