Skip to content
Snippets Groups Projects
Select Git revision
  • 42d2b92fcf2f8a00f67f16ac7ff8f2bd1821337b
  • 11.x default protected
  • 11.2.x protected
  • 10.6.x protected
  • 10.5.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

UpdateScriptTest.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    database.mysqli.inc 11.96 KiB
    <?php
    // $Id$
    
    /**
     * @file
     * Database interface code for MySQL database servers using the mysqli client libraries. mysqli is included in PHP 5 by default and allows developers to use the advanced features of MySQL 4.1.x, 5.0.x and beyond.
     */
    
    /* Maintainers of this file should consult
     * http://www.php.net/manual/en/ref.mysqli.php
     */
    
    /**
     * @ingroup database
     * @{
     */
    
    /**
     * Initialise a database connection.
     *
     * Note that mysqli does not support persistent connections.
     */
    function db_connect($url) {
      // Check if MySQLi support is present in PHP
      if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
        drupal_maintenance_theme();
        drupal_set_title('PHP MySQLi support not enabled');
        print theme('maintenance_page', '<p>We were unable to use the MySQLi database because the MySQLi extension for PHP is not installed. Check your <code>PHP.ini</code> to see how you can enable it.</p>
    <p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
        exit;
      }
    
      $url = parse_url($url);
    
      // Allow for non-standard MySQL port.
      if (isset($url['port'])) {
         $url['host'] = $url['host'] .':'. $url['port'];
      }
    
      $connection = mysqli_init();
      @mysqli_real_connect($connection, $url['host'], $url['user'], $url['pass'], substr($url['path'], 1), NULL, NULL, MYSQLI_CLIENT_FOUND_ROWS);
    
      if (!$connection) {
        drupal_maintenance_theme();
        drupal_set_title('Unable to connect to database server');
        print theme('maintenance_page', '<p>This either means that the username and password information in your <code>settings.php</code> file is incorrect or we can\'t contact the MySQL database server through the mysqli libraries. This could mean your hosting provider\'s database server is down, or your PHP is not compiled with mysqli.</p>
    <p>The MySQL error was: '. theme('placeholder', mysqli_error($connection)) .'.</p>
    <p>Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
    <ul>
      <li>Are you sure you have the correct username and password?</li>
      <li>Are you sure that you have typed the correct hostname?</li>
      <li>Are you sure that the database server is running?</li>
      <li>Are you sure that the mysqli libraries are compiled in your PHP installation? Try using the mysql library instead by editing your <code>settings.php</code> configuration file in Drupal.</li>
    </ul>
    <p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
        exit;
      }
    
      if (!mysqli_select_db($connection, substr($url['path'], 1))) {
        drupal_maintenance_theme();
        drupal_set_title('Unable to select database');
        print theme('maintenance_page', '<p>We were able to connect to the MySQL database server (which means your username and password are okay) but not able to select the database.</p>
    <p>The MySQL error was: '. theme('placeholder', mysqli_error($connection)) .'.</p>
    <p>Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.</p>
    <ul>
      <li>Are you sure you have the correct database name?</li>
      <li>Are you sure the database exists?</li>
      <li>Are you sure the username has permission to access the database?</li>
    </ul>
    <p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');