Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3174996
Commits
6575a26c
Commit
6575a26c
authored
16 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#231298
by Crell and rednahead: Allow for aliased multi-site support.
parent
fecf236c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.txt
+2
-0
2 additions, 0 deletions
CHANGELOG.txt
includes/bootstrap.inc
+35
-1
35 additions, 1 deletion
includes/bootstrap.inc
with
37 additions
and
1 deletion
CHANGELOG.txt
+
2
−
0
View file @
6575a26c
...
...
@@ -62,6 +62,8 @@ Drupal 7.0, xxxx-xx-xx (development version)
uploading a site logo--that don't require the overhead of databases and
hooks, the current unmanaged copy, move and delete operations have been
preserved but renamed to file_unmanaged_*().
- Added aliased multi-site support:
* Added support for mapping domain names to sites directories.
Drupal 6.0, 2008-02-13
----------------------
...
...
This diff is collapsed.
Click to expand it.
includes/bootstrap.inc
+
35
−
1
View file @
6575a26c
...
...
@@ -292,6 +292,30 @@ function timer_stop($name) {
*
* 13. $confdir/default
*
* If a file named sites.php is present in the $confdir, it will be loaded
* prior to scanning for directories. It should define an associative array
* named $sites, which maps domains to directories. It should be in the form
* of:
*
* $sites = array(
* 'The url to alias' => 'A directory within the sites directory'
* );
*
* For example:
*
* $sites = array(
* 'devexample.com' => 'example.com',
* 'localhost/example' => 'example.com',
* );
*
* The above array will cause Drupal to look for a directory named
* "example.com" in the sites directory whenever a request comes from
* "example.com", "devexample.com", or "localhost/example". That is useful
* on development servers, where the domain name may not be the same as the
* domain of the live server. Since Drupal stores file paths into the database
* (files, system table, etc.) this will ensure the paths are correct while
* accessed on development servers.
*
* @param $require_settings
* Only configuration directories with an existing settings.php file
* will be recognized. Defaults to TRUE. During initial installation,
...
...
@@ -311,12 +335,22 @@ function conf_path($require_settings = TRUE, $reset = FALSE) {
}
$confdir
=
'sites'
;
$sites
=
array
();
if
(
file_exists
(
DRUPAL_ROOT
.
'/'
.
$confdir
.
'/sites.php'
))
{
// This will overwrite $sites with the desired mappings.
include
(
DRUPAL_ROOT
.
'/'
.
$confdir
.
'/sites.php'
);
}
$uri
=
explode
(
'/'
,
$_SERVER
[
'SCRIPT_NAME'
]
?
$_SERVER
[
'SCRIPT_NAME'
]
:
$_SERVER
[
'SCRIPT_FILENAME'
]);
$server
=
explode
(
'.'
,
implode
(
'.'
,
array_reverse
(
explode
(
':'
,
rtrim
(
$_SERVER
[
'HTTP_HOST'
],
'.'
)))));
for
(
$i
=
count
(
$uri
)
-
1
;
$i
>
0
;
$i
--
)
{
for
(
$j
=
count
(
$server
);
$j
>
0
;
$j
--
)
{
$dir
=
implode
(
'.'
,
array_slice
(
$server
,
-
$j
))
.
implode
(
'.'
,
array_slice
(
$uri
,
0
,
$i
));
if
(
file_exists
(
"
$confdir
/
$dir
/settings.php"
)
||
(
!
$require_settings
&&
file_exists
(
"
$confdir
/
$dir
"
)))
{
if
(
isset
(
$sites
[
$dir
])
&&
file_exists
(
DRUPAL_ROOT
.
'/'
.
$confdir
.
'/'
.
$sites
[
$dir
]))
{
$dir
=
$sites
[
$dir
];
}
if
(
file_exists
(
DRUPAL_ROOT
.
'/'
.
$confdir
.
'/'
.
$dir
.
'/settings.php'
)
||
(
!
$require_settings
&&
file_exists
(
DRUPAL_ROOT
.
'/'
.
$confdir
.
'/'
.
$dir
)))
{
$conf
=
"
$confdir
/
$dir
"
;
return
$conf
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment