Added more performance logging during WCFSetup
authorAlexander Ebert <ebert@woltlab.com>
Sun, 2 Jun 2013 18:54:50 +0000 (20:54 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 2 Jun 2013 18:54:50 +0000 (20:54 +0200)
wcfsetup/install/files/lib/system/WCFSetup.class.php

index d260beecad1f6a49f0aa27236540a47d154af5ba..8ee2ef5390568df02fd4644fdaf5a9759da1f505 100644 (file)
@@ -614,6 +614,9 @@ class WCFSetup extends WCF {
                                $db = new $dbClass($dbHost, $dbUser, $dbPassword, $dbName, $dbPort);
                                $db->connect();
                                
+                               $start = microtime(true);
+                               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "Validating database ...", FILE_APPEND);
+                               
                                // check sql version
                                if (!empty($availableDBClasses[$dbClass]['minversion'])) {
                                        $sqlVersion = $db->getVersion();
@@ -625,9 +628,16 @@ class WCFSetup extends WCF {
                                        }
                                }
                                
+                               $end = microtime(true);
+                               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', round($end - $start, 3)."\nChecking for table conflicts ...", FILE_APPEND);
+                               $start = $end;
+                               
                                // check for table conflicts
                                $conflictedTables = $this->getConflictedTables($db, $dbNumber);
                                
+                               $end = microtime(true);
+                               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', round($end - $start, 3)."\n\n", FILE_APPEND);
+                               
                                // write config.inc
                                if (empty($conflictedTables)) {
                                        // connection successfully established
@@ -708,6 +718,9 @@ class WCFSetup extends WCF {
        protected function createDB() {
                $this->initDB();
                
+               $start = microtime(true);
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "Creating database ...", FILE_APPEND);
+               
                // get content of the sql structure file
                $sql = file_get_contents(TMP_DIR.'setup/db/install.sql');
                
@@ -746,6 +759,9 @@ class WCFSetup extends WCF {
                ));
                
                $this->gotoNextStep('logFiles');
+               
+               $end = microtime(true);
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', round($end - $start, 3) . "\n\n", FILE_APPEND);
        }
        
        /**
@@ -756,7 +772,7 @@ class WCFSetup extends WCF {
                
                $this->getInstalledFiles(WCF_DIR);
                $acpTemplateInserts = $fileInserts = array();
-               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "Logging files:\n");
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "Logging files:\n", FILE_APPEND);
                $start = microtime(true);
                foreach (self::$installedFiles as $file) {
                        $match = array();