Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
091d0927
Commit
091d0927
authored
Aug 25, 2014
by
webchick
Browse files
Issue
#2325689
by sun: Clean up temporary Extension class workarounds.
parent
7e7c7154
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Extension/Extension.php
View file @
091d0927
...
...
@@ -15,11 +15,9 @@ class Extension implements \Serializable {
/**
* The type of the extension (e.g., 'module').
*
* @todo Change to protected once external test dependencies are resolved.
*
* @var string
*/
p
ublic
$type
;
p
rotected
$type
;
/**
* The relative pathname of the extension (e.g., 'core/modules/node/node.info.yml').
...
...
@@ -28,42 +26,12 @@ class Extension implements \Serializable {
*/
protected
$pathname
;
/**
* The internal name of the extension (e.g., 'node').
*
* @todo Remove this property once external test dependencies are resolved.
*
* @var string
*/
public
$name
;
/**
* The relative pathname of the main extension file (e.g., 'core/modules/node/node.module').
*
* @todo Remove this property and do not require .module/.profile files.
* @see https://drupal.org/node/340723
*
* @var string
*/
public
$uri
;
/**
* Same as $uri.
*
* @todo Remove this property once external test dependencies are resolved.
*
* @var string
*/
public
$filename
;
/**
* The filename of the main extension file (e.g., 'node.module').
*
* @todo Rename to $filename once external test dependencies are resolved.
*
* @var string|null
*/
protected
$
_
filename
;
protected
$filename
;
/**
* An SplFileInfo instance for the extension's info file.
...
...
@@ -88,11 +56,7 @@ class Extension implements \Serializable {
public
function
__construct
(
$type
,
$pathname
,
$filename
=
NULL
)
{
$this
->
type
=
$type
;
$this
->
pathname
=
$pathname
;
$this
->
_filename
=
$filename
;
// Set legacy public properties.
$this
->
name
=
$this
->
getName
();
$this
->
uri
=
$this
->
getPath
()
.
'/'
.
$filename
;
$this
->
filename
=
$this
->
uri
;
$this
->
filename
=
$filename
;
}
/**
...
...
@@ -146,8 +110,8 @@ public function getFilename() {
* @return string|null
*/
public
function
getExtensionPathname
()
{
if
(
$this
->
_
filename
)
{
return
$this
->
getPath
()
.
'/'
.
$this
->
_
filename
;
if
(
$this
->
filename
)
{
return
$this
->
getPath
()
.
'/'
.
$this
->
filename
;
}
}
...
...
@@ -157,7 +121,7 @@ public function getExtensionPathname() {
* @return string|null
*/
public
function
getExtensionFilename
()
{
return
$this
->
_
filename
;
return
$this
->
filename
;
}
/**
...
...
@@ -167,8 +131,8 @@ public function getExtensionFilename() {
* TRUE if this extension has a main extension file, FALSE otherwise.
*/
public
function
load
()
{
if
(
$this
->
_
filename
)
{
include_once
DRUPAL_ROOT
.
'/'
.
$this
->
getPath
()
.
'/'
.
$this
->
_
filename
;
if
(
$this
->
filename
)
{
include_once
DRUPAL_ROOT
.
'/'
.
$this
->
getPath
()
.
'/'
.
$this
->
filename
;
return
TRUE
;
}
return
FALSE
;
...
...
@@ -195,7 +159,7 @@ public function serialize() {
$data
=
array
(
'type'
=>
$this
->
type
,
'pathname'
=>
$this
->
pathname
,
'
_
filename'
=>
$this
->
_
filename
,
'filename'
=>
$this
->
filename
,
);
// @todo ThemeHandler::listInfo(), ThemeHandler::rebuildThemeData(), and
...
...
@@ -215,14 +179,7 @@ public function unserialize($data) {
$data
=
unserialize
(
$data
);
$this
->
type
=
$data
[
'type'
];
$this
->
pathname
=
$data
[
'pathname'
];
$this
->
_filename
=
$data
[
'_filename'
];
// Restore legacy public properties.
// @todo Remove these properties and do not require .module/.profile files.
// @see https://drupal.org/node/340723
$this
->
name
=
$this
->
getName
();
$this
->
uri
=
$this
->
getPath
()
.
'/'
.
$this
->
_filename
;
$this
->
filename
=
$this
->
uri
;
$this
->
filename
=
$data
[
'filename'
];
// @todo ThemeHandler::listInfo(), ThemeHandler::rebuildThemeData(), and
// system_list() are adding custom properties to the Extension object.
...
...
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