[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.216.126.33: ~ $
<?php

namespace MailPoet\Doctrine;

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


use MailPoet\Config\Env;
use MailPoet\Doctrine\Types\BigIntType;
use MailPoet\Doctrine\Types\JsonOrSerializedType;
use MailPoet\Doctrine\Types\JsonType;
use MailPoet\Doctrine\Types\SerializedArrayType;
use MailPoet\Doctrine\Types\DateTimeTzToStringType;
use MailPoetVendor\Doctrine\DBAL\DriverManager;
use MailPoetVendor\Doctrine\DBAL\Driver\PDO\MySQL\Driver;
use MailPoetVendor\Doctrine\DBAL\Platforms\MySqlPlatform;
use MailPoetVendor\Doctrine\DBAL\Types\Type;
use PDO;

class ConnectionFactory {
  const DRIVER = 'pdo_mysql';
  const PLATFORM_CLASS = MySqlPlatform::class;

  private $minWaitTimeout = 60;

  private $types = [
    BigIntType::NAME => BigIntType::class,
    DateTimeTzToStringType::NAME => DateTimeTzToStringType::class,
    JsonType::NAME => JsonType::class,
    JsonOrSerializedType::NAME => JsonOrSerializedType::class,
    SerializedArrayType::NAME => SerializedArrayType::class,
  ];

  public function createConnection() {
    global $wpdb;
    $platformClass = self::PLATFORM_CLASS;
    $connectionParams = [
      'wrapperClass' => SerializableConnection::class,
      'driver' => self::DRIVER,
      'driverClass' => Driver::class,
      'platform' => new $platformClass,
      'user' => Env::$dbUsername,
      'password' => Env::$dbPassword,
      'dbname' => Env::$dbName,
      'driverOptions' => $this->getDriverOptions(Env::$dbTimezoneOffset, Env::$dbCharset, Env::$dbCollation),
    ];

    if (!empty(Env::$dbCharset)) {
      $connectionParams['charset'] = Env::$dbCharset;
    }

    if (!empty(Env::$dbSocket)) {
      $connectionParams['unix_socket'] = Env::$dbSocket;
    } else {
      $connectionParams['host'] = Env::$dbIsIpv6 ? ('[' . Env::$dbHost . ']') : Env::$dbHost;
      if (!empty(Env::$dbPort)) {
        $connectionParams['port'] = Env::$dbPort;
      } else {
        $connectionParams['port'] = $wpdb->get_var('SELECT @@port');
      }
    }

    $this->setupTypes();
    return DriverManager::getConnection($connectionParams);
  }

  private function getDriverOptions($timezoneOffset, $charset, $collation) {
    $driverOptions = [
      "@@session.time_zone = '$timezoneOffset'",
      "@@session.sql_mode = REPLACE(
        REPLACE(@@sql_mode, 'ONLY_FULL_GROUP_BY', ''),
        'ANSI_QUOTES', ''
        )", // This is needed because ONLY_FULL_GROUP_BY mode in MariaDB is much more restrictive than in MySQL
      // We need to use CONVERT for MySQL 8, Maria DB bug which triggers #1232 - Incorrect argument type to variable 'wait_timeout`
      // https://stackoverflow.com/questions/35187378/mariadb-type-error-when-setting-session-variable
      "@@session.wait_timeout = GREATEST(CONVERT(COALESCE(@@wait_timeout, 0), SIGNED), $this->minWaitTimeout)",
    ];

    if (!empty(Env::$dbCharset)) {
      $driverOptions[] = "NAMES $charset" . (empty($collation) ? '' : " COLLATE $collation");
    }

    return [
      PDO::MYSQL_ATTR_INIT_COMMAND => 'SET ' . implode(', ', $driverOptions),
    ];
  }

  private function setupTypes() {
    foreach ($this->types as $name => $class) {
      if (Type::hasType($name)) {
        Type::overrideType($name, $class);
      } else {
        Type::addType($name, $class);
      }
    }
  }
}

Filemanager

Name Type Size Permission Actions
Annotations Folder 0755
EntityTraits Folder 0755
EventListeners Folder 0755
Types Folder 0755
Validator Folder 0755
ConfigurationFactory.php File 2.84 KB 0644
ConnectionFactory.php File 3.19 KB 0644
EntityManagerFactory.php File 2.5 KB 0644
MetadataCache.php File 2.8 KB 0644
PSRCacheInvalidArgumentException.php File 225 B 0644
PSRCacheItem.php File 1010 B 0644
PSRMetadataCache.php File 2.23 KB 0644
ProxyClassNameResolver.php File 1.02 KB 0644
Repository.php File 2.62 KB 0644
SerializableConnection.php File 937 B 0644
TablePrefixMetadataFactory.php File 2.46 KB 0644
index.php File 0 B 0644