Factory.php
67 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Matomo - free/libre analytics platform |
| 5 | * |
| 6 | * @link https://matomo.org |
| 7 | * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 8 | */ |
| 9 | namespace Piwik\Updater\Migration\Plugin; |
| 10 | |
| 11 | use Piwik\Container\StaticContainer; |
| 12 | /** |
| 13 | * Provides plugin migrations. |
| 14 | * |
| 15 | * @api |
| 16 | */ |
| 17 | class Factory |
| 18 | { |
| 19 | /** |
| 20 | * @var \Piwik\Container\Container |
| 21 | */ |
| 22 | private $container; |
| 23 | /** |
| 24 | * @ignore |
| 25 | */ |
| 26 | public function __construct() |
| 27 | { |
| 28 | $this->container = StaticContainer::getContainer(); |
| 29 | } |
| 30 | /** |
| 31 | * Activates the given plugin during an update. |
| 32 | * |
| 33 | * If the plugin is already activated or if any other error occurs it will be ignored. |
| 34 | * |
| 35 | * @param string $pluginName |
| 36 | * @return Activate |
| 37 | */ |
| 38 | public function activate($pluginName) |
| 39 | { |
| 40 | return $this->container->make('Piwik\\Updater\\Migration\\Plugin\\Activate', array('pluginName' => $pluginName)); |
| 41 | } |
| 42 | /** |
| 43 | * Deactivates the given plugin during an update. |
| 44 | * |
| 45 | * If the plugin is already deactivated or if any other error occurs it will be ignored. |
| 46 | * |
| 47 | * @param string $pluginName |
| 48 | * @return Deactivate |
| 49 | */ |
| 50 | public function deactivate($pluginName) |
| 51 | { |
| 52 | return $this->container->make('Piwik\\Updater\\Migration\\Plugin\\Deactivate', array('pluginName' => $pluginName)); |
| 53 | } |
| 54 | /** |
| 55 | * Uninstalls the given plugin during an update. |
| 56 | * |
| 57 | * If the plugin is still active or if any other error occurs it will be ignored. |
| 58 | * |
| 59 | * @param string $pluginName |
| 60 | * @return Uninstall |
| 61 | */ |
| 62 | public function uninstall($pluginName) |
| 63 | { |
| 64 | return $this->container->make('Piwik\\Updater\\Migration\\Plugin\\Uninstall', array('pluginName' => $pluginName)); |
| 65 | } |
| 66 | } |
| 67 |