Commit 091d0927 authored by webchick's avatar webchick

Issue #2325689 by sun: Clean up temporary Extension class workarounds.

parent 7e7c7154
......@@ -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
*/
public $type;
protected $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.
......
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