Blocks
2 months ago
Contracts
1 year ago
Database
1 month ago
Integrations
3 months ago
Libraries
3 months ago
Models
1 month ago
Seeds
1 year ago
Services
1 month ago
Support
1 month ago
config
1 month ago
lib
1 month ago
Activator.php
1 month ago
Attachment.php
4 months ago
Controller.php
1 year ago
Core.php
1 year ago
Deactivator.php
2 months ago
Factory.php
3 months ago
Files.php
1 year ago
Playlist.php
1 year ago
Plugin.php
1 month ago
Requirements.php
1 year ago
support.php
1 year ago
Activator.php
42 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin activation hook implementation. |
| 4 | * |
| 5 | * @package PrestoPlayer |
| 6 | */ |
| 7 | |
| 8 | namespace PrestoPlayer; |
| 9 | |
| 10 | use PrestoPlayer\Files; |
| 11 | use PrestoPlayer\Database\Migrations; |
| 12 | |
| 13 | /** |
| 14 | * Runs migrations and one-time setup tasks on plugin activation. |
| 15 | */ |
| 16 | class Activator { |
| 17 | |
| 18 | /** |
| 19 | * Activation callback. |
| 20 | * |
| 21 | * @return void |
| 22 | */ |
| 23 | public static function activate() { |
| 24 | // Run migrations. |
| 25 | Migrations::run(); |
| 26 | |
| 27 | // File stuff. |
| 28 | $activator = new Files(); |
| 29 | $activator->addPrivateFolder(); |
| 30 | |
| 31 | /** |
| 32 | * Reset rewrite rules to avoid go to permalinks page |
| 33 | * through deleting the database options to force WP to do it |
| 34 | * because of on activation not work well flush_rewrite_rules() |
| 35 | */ |
| 36 | delete_option( 'rewrite_rules' ); |
| 37 | |
| 38 | // Set transient for onboarding redirect on first activation. |
| 39 | set_transient( 'presto_player_activation_redirect', true, 30 ); |
| 40 | } |
| 41 | } |
| 42 |