AJAX
3 years ago
Date_Range
3 years ago
Interval
3 years ago
Menu_Bar_Stats
3 years ago
Migrations
3 years ago
Models
3 years ago
Queries
3 years ago
Statistics
3 years ago
Tables
3 years ago
Utils
3 years ago
Campaign_Builder.php
3 years ago
Capability_Manager.php
3 years ago
Chart.php
3 years ago
Chart_Geo.php
3 years ago
Chart_SVG.php
3 years ago
Dashboard_Options.php
3 years ago
Dashboard_Widget.php
3 years ago
Email_Reports.php
3 years ago
Filters.php
3 years ago
Geo_Database.php
3 years ago
Geo_Database_Download_Job.php
3 years ago
Health_Check.php
3 years ago
Illuminate_Builder.php
3 years ago
Independent_Analytics.php
3 years ago
Known_Referrers.php
3 years ago
PDF.php
3 years ago
Query.php
3 years ago
Quick_Stats.php
3 years ago
REST_API.php
3 years ago
Real_Time.php
3 years ago
Reset_Database.php
3 years ago
Resource_Identifier.php
3 years ago
Settings.php
3 years ago
Sort_Configuration.php
3 years ago
Track_Resource_Changes.php
3 years ago
View.php
3 years ago
View_Counter.php
3 years ago
WP_Option_Cache_Bust.php
3 years ago
WooCommerce_Order.php
3 years ago
Reset_Database.php
26 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\IAWP; |
| 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 |