-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove install/upgrade scripts and turn them into patches
- Loading branch information
1 parent
68d2d3f
commit a929eed
Showing
4 changed files
with
146 additions
and
149 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace Paynl\Payment\Setup\Patch\Data; | ||
|
||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
use Magento\Framework\App\Config\Storage\WriterInterface; | ||
use Magento\Store\Model\Store; | ||
use \Paynl\Payment\Helper\PayHelper; | ||
|
||
class Install implements DataPatchInterface | ||
{ | ||
/** | ||
* @var ModuleDataSetupInterface | ||
*/ | ||
private $moduleDataSetup; | ||
|
||
/** | ||
* @var WriterInterface | ||
*/ | ||
private $configWriter; | ||
|
||
/** | ||
* @var Store | ||
* */ | ||
private $store; | ||
|
||
/** | ||
* @param ModuleDataSetupInterface $moduleDataSetup | ||
*/ | ||
public function __construct(ModuleDataSetupInterface $moduleDataSetup, WriterInterface $configWriter, Store $store) | ||
{ | ||
$this->moduleDataSetup = $moduleDataSetup; | ||
$this->configWriter = $configWriter; | ||
$this->store = $store; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function apply() | ||
{ | ||
$this->moduleDataSetup->startSetup(); | ||
|
||
if (empty($this->store->getConfig('payment/paynl/apitoken')) && empty($this->store->getConfig('payment/paynl/serviceid'))) { | ||
payHelper::logDebug('Installing module.'); | ||
$this->configWriter->save('payment/paynl/order_description_prefix', 'Order '); | ||
$this->configWriter->save('payment/paynl/image_style', 'newest'); | ||
$this->configWriter->save('payment/paynl/pay_style_checkout', 1); | ||
$this->configWriter->save('payment/paynl/icon_size', 'small'); | ||
} | ||
|
||
$this->moduleDataSetup->endSetup(); | ||
} | ||
|
||
public static function getDependencies() | ||
{ | ||
return []; | ||
} | ||
|
||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace Paynl\Payment\Setup\Patch\Data; | ||
|
||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
use Magento\Framework\Setup\Patch\PatchVersionInterface; | ||
use Magento\Framework\App\ResourceConnection; | ||
use Magento\Config\Model\ResourceModel\Config; | ||
use \Paynl\Payment\Helper\PayHelper; | ||
|
||
class UpdateFashionGiftcard implements DataPatchInterface, PatchVersionInterface | ||
{ | ||
/** | ||
* @var ModuleDataSetupInterface | ||
*/ | ||
private $moduleDataSetup; | ||
|
||
/** | ||
* @var ResourceConnection | ||
*/ | ||
private $resourceConnection; | ||
|
||
/** | ||
* @var Config | ||
*/ | ||
private $resourceConfig; | ||
|
||
/** | ||
* @param ModuleDataSetupInterface $moduleDataSetup | ||
*/ | ||
public function __construct(ModuleDataSetupInterface $moduleDataSetup, ResourceConnection $resourceConnection, Config $resourceConfig) | ||
{ | ||
$this->moduleDataSetup = $moduleDataSetup; | ||
$this->resourceConnection = $resourceConnection; | ||
$this->resourceConfig = $resourceConfig; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function apply() | ||
{ | ||
$this->moduleDataSetup->startSetup(); | ||
|
||
payHelper::logDebug('Apply patch: updateFashionGiftcard.'); | ||
|
||
$connection = $this->resourceConnection->getConnection(); | ||
$tableName = $this->resourceConnection->getTableName('core_config_data'); | ||
|
||
$path = 'payment/paynl_payment_fashiongiftcard/payment_option_id'; | ||
$query = "SELECT `value` FROM " . $tableName . " WHERE scope = 'default' AND `path`= '" . $path . "'"; | ||
|
||
$result = $connection->fetchOne($query, ['path' => $path]); | ||
if (!$result) { | ||
return; | ||
} | ||
payHelper::logDebug('updateFashionGiftcard result ' . $result); | ||
if ($result == '1699') { | ||
# Update the incorrect profileid. | ||
$this->resourceConfig->saveConfig($path, '1669', 'default', 0); | ||
} | ||
|
||
$this->moduleDataSetup->endSetup(); | ||
} | ||
|
||
public static function getVersion() | ||
{ | ||
return '2.0.1'; | ||
} | ||
|
||
public static function getDependencies() | ||
{ | ||
return []; | ||
} | ||
|
||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.