PluginProbe
Auto Alt Text / trunk
Auto Alt Text vtrunk
3.0.3 2.8.2 1.3.1 1.3.2 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.7.0 2.8.0 2.8.1 All 28 releases
auto-alt-text / src / App / Core / PluginLifecycle.php

PluginLifecycle.php in Auto Alt Text trunk, at src/App/Core/PluginLifecycle.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AATXT\App\Core;
4
5 use AATXT\App\Infrastructure\Database\ErrorLogSchema;
6
7 /**
8 * Handles plugin lifecycle events (activation/deactivation).
9 *
10 * This class follows the Single Responsibility Principle by handling
11 * only lifecycle-related operations like database schema management.
12 */
13 final class PluginLifecycle
14 {
15 /**
16 * Database schema manager for error logs table
17 *
18 * @var ErrorLogSchema
19 */
20 private $schema;
21
22 /**
23 * Constructor
24 *
25 * @param ErrorLogSchema $schema Database schema manager
26 */
27 public function __construct(ErrorLogSchema $schema)
28 {
29 $this->schema = $schema;
30 }
31
32 /**
33 * Handle plugin activation.
34 *
35 * Creates necessary database tables.
36 *
37 * @return void
38 */
39 public function activate(): void
40 {
41 $this->schema->create();
42 }
43
44 /**
45 * Handle plugin deactivation.
46 *
47 * Drops database tables created by the plugin.
48 *
49 * @return void
50 */
51 public function deactivate(): void
52 {
53 $this->schema->drop();
54 }
55 }
56