Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
229
Merge Requests
229
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
f191e197
Commit
f191e197
authored
Nov 24, 2006
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added database checks.
parent
1c4c2d84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
includes/bootstrap.inc
includes/bootstrap.inc
+21
-5
includes/install.inc
includes/install.inc
+1
-1
No files found.
includes/bootstrap.inc
View file @
f191e197
...
...
@@ -192,6 +192,18 @@ function conf_init() {
* theme, etc.). The filename, whether provided, cached, or retrieved
* from the database, is only returned if the file exists.
*
* This function plays a key role in allowing Drupal's resources (modules
* and themes) to be located in different places depending on a site's
* configuration. For example, a module 'foo' may legally be be located
* in any of these three places:
*
* modules/foo/foo.module
* sites/all/modules/foo/foo.module
* sites/example.com/modules/foo/foo.module
*
* Calling drupal_get_filename('module', 'foo') will give you one of
* the above, depending on where the module is located.
*
* @param $type
* The type of the item (i.e. theme, theme_engine, module).
* @param $name
...
...
@@ -199,15 +211,13 @@ function conf_init() {
* @param $filename
* The filename of the item if it is to be set explicitly rather
* than by consulting the database.
* @param $check_db
* Allows the database search to be skipped (useful for pre-bootstrap
* checks where configuration paths must still be respected).
*
* @return
* The filename of the requested item.
*/
function
drupal_get_filename
(
$type
,
$name
,
$filename
=
NULL
,
$check_db
=
TRUE
)
{
function
drupal_get_filename
(
$type
,
$name
,
$filename
=
NULL
)
{
static
$files
=
array
();
global
$active_db
;
if
(
!
isset
(
$files
[
$type
]))
{
$files
[
$type
]
=
array
();
...
...
@@ -219,10 +229,16 @@ function drupal_get_filename($type, $name, $filename = NULL, $check_db = TRUE) {
elseif
(
isset
(
$files
[
$type
][
$name
]))
{
// nothing
}
elseif
(
$check_db
&&
((
$file
=
db_result
(
db_query
(
"SELECT filename FROM
{
system
}
WHERE name = '%s' AND type = '%s'"
,
$name
,
$type
)))
&&
file_exists
(
$file
)))
{
// Verify that we have an active database connection, before querying
// the database. This is required because this function is called both
// before we have a database connection (i.e. during installation) and
// when a database connection fails.
elseif
(
$active_db
&&
((
$file
=
db_result
(
db_query
(
"SELECT filename FROM
{
system
}
WHERE name = '%s' AND type = '%s'"
,
$name
,
$type
)))
&&
file_exists
(
$file
)))
{
$files
[
$type
][
$name
]
=
$file
;
}
else
{
// Fallback to searching the filesystem if the database connection is
// not established or the requested file is not found.
$config
=
conf_path
();
$dir
=
((
$type
==
'theme_engine'
)
?
'themes/engines'
:
"${type}s"
);
$file
=
((
$type
==
'theme_engine'
)
?
"
$name
.engine"
:
"
$name
.
$type
"
);
...
...
includes/install.inc
View file @
f191e197
...
...
@@ -306,7 +306,7 @@ function drupal_install_profile($profile, $module_list) {
// installed, so we can't use the normal installation function.
$module_list
=
array_diff
(
$module_list
,
array
(
'system'
));
$system_path
=
dirname
(
drupal_get_filename
(
'module'
,
'system'
,
NULL
,
FALSE
));
$system_path
=
dirname
(
drupal_get_filename
(
'module'
,
'system'
,
NULL
));
require_once
'./'
.
$system_path
.
'/system.install'
;
module_invoke
(
'system'
,
'install'
);
$system_versions
=
drupal_get_schema_versions
(
'system'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment