PluginsInstallLogger.php
53 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\WooCommerce\Admin\PluginsInstallLoggers; |
| 4 | |
| 5 | /** |
| 6 | * A logger used in PluginsHelper::install_plugins to log the installation progress. |
| 7 | */ |
| 8 | interface PluginsInstallLogger { |
| 9 | |
| 10 | /** |
| 11 | * Called when a plugin install requested. |
| 12 | * |
| 13 | * @param string $plugin_name plugin name. |
| 14 | * @return mixed |
| 15 | */ |
| 16 | public function install_requested( string $plugin_name ); |
| 17 | |
| 18 | /** |
| 19 | * Called when a plugin installed successfully. |
| 20 | * |
| 21 | * @param string $plugin_name plugin name. |
| 22 | * @param int $duration # of seconds it took to install $plugin_name. |
| 23 | * @return mixed |
| 24 | */ |
| 25 | public function installed( string $plugin_name, int $duration); |
| 26 | |
| 27 | /** |
| 28 | * Called when a plugin activated successfully. |
| 29 | * |
| 30 | * @param string $plugin_name plugin name. |
| 31 | * @return mixed |
| 32 | */ |
| 33 | public function activated( string $plugin_name ); |
| 34 | |
| 35 | /** |
| 36 | * Called when an error occurred while installing a plugin. |
| 37 | * |
| 38 | * @param string $plugin_name plugin name. |
| 39 | * @param string|null $error_message error message. |
| 40 | * @return mixed |
| 41 | */ |
| 42 | public function add_error( string $plugin_name, ?string $error_message = null); |
| 43 | |
| 44 | /** |
| 45 | * Called when all plugins are processed. |
| 46 | * |
| 47 | * @param array $data return data from install_plugins(). |
| 48 | * @return mixed |
| 49 | */ |
| 50 | public function complete( $data = array() ); |
| 51 | } |
| 52 | |
| 53 |