magento-hackathon / eavcleaner Goto Github PK
View Code? Open in Web Editor NEWClean up your Magento database by removing orphaned, unused and wrongly added attribute, attribute values and settings (for M1)
License: MIT License
Clean up your Magento database by removing orphaned, unused and wrongly added attribute, attribute values and settings (for M1)
License: MIT License
Sorry for the hassle but uploading this to the app/code directory and running the upgrade sequence doesn't seem to install the module.
Also composer require hackathon/eavcleaner-m2 doesn't seem to install.
Thanks in advance for anyone that can help me out how to get this installed on my dev environment.
Maybe create method clean_all?
Something safe to run that does what it says
Table prefix missed? The following commands dont work on our server because the tables do not exist. I think the error comes from the fact that it does not first check for a table prefix to set-up the table name
[Zend_Db_Statement_Exception] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.c atalog_product_entity_varchar' doesn't exist
table should be (in our case with prefix)
Table 'database.sof_c atalog_product_entity_varchar'
notice the sof
Error? or just warning? sourcemodel eav/entity_attribute_source_boolean not allowed for frontend-type: boolean
magerun eav:check:models
+----------------+--------------+-----------------+-------------------------+----------------------------------------------------------------------------------------+
| attribute_code | attribute_id | entity_type | label | error |
+----------------+--------------+-----------------+-------------------------+----------------------------------------------------------------------------------------+
| skip_feed | 203 | catalog_product | Skip from products feed | sourcemodel eav/entity_attribute_source_boolean not allowed for frontend-type: boolean |
+----------------+--------------+-----------------+-------------------------+----------------------------------------------------------------------------------------+
Looks like the sql is incorrectly referencing entity_id in the catalog_product_entity_* tables when it should be referencing row_id:
---
+++
@@ -59,14 +59,14 @@
$rows = $db->fetchAll('SELECT * FROM ' . $fullTableName . ' WHERE store_id != 0');
foreach ($rows as $row) {
// Select the global value if it's the same as the non-global value
$results = $db->fetchAll(
'SELECT * FROM ' . $fullTableName
- . ' WHERE attribute_id = ? AND store_id = ? AND entity_id = ? AND value = ?',
- array($row['attribute_id'], 0, $row['entity_id'], $row['value'])
+ . ' WHERE attribute_id = ? AND store_id = ? AND row_id = ? AND value = ?',
+ array($row['attribute_id'], 0, $row['row_id'], $row['value'])
);
if (count($results) > 0) {
foreach ($results as $result) {
if (!$isDryRun) {
// Remove the non-global value
Dont understand what this does
Is it possible from someon knowledgeable to elaborate a little more or provide an example in the readme
eav:config:restore-use-default-value Check if config admin value and storeview value are the same, so "use default" doesn't work anymore. Delete the storeview values.
eav:attributes:restore-use-default-value Check if product attribute admin value and storeview value are the same, so "use default" doesn't work anymore. Delete the storeview values.
It would be nice if the actual logic would be moved to models or helpers so it could be reused elsewhere. In my case I would like to call it after a custom importer has run. But since commands cannot be called directly there is no way except to copy the code.
If I see correctly, custom placeholder images defined in one of these settings
catalog/placeholder/image_placeholder
catalog/placeholder/menu_image_placeholder
catalog/placeholder/small_image_placeholder
catalog/placeholder/thumbnail_placeholder
are stored in the directory /media/catalog/product/placeholder/default
. The command eav:media:remove-unused
removes these images. I think images in this directory should be skipped and should not be removed. They are not referenced in the database, but are still used.
When trying to use php bin/magento eav:media:remove-unused
I see the next error: Base table or view not found: 1146 Table 'store.catalog_product_entity_media_gallery' doesn't exist, query was: SELECT value FROM catalog_product_entity_media_gallery WHERE value = ?
.
$this->getHelper('table')
throws the LogicException about not found helper near 87 line in EAVCleaner/Console/Command/RemoveUnusedMediaCommand.php.
Possible solution to change the next code:
$this->getHelper('table')
->setHeaders($headers)
->setRows($table)->render($output);
with
(new \Symfony\Component\Console\Helper\Table($output))
->setHeaders($headers)
->setRows($table)->render();
Start Cleaning Eav Values
We fix your Database 10320 Rows :-) Done!
Clean up 0 rows in catalog_product_entity_varchar
Clean up 48633 rows in catalog_product_entity_int
Clean up 6741 rows in catalog_product_entity_decimal
Clean up 3246 rows in catalog_product_entity_text
Clean up 447 rows in catalog_product_entity_datetime
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
Deleting NULL value 0
... etc
Is this something we want? Couldn't we just skip deleting the NULL values?
Remove attributes that have no values set in products, and remove attributes that exist but are not present in any attributesets.
I get this error message:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM catalog_eav_attribute WHERE `attribute_id ` not in(SELECT `attribute_id` F' at line 1
Fixed in #20.
I'm hit with this error:
sourcemodel eav/entity_attribute_source_boolean not allowed for frontend input type: boolean - the frontend input type should be select
Triggered by:
if ($sourceModel != '' && ! in_array($attribute->getFrontendInput(), $sourceModelsAllowed)) {
$additionalMessage = null;
if($attribute->getSourceModel() == 'eav/entity_attribute_source_boolean' && $attribute->getFrontendInput() != 'select') {
$additionalMessage = ' - the frontend input type should be select';
}
$error .= '<error>sourcemodel ' . $attribute->getSourceModel() . ' not allowed for frontend input type: ' . $attribute->getFrontendInput() . $additionalMessage . '</error>';
}
However, this error applies to any boolean
attribute created by vanilla Magento 1.9 / OpenMage 19. Also it seems to functionally work fine. Are we sure this is an actual problem?
Is this module working still on Working op magento 2.2.5 open source?
Is the development ended on this module or will it be updated in the future?
Best regards
Hello,
Please can you tell me if your extension work with last Magento RC version 2.2.1 ?
thanks a lot to share your work with us.
Hi, Ive been disappointed.
readme file no showing composer installation.. even not giving clear information for supported php and magento versions...
Copy paste EAVcleaner under app/code... and what is further commands? Why you dont show exact installation path step by step?
we dont run bin/magento setup:upgrade
, or bin/magento setup:di:compile
or bin/magento setup:static-content:deploy
??
which one we have to use?
I could not be successfull installing the extension since there's no clear path given for installation.
Weird situation as we know you are experts on magento2
please make clear the installation process.
looking forward to hearing from you soon.
Savas
There is information missing about the purpose of this extension.
#10 introduced a syntax error at CleanUpAttributesAndValuesWithoutParentCommand.php:68.
Parse error: syntax error, unexpected '.' in /usr/local/share/n98-magerun/modules/hackathon_EAVCleaner/src/FIREGENTO/Magento/Command/Eav/CleanUpAttributesAndValuesWithoutParentCommand.php on line 68
After running the eav:clean:product-attribute-set-values
command I got this error.
$ magerun eav:clean:product-attribute-set-values
Start Cleaning Eav Values
[Zend_Db_Statement_Exception]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ',71,74,96,208,224,201,102,80,75)
AND attribu' at line 3, query was: DELETE FROM `catalog_product_entity_varchar`
WHERE `entity_id` = 43581
AND attribute_id NOT IN (,,71,74,96,208,224,201,102,80,75)
AND attribute_id IN (196,190,209,223,188,189,160,132,201,184,164,79,162,156,155,213,157,148,174,172
,173,163,153,149,187,151,186,144,168,167,159,197,166,204,224,208,161,145,165,150,177,207,205,133,134,135,136,198,206,138,139,146,212,14
0,141,147,142,143,152,169)
These were the two attributes with empty IDs in the IN
condition
array(5) {
'attribute_id' =>
NULL
'code' =>
string(10) "created_at"
'type' =>
NULL
'required' =>
NULL
'scope' =>
string(6) "global"
}
array(5) {
'attribute_id' =>
NULL
'code' =>
string(10) "updated_at"
'type' =>
NULL
'required' =>
NULL
'scope' =>
string(6) "global"
}
Wondering if this works on Magento 2.1.7.
We copied the files to the app/code/EAVCleaner folder but magento does not show the module.
Thanks!
Hi, absolute beginner here. I've been messing around with the EAVCleaner and testing its functionality, so far I've found that the module is a nice fit for what we intend to use the module for. I have a question, however (pardon me if this isn't the right place to ask).
I've been looking to run certain commands to periodically clean up unused media, so specifically: I'd like to run the bin/magento eav:media:remove-unused
on a weekly basis so a sprawl of unused media doesn't spiral out of control.
I've tried adding the command to the crontab but so far I've been stumped and not getting it to work locally. I was curious if such a functionality has been created before (specifically for the EAVCleaner) and/or if somebody is able to point me in the right direction.
Magento 2.3 uses PHP 7.2. Is there something else to do apart from updating the composer.json to add php7.2.*?
Hiya. I'm struggling to uninstall this extension.
I've removed the folder fromm app/code
I've removed the entry from setup_module table
I've removed entry from config.php
but still whenever i run setup:upgrade i get this
PHP Fatal error: Uncaught Error: Class 'Hackathon\EAVCleaner\Console\Command\RestoreUseDefaultValueCommand' not found in /httpdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:116
I've searched the whole database and can't find anymore Hackathon entries, pls help
Maybe change --dry-run feature to --commit
Think of it as opt-in when wanting to change
Instead of opting out
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.