Commit 72715324 authored by omega8cc's avatar omega8cc Committed by helmo

Drupal 8 compatibility.

parent ecede8f1
<?php
// $Id$
$new_url = drush_get_option('uri');
$old_url = drush_get_option('uri', 'site');
$new_url = d()->uri;
/**
* @deprecated in drush3 it's 'options', in drush 4 it's 'cli', drop
* 'options' when we drop drush3 support
*/
$context = drush_get_context('cli') ? 'cli' : 'options';
$old_url = drush_get_option('old_uri', $new_url, $context);
/**
* @file
......@@ -11,11 +16,21 @@ $old_url = drush_get_option('uri', 'site');
* directories.
*/
drush_log(
dt('Changed paths from sites/@old_url to sites/@new_url',
array('@old_url' => $old_url, '@new_url' => $new_url)));
if (db_table_exists('file_managed')) {
db_query("UPDATE {file_managed} SET uri = REPLACE(uri, :old, :new)", array(':old' => 'sites/default', ':new' => 'sites/$new_url'));
db_query("UPDATE {file_managed} SET uri = REPLACE(uri, :old, :new)", array(':old' => 'sites/$old_url', ':new' => 'sites/$new_url'));
}
if (db_table_exists('files')) {
db_query("UPDATE {files} SET filepath = REPLACE(filepath, :old, :new)", array(':old' => 'sites/$old_url', ':new' => 'sites/$new_url'));
db_query("UPDATE {files} SET filepath = REPLACE(filepath, :old, :new)", array(':old' => 'sites/default', ':new' => 'sites/$new_url'));
}
variable_set('file_public_path', "sites/$new_url/files");
variable_set('file_private_path', "sites/$new_url/private/files");
variable_set('file_temporary_path', "sites/$new_url/private/temp");
drush_log(
dt('Changed paths from sites/@old_url to sites/@new_url',
array('@old_url' => $old_url, '@new_url' => $new_url)));
......@@ -18,8 +18,8 @@ function install_send_welcome_mail($url, $account, $language, $client_email, $on
$from = variable_get('site_mail', ini_get('sendmail_from'));
$mail_params['variables'] = array(
'!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'), '!login_url' => $onetime,
'!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url), '!mailto' => $account->mail,
'!date' => format_date(time()), '!login_uri' => url('user', array('absolute' => TRUE)),
'!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url), '!mailto' => $account->mail,
'!date' => format_date(time()), '!login_uri' => url('user', array('absolute' => TRUE)),
'!edit_uri' => url('user/'. $account->uid .'/edit', array('absolute' => TRUE)));
$mail_success = drupal_mail('install', 'welcome-admin', $account->mail, user_preferred_language($account), $mail_params, $from, TRUE);
......@@ -43,7 +43,7 @@ function install_mail($key, &$message, $params) {
require_once "./profiles/$profile/provision_welcome_mail.inc";
$custom = TRUE;
}
elseif (file_exists(dirname(__FILE__) . '/../provision_welcome_mail.inc')) {
elseif (file_exists(dirname(__FILE__) . '/../provision_welcome_mail.inc')) {
/** use the module provided welcome email
* We can not use drupal_get_path here,
* as we are connected to the provisioned site's database
......@@ -75,7 +75,7 @@ function install_main() {
$client_email = drush_get_option('client_email');
require_once DRUPAL_ROOT . '/includes/install.core.inc';
require_once DRUPAL_ROOT . '/core/includes/install.core.inc';
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);
......
......@@ -349,8 +349,12 @@ function _provision_drupal_rebuild_caches() {
* Find available profiles on this platform.
*/
function _provision_find_profiles() {
include_once('includes/install.inc');
if (drush_drupal_major_version() >= 8) {
include_once('core/includes/install.inc');
}
else {
include_once('includes/install.inc');
}
if (!$dir = opendir("./profiles")) {
drush_log(dt("Cannot find profiles directory"), 'error');
return FALSE;
......@@ -665,6 +669,8 @@ function _provision_drupal_search_paths($scope, $key = '', $type = 'modules') {
switch ($scope) {
case 'base' :
$searchpaths[] = sprintf("%s/%s", $drupal_root, $type);
$searchpaths[] = sprintf("%s/core/%s", $drupal_root, $type);
$searchpaths[] = sprintf("%s/sites/all/%s", $drupal_root, $type);
break;
default :
if ($key) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment