Added performance log for WCFSetup
authorAlexander Ebert <ebert@woltlab.com>
Wed, 15 May 2013 16:40:47 +0000 (18:40 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 15 May 2013 16:40:47 +0000 (18:40 +0200)
wcfsetup/install/files/lib/system/WCFSetup.class.php

index c5162472ca4e1f2b98a61e8c3cded0537ade2c7d..593061cc464fe0b1b3015267790f389f509086fd 100644 (file)
@@ -768,6 +768,8 @@ class WCFSetup extends WCF {
                
                $this->getInstalledFiles(WCF_DIR);
                $acpTemplateInserts = $fileInserts = array();
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "Logging files:\n");
+               $start = microtime(true);
                foreach (self::$installedFiles as $file) {
                        $match = array();
                        if (preg_match('!/acp/templates/([^/]+)\.tpl$!', $file, $match)) {
@@ -779,7 +781,8 @@ class WCFSetup extends WCF {
                                $fileInserts[] = StringUtil::replace(WCF_DIR, '', $file);
                        }
                }
-               
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "\tRead files: " . round(microtime(true) - $start, 3) . "\n", FILE_APPEND);
+               $start = microtime(true);
                // save acp template log
                if (!empty($acpTemplateInserts)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_acp_template
@@ -793,7 +796,8 @@ class WCFSetup extends WCF {
                        }
                        self::getDB()->commitTransaction();
                }
-               
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "\tRegistered ACP templates: " . round(microtime(true) - $start, 3) . "\n", FILE_APPEND);
+               $start = microtime(true);
                // save file log
                if (!empty($fileInserts)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_package_installation_file_log
@@ -807,7 +811,7 @@ class WCFSetup extends WCF {
                        }
                        self::getDB()->commitTransaction();
                }
-               
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "\tRegistered files: " . round(microtime(true) - $start, 3) . "\n", FILE_APPEND);
                $this->gotoNextStep('installLanguage');
        }
        
@@ -835,6 +839,7 @@ class WCFSetup extends WCF {
        protected function installLanguage() {
                $this->initDB();
                
+               $start = microtime(true);
                foreach (self::$selectedLanguages as $language) {
                        // get language.xml file name
                        $filename = TMP_DIR.'install/lang/'.$language.'.xml';
@@ -851,7 +856,7 @@ class WCFSetup extends WCF {
                        // import xml
                        LanguageEditor::importFromXML($xml, 0);
                }
-               
+               file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "\nInstalled languages: " . round(microtime(true) - $start, 3) . "\n", FILE_APPEND);
                // set default language
                $language = LanguageFactory::getInstance()->getLanguageByCode(in_array(self::$selectedLanguageCode, self::$selectedLanguages) ? self::$selectedLanguageCode : self::$selectedLanguages[0]);
                LanguageFactory::getInstance()->makeDefault($language->languageID);