Skip to content

Commit 013587a

Browse files
authored
Merge pull request #47 from Caprico85/master
Use collation safe comparison for config and attribute value cleanup
2 parents c008f86 + ca11d59 commit 013587a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/FIREGENTO/Magento/Command/Eav/RemoveUnusedMediaCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9797
continue;
9898
}
9999

100-
$value = $coreRead->fetchOne('SELECT value FROM ' . $mediaGallery . ' WHERE value = ?', array($filePath));
100+
$value = $coreRead->fetchOne('SELECT value FROM ' . $mediaGallery . ' WHERE BINARY value = ?', array($filePath));
101101

102102
if ($value == false) {
103103
$row = array();

src/FIREGENTO/Magento/Command/Eav/RestoreUseDefaultValueAttributesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function execute(InputInterface $input, OutputInterface $output)
5757
foreach ($rows as $row) {
5858
// Select the global value if it's the same as the non-global value
5959
$results = $db->fetchAll('SELECT * FROM ' . $fullTableName
60-
. ' WHERE entity_type_id = ? AND attribute_id = ? AND store_id = ? AND entity_id = ? AND value = ?',
60+
. ' WHERE entity_type_id = ? AND attribute_id = ? AND store_id = ? AND entity_id = ? AND BINARY value = ?',
6161
array($row['entity_type_id'], $row['attribute_id'], 0, $row['entity_id'], $row['value'])
6262
);
6363

src/FIREGENTO/Magento/Command/Eav/RestoreUseDefaultValueConfigCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public function execute(InputInterface $input, OutputInterface $output)
5050

5151
$configData = $db->fetchAll('SELECT DISTINCT path, value FROM ' . $this->_prefixTable('core_config_data') . ' WHERE scope_id = 0');
5252
foreach($configData as $config) {
53-
$count = $db->fetchOne('SELECT COUNT(*) FROM ' . $this->_prefixTable('core_config_data') .' WHERE path = ? AND value = ?', array($config['path'], $config['value']));
53+
$count = $db->fetchOne('SELECT COUNT(*) FROM ' . $this->_prefixTable('core_config_data') .' WHERE path = ? AND BINARY value = ?', array($config['path'], $config['value']));
5454
if($count > 1) {
5555
$output->writeln('Config path ' . $config['path'] . ' with value ' . $config['value']. ' has ' . $count . ' values; deleting non-default values');
5656
if(!$isDryRun) {
57-
$db->query('DELETE FROM ' . $this->_prefixTable('core_config_data') . ' WHERE path = ? AND value = ? AND scope_id != ?', array($config['path'], $config['value'], 0));
57+
$db->query('DELETE FROM ' . $this->_prefixTable('core_config_data') . ' WHERE path = ? AND BINARY value = ? AND scope_id != ?', array($config['path'], $config['value'], 0));
5858
}
5959
$removedConfigValues += ($count-1);
6060
}

0 commit comments

Comments
 (0)