Skip to content

Commit

Permalink
Backdrop 1.10.1! This version of Backdrop adds new features like comm…
Browse files Browse the repository at this point in the history
…ent auto-closing, inline file uploading, content scheduling, and translation improvements. See https://backdropcms.org/news/backdrop-1-10-released for more info. Running update.php is required after this update.
  • Loading branch information
quicksketch committed May 30, 2018
2 parents b785030 + 00e845e commit a30e924
Show file tree
Hide file tree
Showing 265 changed files with 4,029 additions and 3,936 deletions.
12 changes: 5 additions & 7 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ DirectoryIndex index.php index.html index.htm
<IfModule mod_rewrite.c>
RewriteEngine on

# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]

# Make sure Authorization HTTP header is available to PHP
# even when running as CGI or FastCGI.
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
Expand All @@ -80,6 +73,11 @@ DirectoryIndex index.php index.html index.htm
RewriteCond %{REQUEST_URI} !^/\.well-known
RewriteRule "(^|/)\." - [F]

# To redirect all users to access the site using a SSL/https certificate,
# uncomment the following:
# RewriteCond %{HTTPS} !=on
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
Expand Down
2 changes: 1 addition & 1 deletion core/includes/ajax.inc
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ function ajax_prepare_response($page_callback_result) {
break;

case MENU_SITE_OFFLINE:
$commands[] = ajax_command_alert(filter_xss_admin(t(config_get('system.core', 'maintenance_mode_message'), array('@site' => config_get('system.core', 'site_name')))));
$commands[] = ajax_command_alert(filter_xss_admin(token_replace(t(config_get('system.core', 'maintenance_mode_message')))));
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions core/includes/bootstrap.classes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function backdrop_class_list() {
'BackdropNullCache' => $path . 'cache.inc',
'BackdropDatabaseCache' => $path . 'cache.inc',
'BackdropCacheInterface' => $path . 'cache.inc',
'BackdropDateTime' => $path . 'date.class.inc',
'Color' => $path . 'color.inc',
'Diff' => $path . 'diff.inc',
'DiffOp' => $path . 'diff.inc',
Expand Down
2 changes: 1 addition & 1 deletion core/includes/bootstrap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* The current system version.
*/
define('BACKDROP_VERSION', '1.9.6');
define('BACKDROP_VERSION', '1.10.1');

/**
* Core API compatibility.
Expand Down
54 changes: 44 additions & 10 deletions core/includes/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2988,7 +2988,7 @@ function backdrop_deliver_html_page($page_callback_result) {
// Print a 503 page.
backdrop_add_http_header('Status', '503 Service unavailable');
backdrop_set_title(t('Site under maintenance'));
print theme('maintenance_page', array('content' => filter_xss_admin(t(config_get('system.core', 'maintenance_mode_message'), array('@site' => config_get('system.core', 'site_name'))))));
print theme('maintenance_page', array('content' => filter_xss_admin(token_replace(t(config_get('system.core', 'maintenance_mode_message'))))));
break;
}
}
Expand Down Expand Up @@ -5751,6 +5751,7 @@ function _backdrop_bootstrap_full() {
}
$called = TRUE;
require_once BACKDROP_ROOT . '/' . settings_get('path_inc', 'core/includes/path.inc');
require_once BACKDROP_ROOT . '/core/includes/date.inc';
require_once BACKDROP_ROOT . '/core/includes/theme.inc';
require_once BACKDROP_ROOT . '/core/includes/pager.inc';
require_once BACKDROP_ROOT . '/' . settings_get('menu_inc', 'core/includes/menu.inc');
Expand Down Expand Up @@ -8455,7 +8456,7 @@ function backdrop_parse_dependency($dependency) {
$parts = explode('(', $dependency, 2);
$value['name'] = trim($parts[0]);
if (isset($parts[1])) {
$value['original_version'] = ' (' . $parts[1];
$value['original_version'] = '(' . $parts[1];
foreach (explode(',', $parts[1]) as $version) {
if (preg_match("/^\s*$p_op\s*$p_core$p_major\.$p_minor/", $version, $matches)) {
$op = !empty($matches['operation']) ? $matches['operation'] : '=';
Expand Down Expand Up @@ -8485,29 +8486,62 @@ function backdrop_parse_dependency($dependency) {
/**
* Checks whether a version is compatible with a given dependency.
*
* @param $v
* @param array $dependency_info
* The parsed dependency structure from backdrop_parse_dependency().
* @param $current_version
* The version to check against (like 4.2).
* @param string $current_version
* The version to check against (like 4.2 or 1.10.0-beta4).
*
* @return string|NULL
* NULL if compatible, otherwise the original dependency version string that
* caused the incompatibility.
*
* @see backdrop_parse_dependency()
*/
function backdrop_check_incompatibility($v, $current_version) {
if (!empty($v['versions'])) {
foreach ($v['versions'] as $required_version) {
if ((isset($required_version['op']) && !version_compare($current_version, $required_version['version'], $required_version['op']))) {
return $v['original_version'];
function backdrop_check_incompatibility(array $dependency_info, $current_version) {
$current_version = _backdrop_version_compare_convert($current_version);
if (!empty($dependency_info['versions'])) {
foreach ($dependency_info['versions'] as $required_version) {
if ((isset($required_version['op']) && !version_compare($current_version, _backdrop_version_compare_convert($required_version['version']), $required_version['op']))) {
return $dependency_info['original_version'];
}
}
}
// No incompatibilities.
return NULL;
}

/**
* Converts a Backdrop version string into numeric-only version string.
*
* @param string $version_string
* A version string such as 1.10.0-beta4 or 1.4.x-dev.
* @return string
* A converted string only containing numbers, for use in PHP's
* version_compare() function.
*/
function _backdrop_version_compare_convert($version_string) {
// Convert "dev" releases to be the highest possible version number. For
// example 1.5.x-dev should be considered higher than any other 1.5 release,
// so we replace .x with 99999.
$version_string = str_replace('.x-dev', '.99999', $version_string);

// Replace common indicators with numeric equivalents for version_compare().
$indicator_order = array(
1 => 'alpha',
2 => 'beta',
3 => 'preview',
4 => 'rc',
);
foreach ($indicator_order as $order => $indicator) {
// Replace both before and after the indicator with dots, so that multiple
// alphas, betas, etc. would be ordered properly. For example, version
// 1.5.0-beta9 and 1.5.0-beta10 would become 1.5.0.2.9 and 1.5.0.2.10.
$version_string = str_replace('-' . $indicator, '.' . $order . '.', $version_string);
$version_string .= substr($version_string, -1) === '.' ? '0' : '';
}
return $version_string;
}

/**
* Retrieves a list of all available archivers.
*
Expand Down
15 changes: 15 additions & 0 deletions core/includes/database/database.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,16 @@ abstract class DatabaseConnection extends PDO {
*/
abstract public function databaseType();

/**
* Creates a database.
*
* In order to use this method, you must be connected without a database
* specified.
*
* @param string $database
* The name of the database to create.
*/
abstract public function createDatabase($database);

/**
* Gets any special processing requirements for the condition operator.
Expand Down Expand Up @@ -1869,6 +1879,11 @@ class DatabaseTransactionExplicitCommitNotAllowedException extends Exception { }
*/
class DatabaseTransactionOutOfOrderException extends Exception { }

/**
* Exception thrown when the specified database cannot be found.
*/
class DatabaseNotFoundException extends Exception { }

/**
* Exception thrown for merge queries that do not make semantic sense.
*
Expand Down
24 changes: 22 additions & 2 deletions core/includes/database/mysql/database.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/

class DatabaseConnection_mysql extends DatabaseConnection {

/**
* Flag to indicate if the cleanup function in __destruct() should run.
*
Expand Down Expand Up @@ -53,7 +52,9 @@ class DatabaseConnection_mysql extends DatabaseConnection {
// set when escaping. This has security implications. See
// https://www.drupal.org/node/1201452 for further discussion.
$dsn .= ';charset=' . $charset;
$dsn .= ';dbname=' . $connection_options['database'];
if (!empty($connection_options['database'])) {
$dsn .= ';dbname=' . $connection_options['database'];
}
// Allow PDO options to be overridden.
$connection_options += array(
'pdo' => array(),
Expand Down Expand Up @@ -127,6 +128,25 @@ class DatabaseConnection_mysql extends DatabaseConnection {
return 'mysql';
}

/**
* Overrides DatabaseConnection::createDatabase().
*
* @param string $database
* The name of the database to create.
*
* @throws DatabaseNotFoundException
*/
public function createDatabase($database) {
try {
// Create the database and set it as active.
$this->exec("CREATE DATABASE IF NOT EXISTS $database");
$this->exec("USE $database");
}
catch (\Exception $e) {
throw new DatabaseNotFoundException($e->getMessage());
}
}

public function mapConditionOperator($operator) {
// We don't want to override any of the defaults.
return NULL;
Expand Down
14 changes: 14 additions & 0 deletions core/includes/database/mysql/install.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ class DatabaseTasks_mysql extends DatabaseTasks {
*/
protected $pdoDriver = 'mysql';

/**
* Error code for "Unknown database" error.
*
* @var int
*/
protected $databaseNotFoundErrorCode = 1049;

/**
* Error code for "Unknown database" error.
*
* @var int
*/
protected $connectionRefusedErrorCode = 2002;

/**
* Returns a human-readable name string for MySQL and equivalent databases.
*/
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions core/includes/form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2998,13 +2998,19 @@ function form_process_password_confirm($element) {
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
'#required' => $element['#required'],
'#attributes' => array('class' => array('password-field')),
'#password_strength' => TRUE,
'#password_shown' => FALSE,
'#password_toggle' => FALSE,
);
$element['pass2'] = array(
'#type' => 'password',
'#title' => t('Confirm new password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
'#required' => $element['#required'],
'#attributes' => array('class' => array('password-confirm')),
'#password_strength' => FALSE,
'#password_shown' => FALSE,
'#password_toggle' => FALSE,
);
$element['#element_validate'] = array('password_confirm_validate');
$element['#tree'] = TRUE;
Expand Down
16 changes: 9 additions & 7 deletions core/includes/install.core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -982,17 +982,16 @@ function install_settings_form($form, &$form_state, &$install_state) {

// Add driver specific configuration options.
$form['driver']['#options']['mysql'] = $driver->name();

$form['settings']['mysql'] = $driver->getFormOptions($database);
$form['settings']['mysql']['#prefix'] = '<h2 class="js-hide">' . st('@driver_name settings', array('@driver_name' => $driver->name())) . '</h2>';
$form['settings']['mysql']['#type'] = 'container';
$form['settings']['mysql']['#tree'] = TRUE;
$form['settings']['mysql']['advanced_options']['#parents'] = array('mysql');
$form['settings']['mysql']['#states'] = array(
'visible' => array(
':input[name=driver]' => array('value' => 'mysql'),
)
);
// For this exceptional situation, maintain the database password even on
// form validation errors.
if (isset($form_state['input']['mysql']['password'])) {
$form['settings']['mysql']['password']['#attributes']['value'] = $form_state['input']['mysql']['password'];
}

$form['actions'] = array('#type' => 'actions');
$form['actions']['save'] = array(
Expand Down Expand Up @@ -1857,9 +1856,12 @@ function _install_configure_form($form, &$form_state, &$install_state) {
'#weight' => -5,
);
$form['admin_account']['account']['pass'] = array(
'#type' => 'password_confirm',
'#title' => st('Password'),
'#type' => 'password',
'#required' => TRUE,
'#weight' => 0,
'#password_toggle' => TRUE,
'#password_strength' => TRUE,
);

$form['server_settings'] = array(
Expand Down
Loading

0 comments on commit a30e924

Please sign in to comment.