PluginProbe
Easy Quotes / trunk
Easy Quotes vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 All 28 releases
easy-quotes / includes / fonts-database.php

fonts-database.php in Easy Quotes trunk, at includes/fonts-database.php

59 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly.
4 if (!defined('ABSPATH')) {
5 exit;
6 }
7
8 class Easy_Quotes_Fonts_Database
9 {
10 private $tablenames = [];
11
12 public function __construct()
13 {
14 global $wpdb;
15 $this->tablenames[0] = $wpdb->prefix . 'easy-quotes-categories';
16 $this->tablenames[1] = $wpdb->prefix . 'easy-quotes-families';
17 $this->tablenames[2] = $wpdb->prefix . 'easy-quotes-variants';
18 $this->tablenames[3] = $wpdb->prefix . 'easy-quotes-files';
19 $this->tablenames[4] = $wpdb->prefix . 'easy-quotes-subsets';
20 $this->tablenames[5] = $wpdb->prefix . 'easy-quotes-family-subsets';
21 }
22
23 /**
24 * Drop all font tables (cleanup method)
25 *
26 * @return void
27 */
28 public function dropTables()
29 {
30 global $wpdb;
31 // Drop in reverse order due to foreign key constraints
32 for ($i = 5; $i >= 0; $i--) {
33 $wpdb->query("DROP TABLE IF EXISTS `" . $this->tablenames[$i] . "`;");
34 }
35
36 // Also remove the database version option
37 delete_option('easy-quotes-db-version');
38 }
39
40 /**
41 * Check if legacy tables exist (helper method)
42 *
43 * @return bool true if any legacy tables exist
44 */
45 public function legacyTablesExist()
46 {
47 global $wpdb;
48
49 foreach ($this->tablenames as $tablename) {
50 $table_exists = $wpdb->get_var("SHOW TABLES LIKE '$tablename'");
51 if ($table_exists) {
52 return true;
53 }
54 }
55
56 return false;
57 }
58 }
59