- md5
- b7604e9c05d9c6312a04ef77d52ef2c4
- sha1
- c0da3818cc109be4e30f7e952517aaa70fcd2058
- sha256
- 848d3091f877f793578885cf7288878b3b0e20e376ca3f5266b32c3990193dbe
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
<?php
/**
* @package Joomla.Plugin
* @subpackage Extension.Joomla
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Installer\Installer as JInstaller;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\DispatcherInterface;
/**
* Joomla! namespace map creator / updater.
*
* @since 4.0.0
*/
class PlgExtensionNamespacemap extends CMSPlugin
{
/**
* The namespace map file creator
*
* @var JNamespacePsr4Map
*/
private $fileCreator = null;
/**
* Constructor
*
* @param DispatcherInterface &$subject The object to observe
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'group', 'params', 'language'
* (this list is not meant to be comprehensive).
*
* @since 4.0.0
*/
public function __construct(&$subject, $config = array())
{
$this->fileCreator = new JNamespacePsr4Map;
parent::__construct($subject, $config);
}
/**
* Update / Create map on extension install
*
* @param JInstaller $installer Installer instance
* @param integer $eid Extension id
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterInstall($installer, $eid)
{
// Check that we have a valid extension
if ($eid)
{
// Update / Create new map
$this->fileCreator->create();
}
}
/**
* Update / Create map on extension uninstall
*
* @param JInstaller $installer Installer instance
* @param integer $eid Extension id
* @param boolean $removed Installation result
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterUninstall($installer, $eid, $removed)
{
// Check that we have a valid extension and that it has been removed
if ($eid && $removed)
{
// Update / Create new map
$this->fileCreator->create();
}
}
/**
* Update map on extension update
*
* @param JInstaller $installer Installer instance
* @param integer $eid Extension id
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterUpdate($installer, $eid)
{
// Check that we have a valid extension
if ($eid)
{
// Update / Create new map
$this->fileCreator->create();
}
}
}
The same content is in 23 releases, Joomla 4.0.0-rc1 to 4.1.0-beta2. See them all, or every version of this file.