Campaigns.php
3 years ago
City_Statistics.php
3 years ago
Country_Statistics.php
3 years ago
Current_Traffic_Finder.php
3 years ago
Interval.php
3 years ago
Minute_Interval.php
3 years ago
Range_Query.php
3 years ago
Referrers.php
3 years ago
Reset_Database.php
3 years ago
Resources.php
3 years ago
Ten_Second_Interval.php
3 years ago
View.php
3 years ago
Views.php
3 years ago
Visitors_Over_Time_Finder.php
3 years ago
Reset_Database.php
26 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\IAWP\Queries; |
| 4 | |
| 5 | use IAWP_SCOPED\IAWP\Capability_Manager; |
| 6 | use IAWP_SCOPED\IAWP\Migrations; |
| 7 | class Reset_Database |
| 8 | { |
| 9 | public function __construct() |
| 10 | { |
| 11 | $this->delete_all_iawp_options(); |
| 12 | Capability_Manager::reset_capabilities(); |
| 13 | Migrations\Migration::create_or_migrate(); |
| 14 | } |
| 15 | private function delete_all_iawp_options() |
| 16 | { |
| 17 | global $wpdb; |
| 18 | $prefix = 'iawp_'; |
| 19 | $options = $wpdb->get_results("SELECT * FROM {$wpdb->options} WHERE option_name LIKE '{$prefix}%'"); |
| 20 | foreach ($options as $option) { |
| 21 | $name = $option->option_name; |
| 22 | \delete_option($name); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 |