403Webshell
Server IP : 172.67.158.161  /  Your IP : 3.137.223.255
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Migrator/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Migrator/DbMigration.php
<?php declare(strict_types = 1);

namespace MailPoet\Migrator;

if (!defined('ABSPATH')) exit;


use MailPoet\Config\Env;
use MailPoet\DI\ContainerWrapper;
use MailPoetVendor\Doctrine\DBAL\Connection;
use MailPoetVendor\Doctrine\ORM\EntityManager;

abstract class DbMigration {
  /** @var Connection */
  protected $connection;

  /** @var EntityManager */
  private $entityManager;

  public function __construct(
    ContainerWrapper $container
  ) {
    $this->connection = $container->get(Connection::class);
    $this->entityManager = $container->get(EntityManager::class);
  }

  abstract public function run(): void;

  protected function getTableName(string $entityClass): string {
    return $this->entityManager->getClassMetadata($entityClass)->getTableName();
  }

  protected function createTable(string $tableName, array $attributes): void {
    $prefix = Env::$dbPrefix;
    $charsetCollate = Env::$dbCharsetCollate;
    $sql = implode(",\n", $attributes);
    $this->connection->executeStatement("
      CREATE TABLE IF NOT EXISTS {$prefix}{$tableName} (
        $sql
      ) {$charsetCollate};
    ");
  }

  protected function columnExists(string $tableName, string $columnName): bool {
    // We had a problem with the dbName value in ENV for some customers, because it doesn't match DB name in information schema.
    // So we decided to use the DATABASE() value instead.
    return $this->connection->executeQuery("
      SELECT 1
      FROM information_schema.columns
      WHERE table_schema = COALESCE(DATABASE(), ?)
      AND table_name = ?
      AND column_name = ?
    ", [Env::$dbName, $tableName, $columnName])->fetchOne() !== false;
  }

  protected function indexExists(string $tableName, string $indexName): bool {
    // We had a problem with the dbName value in ENV for some customers, because it doesn't match DB name in information schema.
    // So we decided to use the DATABASE() value instead.
    return $this->connection->executeQuery("
      SELECT 1
      FROM information_schema.statistics
      WHERE table_schema = COALESCE(DATABASE(), ?)
      AND table_name = ?
      AND index_name = ?
    ", [Env::$dbName, $tableName, $indexName])->fetchOne() !== false;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit