| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Database hook for activation |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace IvyForms\Services\InstallActions; |
| 8 |
|
| 9 |
// phpcs:disable PSR1.Files.SideEffects |
| 10 |
if (!defined('ABSPATH')) { |
| 11 |
exit; // Exit if accessed directly |
| 12 |
} |
| 13 |
|
| 14 |
use IvyForms\Common\Exceptions\InvalidArgumentException; |
| 15 |
use IvyForms\Services\InstallActions\DB\Confirmation\ConfirmationsTable; |
| 16 |
use IvyForms\Services\InstallActions\DB\Entry\EntriesTable; |
| 17 |
use IvyForms\Services\InstallActions\DB\EntryField\EntryFieldsTable; |
| 18 |
use IvyForms\Services\InstallActions\DB\Field\FieldsTable; |
| 19 |
use IvyForms\Services\InstallActions\DB\Form\FormsTable; |
| 20 |
use IvyForms\Services\InstallActions\DB\Notification\NotificationsTable; |
| 21 |
use IvyForms\Services\InstallActions\DB\FieldOptions\FieldOptionsTable; |
| 22 |
use IvyForms\Services\InstallActions\Migrations\AddRowColumnLayoutToFields; |
| 23 |
use IvyForms\Services\InstallActions\Migrations\SeedRowIndexForFields; |
| 24 |
use IvyForms\Services\InstallActions\Migrations\AddReplyToToNotifications; |
| 25 |
|
| 26 |
/** |
| 27 |
* Class ActivationHook |
| 28 |
* |
| 29 |
* @package IvyForms\Services\InstallActions |
| 30 |
*/ |
| 31 |
class ActivationDatabaseHook |
| 32 |
{ |
| 33 |
/** |
| 34 |
* Initialize the plugin |
| 35 |
* @throws InvalidArgumentException |
| 36 |
*/ |
| 37 |
public static function init(): void |
| 38 |
{ |
| 39 |
FormsTable::init(); |
| 40 |
FieldsTable::init(); |
| 41 |
NotificationsTable::init(); |
| 42 |
ConfirmationsTable::init(); |
| 43 |
EntriesTable::init(); |
| 44 |
EntryFieldsTable::init(); |
| 45 |
FieldOptionsTable::init(); |
| 46 |
|
| 47 |
// Run migrations |
| 48 |
AddRowColumnLayoutToFields::run(); |
| 49 |
SeedRowIndexForFields::run(); |
| 50 |
AddReplyToToNotifications::run(); |
| 51 |
} |
| 52 |
} |
| 53 |
|