Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
L
libraries
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
0
Merge Requests
0
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
libraries
Commits
5f8df5fe
Commit
5f8df5fe
authored
Nov 03, 2010
by
Tobias Stoeckler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#919632
by tstoeckler, sun: Allow library information to be stored in info files.
parent
30b84515
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
30 deletions
+22
-30
CHANGELOG.txt
CHANGELOG.txt
+1
-0
libraries.module
libraries.module
+16
-12
tests/example/example_info_file.libraries.info
tests/example/example_info_file.libraries.info
+5
-0
tests/libraries_info_example/libraries_info_example.info
tests/libraries_info_example/libraries_info_example.info
+0
-12
tests/libraries_info_example/libraries_info_example.module
tests/libraries_info_example/libraries_info_example.module
+0
-6
No files found.
CHANGELOG.txt
View file @
5f8df5fe
...
...
@@ -6,6 +6,7 @@ Libraries x.x-x.x, xxxx-xx-xx
Libraries 7.x-1.x, xxxx-xx-xx
-----------------------------
#919632 by tstoeckler, sun: Allow library information to be stored in info files.
by sun: Fixed testbot breaks upon directory name/info file name mismatch.
#864376 by tstoeckler, sun: Code-cleanup, allow hard-coded 'version'.
#939174 by sun, tstoeckler: Rename example.info to libraries_example.info.
...
...
libraries.module
View file @
5f8df5fe
...
...
@@ -126,7 +126,7 @@ function libraries_get_libraries() {
* An array of info files, keyed by library name. The values are the paths of
* the files.
*/
function
libraries_info_files
()
{
function
libraries_
scan_
info_files
()
{
global
$profile
;
if
(
!
isset
(
$profile
))
{
$profile
=
variable_get
(
'install_profile'
,
'default'
);
...
...
@@ -136,21 +136,24 @@ function libraries_info_files() {
// Build a list of directories.
$directories
=
module_invoke_all
(
'libraries_info_file_paths'
);
$directories
[]
=
'libraries'
;
$directories
[]
=
"
librari
es/
$profile
/libraries"
;
$directories
[]
=
"
profil
es/
$profile
/libraries"
;
$directories
[]
=
'sites/all/libraries'
;
$directories
[]
=
"
sites/
$config
/libraries"
;
$directories
[]
=
"
$config
/libraries"
;
// Scan for info files.
$files
=
array
();
foreach
(
$directories
as
$dir
)
{
$files
+=
file_scan_directory
(
$dir
,
'/[a-z[a-z0-9_]+.info/'
,
array
(
'key'
=>
'name'
,
'recurse'
=>
FALSE
,
));
if
(
file_exists
(
$dir
))
{
$files
=
array_merge
(
$files
,
file_scan_directory
(
$dir
,
'@^[a-z0-9._-]+\.libraries\.info$@'
,
array
(
'key'
=>
'name'
,
'recurse'
=>
FALSE
,
)));
}
}
foreach
(
$files
as
&
$file
)
{
$file
=
$file
->
uri
;
foreach
(
$files
as
$name
=>
$file
)
{
$files
[
basename
(
$name
,
'.libraries'
)]
=
$file
;
unset
(
$files
[
$name
]);
}
return
$files
;
...
...
@@ -187,9 +190,10 @@ function libraries_info($library = NULL) {
}
}
// Gather information from .info files.
foreach
(
libraries_info_files
()
as
$name
=>
$path
)
{
$file
=
"
$path
/
$name
.info"
;
$libraries
[
$name
]
=
drupal_parse_info_file
(
$file
);
foreach
(
libraries_scan_info_files
()
as
$name
=>
$file
)
{
$properties
=
drupal_parse_info_file
(
$file
->
uri
);
$properties
[
'info file'
]
=
$file
->
uri
;
$libraries
[
$name
]
=
$properties
;
}
// Provide defaults.
...
...
tests/example/example_info_file.libraries.info
0 → 100644
View file @
5f8df5fe
; $Id$
; This is an example info file of a library used for testing purposes.
name = Example info file
tests/libraries_info_example/libraries_info_example.info
deleted
100644 → 0
View file @
30b84515
; $Id$
; This is an example info file of a library used for testing purposes.
; Do not declare name manually. It is set automatically.
name = example_info_file
title = Example info file
; Because Drupal thinks this is a module's .info file, it is in the 'libraries'
; namespace, in order to not cause problems with other modules named 'example'.
; Also, we need to hide this "module" from the modules page.
hidden = TRUE
tests/libraries_info_example/libraries_info_example.module
deleted
100644 → 0
View file @
30b84515
<?php
// $Id$
// Testbot gets confused and breaks when encountering an .info file without
// .module file. Until the testbot is corrected, we need to resolve this by
// supplying a fake .module file for the libraries_example.info library.
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