Added health check for innodb_flush_log_at_trx_commit
authorAlexander Ebert <ebert@woltlab.com>
Wed, 6 Jun 2012 16:31:32 +0000 (18:31 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 6 Jun 2012 16:31:32 +0000 (18:31 +0200)
wcfsetup/install/files/lib/acp/page/IndexPage.class.php

index 9747d8636245b80912bf900fcb4dfdbfef0a6e63..60761bd5fae2338731fab3165fb9f6759957b869 100755 (executable)
@@ -61,6 +61,17 @@ class IndexPage extends AbstractPage {
         */
        public function calculateHealth() {
                try {
+                       // InnoDB's innodb_flush_log_at_trx_commit=1 causes poor performance, 2 is a better choice
+                       if (get_class(WCF::getDB()) == 'wcf\system\database\MySQLDatabase') {
+                               $sql = "SHOW VARIABLES LIKE ?";
+                               $statement = WCF::getDB()->prepareStatement($sql);
+                               $statement->execute(array('innodb_flush_log_at_trx_commit'));
+                               $row = $statement->fetchArray();
+                               if ($row['Value'] == '1') {
+                                       $this->healthDetails['warning'][] = WCF::getLanguage()->get('wcf.acp.index.health.innodbFlushLog');
+                               }
+                       }
+                       
                        // TODO: Fill this list
                        $shouldBeWritable = array(WCF_DIR);
                        foreach ($shouldBeWritable as $file) {