- WordPress 6.9.4 (es_ES) with Kadence theme - Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto - Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold - Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI) - Plugins: Kadence Blocks, Polylang, Contact Form 7 - Custom CSS with full brand styling and responsive layout - HTTPS enforced via wp-config.php proxy detection
72 lines
1.9 KiB
PHP
72 lines
1.9 KiB
PHP
<?php declare( strict_types=1 );
|
|
|
|
namespace KadenceWP\KadenceBlocks\Optimizer\Database;
|
|
|
|
use KadenceWP\KadenceBlocks\StellarWP\DB\Database\Exceptions\DatabaseQueryException;
|
|
use KadenceWP\KadenceBlocks\StellarWP\Schema\Tables\Contracts\Table;
|
|
|
|
/**
|
|
* The optimizer database table to store optimizer data.
|
|
*/
|
|
final class Optimizer_Table extends Table {
|
|
|
|
public const SCHEMA_VERSION = '2.0.5';
|
|
|
|
/**
|
|
* @var string The base table name.
|
|
*/
|
|
protected static $base_table_name = 'kb_optimizer';
|
|
|
|
/**
|
|
* @var string The organizational group this table belongs to.
|
|
*/
|
|
protected static $group = 'kb';
|
|
|
|
/**
|
|
* @var string|null The slug used to identify the custom table.
|
|
*/
|
|
protected static $schema_slug = 'optimizer';
|
|
|
|
/**
|
|
* @var string The field that uniquely identifies a row in the table.
|
|
*/
|
|
protected static $uid_column = 'path_hash';
|
|
|
|
/**
|
|
* Overload the update method to first drop the database as this is a temporary table.
|
|
*
|
|
* @throws DatabaseQueryException If any of the queries fail.
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function update() {
|
|
try {
|
|
if ( $this->exists() ) {
|
|
$this->drop();
|
|
}
|
|
} catch ( \Throwable $e ) {
|
|
function_exists( 'error_log' ) && error_log( '[Kadence Blocks]: Unable to drop optimizer table during schema update: ' . $e->getMessage() );
|
|
return [];
|
|
}
|
|
|
|
return parent::update();
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected function get_definition(): string {
|
|
global $wpdb;
|
|
$table_name = self::table_name();
|
|
$charset_collate = $wpdb->get_charset_collate();
|
|
|
|
return "
|
|
CREATE TABLE `$table_name` (
|
|
path_hash CHAR(64) PRIMARY KEY COMMENT 'SHA-256 hash of the relative path of the URL used as a unique key for fast lookups',
|
|
path TEXT NOT NULL COMMENT 'The relative path of the URL, stored for reference and debugging',
|
|
analysis LONGTEXT NOT NULL COMMENT 'Serialized or JSON-encoded analysis data associated with the path'
|
|
) {$charset_collate};
|
|
";
|
|
}
|
|
}
|