Project

General

Profile

Revision b0dc3a2e

Added by Julien Enselme over 7 years ago

Update to Drupal 7.52

View differences:

drupal7/modules/system/system.install
196 196
    );
197 197
  }
198 198

  
199
  // Test database-specific multi-byte UTF-8 related requirements.
200
  $charset_requirements = _system_check_db_utf8mb4_requirements($phase);
201
  if (!empty($charset_requirements)) {
202
    $requirements['database_charset'] = $charset_requirements;
203
  }
204

  
199 205
  // Test PHP memory_limit
200 206
  $memory_limit = ini_get('memory_limit');
201 207
  $requirements['php_memory_limit'] = array(
......
517 523
  return $requirements;
518 524
}
519 525

  
526
/**
527
 * Checks whether the requirements for multi-byte UTF-8 support are met.
528
 *
529
 * @param string $phase
530
 *   The hook_requirements() stage.
531
 *
532
 * @return array
533
 *   A requirements array with the result of the charset check.
534
 */
535
function _system_check_db_utf8mb4_requirements($phase) {
536
  global $install_state;
537
  // In the requirements check of the installer, skip the utf8mb4 check unless
538
  // the database connection info has been preconfigured by hand with valid
539
  // information before running the installer, as otherwise we cannot get a
540
  // valid database connection object.
541
  if (isset($install_state['settings_verified']) && !$install_state['settings_verified']) {
542
    return array();
543
  }
544

  
545
  $connection = Database::getConnection();
546
  $t = get_t();
547
  $requirements['title'] = $t('Database 4 byte UTF-8 support');
548

  
549
  $utf8mb4_configurable = $connection->utf8mb4IsConfigurable();
550
  $utf8mb4_active = $connection->utf8mb4IsActive();
551
  $utf8mb4_supported = $connection->utf8mb4IsSupported();
552
  $driver = $connection->driver();
553
  $documentation_url = 'https://www.drupal.org/node/2754539';
554

  
555
  if ($utf8mb4_active) {
556
    if ($utf8mb4_supported) {
557
      if ($phase != 'install' && $utf8mb4_configurable && !variable_get('drupal_all_databases_are_utf8mb4', FALSE)) {
558
        // Supported, active, and configurable, but not all database tables
559
        // have been converted yet.
560
        $requirements['value'] = $t('Enabled, but database tables need conversion');
561
        $requirements['description'] = $t('Please convert all database tables to utf8mb4 prior to enabling it in settings.php. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@url' => $documentation_url));
562
        $requirements['severity'] = REQUIREMENT_ERROR;
563
      }
564
      else {
565
        // Supported, active.
566
        $requirements['value'] = $t('Enabled');
567
        $requirements['description'] = $t('4 byte UTF-8 for @driver is enabled.', array('@driver' => $driver));
568
        $requirements['severity'] = REQUIREMENT_OK;
569
      }
570
    }
571
    else {
572
      // Not supported, active.
573
      $requirements['value'] = $t('Not supported');
574
      $requirements['description'] = $t('4 byte UTF-8 for @driver is activated, but not supported on your system. Please turn this off in settings.php, or ensure that all database-related requirements are met. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@driver' => $driver, '@url' => $documentation_url));
575
      $requirements['severity'] = REQUIREMENT_ERROR;
576
    }
577
  }
578
  else {
579
    if ($utf8mb4_supported) {
580
      // Supported, not active.
581
      $requirements['value'] = $t('Not enabled');
582
      $requirements['description'] = $t('4 byte UTF-8 for @driver is not activated, but it is supported on your system. It is recommended that you enable this to allow 4-byte UTF-8 input such as emojis, Asian symbols and mathematical symbols to be stored correctly. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@driver' => $driver, '@url' => $documentation_url));
583
      $requirements['severity'] = REQUIREMENT_INFO;
584
    }
585
    else {
586
      // Not supported, not active.
587
      $requirements['value'] = $t('Disabled');
588
      $requirements['description'] = $t('4 byte UTF-8 for @driver is disabled. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@driver' => $driver, '@url' => $documentation_url));
589
      $requirements['severity'] = REQUIREMENT_INFO;
590
    }
591
  }
592
  return $requirements;
593
}
594

  
520 595
/**
521 596
 * Implements hook_install().
522 597
 */
......
532 607
  module_list(TRUE);
533 608
  module_implements('', FALSE, TRUE);
534 609

  
610
  // Ensure the schema versions are not based on a previous module list.
611
  drupal_static_reset('drupal_get_schema_versions');
612

  
535 613
  // Load system theme data appropriately.
536 614
  system_rebuild_theme_data();
537 615

  
......
3192 3270
  db_change_field('date_format_locale', 'format', 'format', $spec);
3193 3271
}
3194 3272

  
3273
/**
3274
 * Remove the Drupal 6 default install profile if it is still in the database.
3275
 */
3276
function system_update_7081() {
3277
  // Sites which used the default install profile in Drupal 6 and then updated
3278
  // to Drupal 7.44 or earlier will still have a record of this install profile
3279
  // in the database that needs to be deleted.
3280
  db_delete('system')
3281
    ->condition('filename', 'profiles/default/default.profile')
3282
    ->condition('type', 'module')
3283
    ->condition('status', 0)
3284
    ->condition('schema_version', 0)
3285
    ->execute();
3286
}
3287

  
3195 3288
/**
3196 3289
 * @} End of "defgroup updates-7.x-extra".
3197 3290
 * The next series of updates should start at 8000.

Also available in: Unified diff