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
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP\Queries; |
| 4 | |
| 5 | use IAWP\Capability_Manager; |
| 6 | use IAWP\Migrations; |
| 7 | |
| 8 | class Reset_Database |
| 9 | { |
| 10 | public function __construct() |
| 11 | { |
| 12 | $this->delete_all_iawp_options(); |
| 13 | Capability_Manager::reset_capabilities(); |
| 14 | Migrations\Migration::create_or_migrate(); |
| 15 | } |
| 16 | |
| 17 | private function delete_all_iawp_options() |
| 18 | { |
| 19 | global $wpdb; |
| 20 | $prefix = 'iawp_'; |
| 21 | $options = $wpdb->get_results("SELECT * FROM $wpdb->options WHERE option_name LIKE '$prefix%'"); |
| 22 | |
| 23 | foreach ($options as $option) { |
| 24 | $name = $option->option_name; |
| 25 | delete_option($name); |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 |