PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.7.7
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.7.7
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / database / Migrations / MediaArchiveMigrator.php

MediaArchiveMigrator.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 2.7.7, at database/Migrations/MediaArchiveMigrator.php

55 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable
3 namespace FluentCommunity\Database\Migrations;
4
5 class MediaArchiveMigrator
6 {
7 /**
8 * Migrate the table.
9 *
10 * @return void
11 */
12 public static function migrate()
13 {
14 global $wpdb;
15
16 $charsetCollate = $wpdb->get_charset_collate();
17
18 $table = $wpdb->prefix . 'fcom_media_archive';
19 $indexPrefix = $wpdb->prefix . 'fcom_mar_';
20
21 if ($wpdb->get_var("SHOW TABLES LIKE '$table'") != $table) {
22 $sql = "CREATE TABLE $table (
23 `id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
24 `object_source` VARCHAR(100) NOT NULL,
25 `media_key` VARCHAR(100) NOT NULL,
26 `user_id` BIGINT NULL,
27 `feed_id` BIGINT NULL,
28 `is_active` TINYINT(1) DEFAULT 0,
29 `sub_object_id` BIGINT NULL,
30 `media_type` VARCHAR(192) NULL,
31 `driver` VARCHAR(192) NULL DEFAULT 'local',
32 `media_path` TEXT NULL,
33 `media_url` TEXT NULL,
34 `settings` TEXT NULL,
35 `created_at` TIMESTAMP NULL,
36 `updated_at` TIMESTAMP NULL,
37 INDEX `{$indexPrefix}_mt_is_active` (`is_active`),
38 INDEX `{$indexPrefix}_mto_user_id` (`user_id`),
39 INDEX `{$indexPrefix}_mto_media_key` (`media_key`),
40 INDEX `{$indexPrefix}_mto_feed_id` (`feed_id`),
41 INDEX `{$indexPrefix}obj_src_active` (`object_source`, `is_active`, `id`)
42 ) $charsetCollate;";
43 dbDelta($sql);
44 } else {
45 $galleryIndexName = $indexPrefix . 'obj_src_active';
46 $galleryIndexExists = $wpdb->get_var(
47 $wpdb->prepare("SHOW INDEX FROM {$table} WHERE Key_name = %s", $galleryIndexName) // phpcs:ignore WordPress.DB.DirectDatabaseQuery
48 );
49 if (!$galleryIndexExists) {
50 $wpdb->query("ALTER TABLE {$table} ADD INDEX `{$galleryIndexName}` (`object_source`, `is_active`, `id`)"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
51 }
52 }
53 }
54 }
55