| Server IP : 121.121.20.254 / Your IP : 216.73.216.145 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/excellentvege/wp-content/plugins/wp-coder/classes/Update/ |
Upload File : |
<?php
namespace WPCoder\Update;
use WPCoder\WPCoder;
class UpdateDB {
const NEW_DB_VERSION = '3.6';
const TABLE_COLUMNS = "
id mediumint(9) NOT NULL AUTO_INCREMENT,
title VARCHAR(200) NOT NULL,
html_code LONGTEXT,
css_code LONGTEXT,
js_code LONGTEXT,
php_code LONGTEXT,
param LONGTEXT,
status BOOLEAN,
mode BOOLEAN,
tag TEXT,
php_include int(11) NOT NULL DEFAULT '0',
UNIQUE KEY id (id),
INDEX id_index (id)
";
public static function init(): void {
$current_db_version = get_option( WPCoder::PREFIX . '_db_version' );
if ( $current_db_version && version_compare( $current_db_version, self::NEW_DB_VERSION, '>=' ) ) {
return;
}
self::start_update();
update_option( WPCoder::PREFIX . '_db_version', self::NEW_DB_VERSION );
}
private static function start_update(): void {
self::update_database();
}
private static function update_database(): void {
global $wpdb;
$table = $wpdb->prefix . WPCoder::PREFIX;
$charset_collate = $wpdb->get_charset_collate();
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$sql = "CREATE TABLE $table (" . self::TABLE_COLUMNS . ") $charset_collate;";
dbDelta( $sql );
}
}