PHP 8.0.30
Preview: DatabaseTable.php Size: 1013 B
/home/certprox/template.certproxywizard.com/wp-content/plugins/hostinger-reach/src/Admin/Database/DatabaseTable.php

<?php

namespace Hostinger\Reach\Admin\Database;

use wpdb;

if ( ! defined( 'ABSPATH' ) ) {
    die;
}

abstract class DatabaseTable implements DatabaseInterface {
    private wpdb $wpdb;
    private string $prefix = 'hostinger_reach_';
    protected string $table_name;

    public function __construct( wpdb $wpdb ) {
        $this->wpdb = $wpdb;
    }

    public function create(): void {
        $charset_collate = $this->wpdb->get_charset_collate();
        $schema          = implode( ",\n", $this->schema() );
        $table           = $this->table_name();

        $sql = "CREATE TABLE $table (\n$schema\n) $charset_collate;";

        $this->execute_db_delta( $sql );
    }

    public function table_name(): string {
        return $this->wpdb->prefix . $this->prefix . $this->table_name;
    }

    abstract public function schema(): array;

    public function execute_db_delta( string $sql ): void {
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta( $sql );
    }
}

Directory Contents

Dirs: 0 × Files: 5

Name Size Perms Modified Actions
765 B lrw-r--r-- 2026-06-10 16:30:29
Edit Download
441 B lrw-r--r-- 2026-06-10 16:30:29
Edit Download
300 B lrw-r--r-- 2026-06-10 16:30:29
Edit Download
1013 B lrw-r--r-- 2026-06-10 16:30:29
Edit Download
745 B lrw-r--r-- 2026-06-10 16:30:29
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).