wp-all-import
Last commit date
acc
3 weeks ago
actions
3 weeks ago
addon-api
3 weeks ago
classes
3 weeks ago
config
3 weeks ago
controllers
3 weeks ago
filters
3 weeks ago
helpers
3 weeks ago
i18n
3 weeks ago
libraries
3 weeks ago
models
3 weeks ago
shortcodes
11 years ago
src
3 weeks ago
static
3 weeks ago
vendor
3 months ago
views
3 weeks ago
banner-772x250.png
4 years ago
composer.json
3 weeks ago
composer.lock
3 weeks ago
plugin.php
3 weeks ago
readme.txt
3 weeks ago
schema.php
3 weeks ago
screenshot-1.png
11 years ago
screenshot-2.png
11 years ago
screenshot-3.png
11 years ago
screenshot-4.png
11 years ago
schema.php
120 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | /** |
| 4 | * Plugin database schema |
| 5 | * WARNING: |
| 6 | * dbDelta() doesn't like empty lines in schema string, so don't put them there; |
| 7 | * WPDB doesn't like NULL values so better not to have them in the tables; |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * The database character collate. |
| 12 | * @var string |
| 13 | * @global string |
| 14 | * @name $charset_collate |
| 15 | */ |
| 16 | $charset_collate = ''; |
| 17 | |
| 18 | // Declare these as global in case schema.php is included from a function. |
| 19 | global $wpdb, $plugin_queries; |
| 20 | |
| 21 | if (!empty($wpdb->charset)) { |
| 22 | $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
| 23 | } |
| 24 | if (!empty($wpdb->collate)) { |
| 25 | $charset_collate .= " COLLATE $wpdb->collate"; |
| 26 | } |
| 27 | |
| 28 | $table_prefix = PMXI_Plugin::getInstance()->getTablePrefix(); |
| 29 | |
| 30 | // phpcs:ignore PluginCheck.CodeAnalysis.Heredoc.NotAllowed,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 31 | $plugin_queries = <<<SCHEMA |
| 32 | CREATE TABLE {$table_prefix}templates ( |
| 33 | id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
| 34 | options LONGTEXT, |
| 35 | scheduled VARCHAR(64) NOT NULL DEFAULT '', |
| 36 | name VARCHAR(200) NOT NULL DEFAULT '', |
| 37 | title TEXT, |
| 38 | content LONGTEXT, |
| 39 | is_keep_linebreaks TINYINT(1) NOT NULL DEFAULT 0, |
| 40 | is_leave_html TINYINT(1) NOT NULL DEFAULT 0, |
| 41 | fix_characters TINYINT(1) NOT NULL DEFAULT 0, |
| 42 | meta LONGTEXT, |
| 43 | PRIMARY KEY (id) |
| 44 | ) $charset_collate; |
| 45 | CREATE TABLE {$table_prefix}imports ( |
| 46 | id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
| 47 | parent_import_id BIGINT(20) NOT NULL DEFAULT 0, |
| 48 | name TEXT, |
| 49 | friendly_name VARCHAR(255) NOT NULL DEFAULT '', |
| 50 | type VARCHAR(32) NOT NULL DEFAULT '', |
| 51 | feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '', |
| 52 | path TEXT, |
| 53 | xpath TEXT, |
| 54 | options LONGTEXT, |
| 55 | registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 56 | root_element VARCHAR(255) DEFAULT '', |
| 57 | processing BOOL NOT NULL DEFAULT 0, |
| 58 | executing BOOL NOT NULL DEFAULT 0, |
| 59 | triggered BOOL NOT NULL DEFAULT 0, |
| 60 | queue_chunk_number BIGINT(20) NOT NULL DEFAULT 0, |
| 61 | first_import TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 62 | count BIGINT(20) NOT NULL DEFAULT 0, |
| 63 | imported BIGINT(20) NOT NULL DEFAULT 0, |
| 64 | created BIGINT(20) NOT NULL DEFAULT 0, |
| 65 | updated BIGINT(20) NOT NULL DEFAULT 0, |
| 66 | skipped BIGINT(20) NOT NULL DEFAULT 0, |
| 67 | deleted BIGINT(20) NOT NULL DEFAULT 0, |
| 68 | changed_missing BIGINT(20) NOT NULL DEFAULT 0, |
| 69 | canceled BOOL NOT NULL DEFAULT 0, |
| 70 | canceled_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 71 | failed BOOL NOT NULL DEFAULT 0, |
| 72 | failed_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 73 | settings_update_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 74 | last_activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 75 | iteration BIGINT(20) NOT NULL DEFAULT 0, |
| 76 | PRIMARY KEY (id) |
| 77 | ) $charset_collate; |
| 78 | CREATE TABLE {$table_prefix}posts ( |
| 79 | id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
| 80 | post_id BIGINT(20) UNSIGNED NOT NULL, |
| 81 | import_id BIGINT(20) UNSIGNED NOT NULL, |
| 82 | unique_key TEXT, |
| 83 | product_key TEXT, |
| 84 | iteration BIGINT(20) NOT NULL DEFAULT 0, |
| 85 | specified BOOL NOT NULL DEFAULT 0, |
| 86 | PRIMARY KEY (id) |
| 87 | ) $charset_collate; |
| 88 | CREATE TABLE {$table_prefix}files ( |
| 89 | id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
| 90 | import_id BIGINT(20) UNSIGNED NOT NULL, |
| 91 | name TEXT, |
| 92 | path TEXT, |
| 93 | registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 94 | PRIMARY KEY (id) |
| 95 | ) $charset_collate; |
| 96 | CREATE TABLE {$table_prefix}images ( |
| 97 | id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
| 98 | attachment_id BIGINT(20) UNSIGNED NOT NULL, |
| 99 | image_url TEXT, |
| 100 | image_filename TEXT, |
| 101 | PRIMARY KEY (id) |
| 102 | ) $charset_collate; |
| 103 | CREATE TABLE {$table_prefix}history ( |
| 104 | id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
| 105 | import_id BIGINT(20) UNSIGNED NOT NULL, |
| 106 | type ENUM('manual','processing','trigger','continue', 'cli', '') NOT NULL DEFAULT '', |
| 107 | time_run TEXT, |
| 108 | date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 109 | summary TEXT, |
| 110 | PRIMARY KEY (id) |
| 111 | ) $charset_collate; |
| 112 | CREATE TABLE {$table_prefix}hash ( |
| 113 | hash BINARY(16) NOT NULL, |
| 114 | post_id BIGINT(20) UNSIGNED NOT NULL, |
| 115 | import_id SMALLINT(5) UNSIGNED NOT NULL, |
| 116 | post_type VARCHAR(32) NOT NULL DEFAULT '', |
| 117 | PRIMARY KEY (hash) |
| 118 | ) $charset_collate; |
| 119 | SCHEMA; |
| 120 |