Пример #1
0
             } elseif ($result = mysql_query('SHOW TABLES')) {
                 if ($count = mysql_num_rows($result)) {
                     $warning = $t->_('The database already contains %d tables.', $count);
                 }
             }
             $installer_apps = new waInstallerApps();
             if (extension_loaded('mysqli')) {
                 $db_options['type'] = 'mysqli';
             } else {
                 $db_options['type'] = 'mysql';
             }
             if (strpos($db_options['host'], ':')) {
                 $db_options['port'] = '';
                 list($db_options['host'], $db_options['port']) = explode(':', $db_options['host'], 2);
             }
             $installer_apps->updateDbConfig($db_options);
             mysql_close($link);
             $installer_apps->setGenericOptions($_POST['config']);
             $checked = true;
         } else {
             $error_text = mysql_error($link);
             $error_no = mysql_errno($link);
             throw new Exception($t->_('Failed to connect to the "%s" database. (%s)', $db_options['database'], "#{$error_no}: {$error_text}"));
         }
     } else {
         $error_text = htmlentities(mysql_error(), ENT_QUOTES, 'utf-8');
         $error_no = mysql_errno();
         throw new Exception($t->_('Failed to connect to "%s" MySQL database server. (%s)', $db_options['host'], "#{$error_no}: {$error_text}"));
     }
 } catch (Exception $e) {
     if (!empty($link) && is_resource($link)) {