PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.9
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.9
8.0.5 8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 All 47 releases
gamipress / includes / admin / upgrades / 1.8.7.php

1.8.7.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 7.9.9, at includes/admin/upgrades/1.8.7.php

82 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * 1.8.7 Upgrades
4 *
5 * @package GamiPress\Admin\Upgrades\1.8.7
6 * @since 1.8.7
7 */
8 // Exit if accessed directly
9 if( !defined( 'ABSPATH' ) ) exit;
10
11 /**
12 * Return 1.8.7 as last required upgrade
13 *
14 * @return string
15 */
16 function gamipress_187_is_last_required_upgrade() {
17
18 return '1.8.7';
19
20 }
21 add_filter( 'gamipress_get_last_required_upgrade', 'gamipress_187_is_last_required_upgrade', 187 );
22
23 /**
24 * Process 1.8.7 upgrades
25 *
26 * @param string $stored_version
27 *
28 * @return string
29 */
30 function gamipress_187_upgrades( $stored_version ) {
31
32 // Already upgrade
33 if ( version_compare( $stored_version, '1.8.7', '>=' ) ) {
34 return $stored_version;
35 }
36
37 // Ensure that GamiPress tables have been created
38 if( gamipress_database_table_exists( GamiPress()->db->logs ) ) {
39 // Process 1.8.7 upgrade
40 gamipress_process_187_upgrade();
41
42 // There is nothing to update, so upgrade
43 $stored_version = '1.8.7';
44 }
45
46 return $stored_version;
47
48 }
49 add_filter( 'gamipress_process_upgrades', 'gamipress_187_upgrades', 187 );
50
51 /**
52 * Process 1.8.7 upgrades
53 */
54 function gamipress_process_187_upgrade() {
55
56 global $wpdb;
57
58 ignore_user_abort( true );
59 set_time_limit( 0 );
60
61 // Bail if GamiPress tables haven't been created yet
62 if( ! gamipress_database_table_exists( GamiPress()->db->logs ) ) {
63 return;
64 }
65
66 // Setup tables to update
67 $tables = array(
68 GamiPress()->db->logs,
69 GamiPress()->db->logs_meta,
70 GamiPress()->db->user_earnings,
71 GamiPress()->db->user_earnings_meta,
72 );
73
74 foreach( $tables as $table ) {
75 // Alter table to use InnoDB
76 $wpdb->query( "ALTER TABLE {$table} ENGINE = InnoDB;" );
77 }
78
79 // Updated stored version
80 update_option( 'gamipress_version', '1.8.7' );
81
82 }