public class ExtensionManager

class.extensionmanager.php #13

The ExtensionManager class is responsible for managing all extensions in Symphony. Extensions are stored on the file system in the EXTENSIONS folder. They are auto-discovered where the Extension class name is the same as it's folder name (excluding the extension prefix).

Methods

void __construct()

The constructor will populate the $_subscriptions variable from the tbl_extension and tbl_extensions_delegates tables.

static string __getClassName(string $name)

Given a name, returns the full class name of an Extension. Extension use an 'extension' prefix.

Parameters
  • $name stringThe extension handle

static string __getClassPath(string $name)

Finds an Extension by name by searching the EXTENSIONS folder and returns the path to the folder.

Parameters
  • $name stringThe extension folder

static string __getDriverPath(string $name)

Given a name, return the path to the driver of the Extension.

Parameters
  • $name stringThe extension folder

See Also
static void __getHandleFromFilename(mixed $filename)
static array about(string $name, boolean $rawXML)

This function will load an extension's meta information given the extension $name. Since Symphony 2.3, this function will look for an extension.meta.xml file inside the extension's folder. If this is not found, it will initialise the extension and invoke the about() function. By default this extension will return an associative array display the basic meta data about the given extension. If the $rawXML parameter is passed true, and the extension has a extension.meta.xml file, this function will return DOMDocument of the file.

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

  • $rawXML booleanIf passed as true, and is available, this function will return the DOMDocument of representation of the given extension's extension.meta.xml file. If the file is not available, the extension will return the normal about() results. By default this is false.

Returns

An associative array describing this extension

static void cleanupDatabase()

A utility function that is used by the ExtensionManager to ensure stray delegates are not in tbl_extensions_delegates. It is called when a new Delegate is added or removed.

static Extension create(string $name)

Creates an instance of a given class and returns it

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

static boolean disable(string $name)

Disabling an extension will prevent it from executing but retain all it's settings in the relevant tables. Symphony checks that an extension can be disabled using the canUninstallorDisable() before removing all delegate subscriptions from the database and calling the extension's disable() function.

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

See Also
static boolean enable(string $name)

Enabling an extension will re-register all it's delegates with Symphony. It will also install or update the extension if needs be by calling the extensions respective install and update methods. The enable method is of the extension object is finally called.

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

See Also
static array fetch(array $select, array $where, string $order_by)

This function will return an associative array of Extension information. The information returned is defined by the $select parameter, which will allow a developer to restrict what information is returned about the Extension. Optionally, $where (not implemented) and $order_by parameters allow a developer to further refine their query.

Parameters
  • $select array(optional) Accepts an array of keys to return from the listAll() method. If omitted, all keys will be returned.

  • $where array(optional) Not implemented.

  • $order_by string(optional) Allows a developer to return the extensions in a particular order. The syntax is the same as other fetch methods. If omitted this will return resources ordered by name.

Returns

An associative array of Extension information, formatted in the same way as the listAll() method.

static integer fetchExtensionID(string $name)

A convenience method that returns an extension ID from it's name.

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

static string fetchInstalledVersion(string $name)

A convenience method that returns an extension version from it's name.

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

static array fetchStatus(array $about)

Returns the status of an Extension given an associative array containing the Extension handle and version where the version is the file version, not the installed version. This function returns an array which may include a maximum of two statuses.

Parameters
  • $about arrayAn associative array of the extension meta data, typically returned by ExtensionManager::about(). At the very least this array needs handle and version keys.

Returns

An array of extension statuses, with the possible values being EXTENSION_ENABLED, EXTENSION_DISABLED, EXTENSION_REQUIRES_UPDATE or EXTENSION_NOT_INSTALLED. If an extension doesn't exist, EXTENSION_NOT_INSTALLED will be returned.

static Cacheable getCacheProvider(string $key, boolean $reuse)

This function will return the Cacheable object with the appropriate caching layer for the given $key. This $key should be stored in the Symphony configuration in the caching group with a reference to the class of the caching object. If the key is not found, this will return a default Cacheable object created with the MySQL driver.

Parameters
  • $key stringShould be a reference in the Configuration file to the Caching class

  • $reuse booleanBy default true, which will reuse an existing Cacheable object of $key if it exists. If false, a new instance will be generated.

static Extension getInstance(string $name)

This function returns an instance of an extension from it's name

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

static array getProvidersOf(string $type)

Return an array all the Provider objects supplied by extensions, optionally filtered by a given $type.

Parameters
  • $type stringThis will only return Providers of this type. If null, which is default, all providers will be returned.

Returns

An array of objects

static array listAll(string $filter)

Will return an associative array of all extensions and their about information

Parameters
  • $filter stringAllows a regular expression to be passed to return only extensions whose folders match the filter.

Returns

An associative array with the key being the extension folder and the value being the extension's about information

static array listInstalledHandles()

Returns an array of all the enabled extensions available

static null|void notifyMembers(string $delegate, string $page, array $context)

Given a delegate name, notify all extensions that have registered to that delegate to executing their callbacks with a $context array parameter that contains information about the current Symphony state.

Parameters
  • $delegate stringThe delegate name

  • $page stringThe current page namespace that this delegate operates in

  • $context arrayThe $context param is an associative array that at minimum will contain the current Administration class, the current page object and the delegate name. Other context information may be passed to this function when it is called. eg. array( 'parent' =>& $this->Parent, 'page' => $page, 'delegate' => $delegate );

static integer registerDelegates(string $name)

This functions registers an extensions delegates in tbl_extensions_delegates.

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

Returns

The Extension ID

static boolean removeDelegates(string $name)

This function will remove all delegate subscriptions for an extension given an extension's name. This triggers cleanupDatabase()

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

See Also
static boolean uninstall(string $name)

Uninstalling an extension will unregister all delegate subscriptions and remove all extension settings. Symphony checks that an extension can be uninstalled using the canUninstallorDisable() before calling the extension's uninstall() function. Alternatively, if this function is called because the extension described by $name cannot be found it's delegates and extension meta information will just be removed from the database.

Parameters
  • $name stringThe name of the Extension Class minus the extension prefix.

See Also

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details