Skip to content

Commit

Permalink
Converting "addon" to "plugin"
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhartless committed Aug 1, 2015
1 parent ac48526 commit 0ab17e9
Show file tree
Hide file tree
Showing 148 changed files with 714 additions and 949 deletions.
2 changes: 1 addition & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# When mod_rewrite is not available, we instruct a temporary redirect of
# the start page to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 302 ^(?!/(index\.php|index_dev\.php|app|addons|media|upgrade))(/(.*))$ /index.php$2
RedirectMatch 302 ^(?!/(index\.php|index_dev\.php|app|plugins|media|upgrade))(/(.*))$ /index.php$2
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
26 changes: 13 additions & 13 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class AppKernel extends Kernel
/**
* @var array
*/
private $addonBundles = array();
private $pluginBundles = array();

/**
* {@inheritdoc}
Expand Down Expand Up @@ -158,7 +158,7 @@ public function registerBundles()
}

//dynamically register Mautic Addon Bundles
$searchPath = dirname(__DIR__) . '/addons';
$searchPath = dirname(__DIR__) . '/plugins';
$finder = new \Symfony\Component\Finder\Finder();
$finder->files()
->followLinks()
Expand All @@ -169,7 +169,7 @@ public function registerBundles()
foreach ($finder as $file) {
$dirname = basename($file->getRelativePath());
$filename = substr($file->getFilename(), 0, -4);
$class = '\\MauticAddon' . '\\' . $dirname . '\\' . $filename;
$class = '\\MauticPlugin' . '\\' . $dirname . '\\' . $filename;
if (class_exists($class)) {
$bundles[] = new $class();
}
Expand Down Expand Up @@ -228,13 +228,13 @@ public function boot()
define('MAUTIC_TABLE_PREFIX', $prefix);
}

$registeredAddonBundles = $this->container->getParameter('mautic.addon.bundles');
$registeredPluginBundles = $this->container->getParameter('mautic.plugin.bundles');

$addonBundles = array();
$pluginBundles = array();
foreach ($this->getBundles() as $name => $bundle) {
if ($bundle instanceof \Mautic\AddonBundle\Bundle\AddonBundleBase) {
if ($bundle instanceof \Mautic\PluginBundle\Bundle\PluginBundleBase) {
//boot after it's been check to see if it's enabled
$addonBundles[$name] = $bundle;
$pluginBundles[$name] = $bundle;

//set the container for the addon helper
$bundle->setContainer($this->container);
Expand All @@ -250,14 +250,14 @@ public function boot()
$dispatcher = $factory->getDispatcher();

// It's only after we've booted that we have access to the container, so here is where we will check if addon bundles are enabled then deal with them accordingly
foreach ($addonBundles as $name => $bundle) {
foreach ($pluginBundles as $name => $bundle) {
if (!$bundle->isEnabled()) {
unset($this->bundles[$name]);
unset($this->bundleMap[$name]);

// remove listeners as well
if (isset($registeredAddonBundles[$name]['config']['services'])) {
foreach ($registeredAddonBundles[$name]['config']['services'] as $serviceGroup => $services) {
if (isset($registeredPluginBundles[$name]['config']['services'])) {
foreach ($registeredPluginBundles[$name]['config']['services'] as $serviceGroup => $services) {
foreach ($services as $serviceName => $details) {
if ($serviceGroup == 'events') {
$details['tag'] = 'kernel.event_subscriber';
Expand All @@ -283,14 +283,14 @@ public function boot()
}
}

unset($registeredAddonBundles[$name]);
unset($registeredPluginBundles[$name]);
} else {
// boot the bundle
$bundle->boot();
}
}

$this->addonBundles = $registeredAddonBundles;
$this->addonBundles = $registeredPluginBundles;

$this->booted = true;
}
Expand All @@ -300,7 +300,7 @@ public function boot()
*
* @return array
*/
public function getAddonBundles()
public function getPluginBundles()
{
return $this->addonBundles;
}
Expand Down
67 changes: 0 additions & 67 deletions app/bundles/AddonBundle/Bundle/AddonBundleBase.php

This file was deleted.

105 changes: 0 additions & 105 deletions app/bundles/AddonBundle/Config/config.php

This file was deleted.

Loading

0 comments on commit 0ab17e9

Please sign in to comment.