ltsecurityinc安防产品在线商城代码
This commit is contained in:
+88
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_GeoIPLookup
|
||||
* @copyright Copyright (c) 2024 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\GeoIPLookup\Setup\Patch\Schema;
|
||||
|
||||
use Magento\Framework\App\ResourceConnection;
|
||||
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
|
||||
use Magento\Framework\Setup\SchemaSetupInterface;
|
||||
use PDO;
|
||||
|
||||
class RemoveDeprecatedIpTablesFromDatabase implements SchemaPatchInterface
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\Setup\SchemaSetupInterface
|
||||
*/
|
||||
private $schemaSetup;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\DB\Adapter\AdapterInterface
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Setup\SchemaSetupInterface $schemaSetup
|
||||
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
|
||||
*/
|
||||
public function __construct(
|
||||
SchemaSetupInterface $schemaSetup,
|
||||
ResourceConnection $resourceConnection
|
||||
) {
|
||||
$this->schemaSetup = $schemaSetup;
|
||||
$this->connection = $resourceConnection->getConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function apply(): RemoveDeprecatedIpTablesFromDatabase
|
||||
{
|
||||
$this->schemaSetup->startSetup();
|
||||
|
||||
foreach ($this->getTablesToDelete() as $table) {
|
||||
$this->connection->dropTable($this->connection->getTableName($table));
|
||||
}
|
||||
|
||||
$this->schemaSetup->endSetup();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getTablesToDelete(): array
|
||||
{
|
||||
$tablesToDelete = $this->connection->query(
|
||||
"SHOW TABLES LIKE '{$this->connection->getTableName('prgeoiplookup_maxmindgeoip_city_blocks')}%'"
|
||||
)->fetchAll(PDO::FETCH_COLUMN);
|
||||
|
||||
$tablesToDelete[] = 'prgeoiplookup_maxmindgeoip_city_locations';
|
||||
$tablesToDelete[] = 'prgeoiplookup_iptocountry';
|
||||
$tablesToDelete[] = 'prgeoiplookup_installed_versions';
|
||||
|
||||
return $tablesToDelete;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_GeoIPLookup
|
||||
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
namespace Plumrocket\GeoIPLookup\Setup;
|
||||
|
||||
use Plumrocket\Base\Setup\AbstractUninstall;
|
||||
|
||||
class Uninstall extends AbstractUninstall
|
||||
{
|
||||
protected $_configSectionId = 'prgeoiplookup';
|
||||
protected $_pathes = ['/app/code/Plumrocket/GeoIPLookup'];
|
||||
protected $_tables =
|
||||
[
|
||||
'prgeoiplookup_installed_versions',
|
||||
'prgeoiplookup_iptocountry',
|
||||
'prgeoiplookup_maxmindgeoip_city_blocks',
|
||||
'prgeoiplookup_maxmindgeoip_city_locations'
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user