netz98 / n98-magerun

The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.
http://magerun.net/
Other
1.44k stars 400 forks source link

php n98-magerun.phar rewrites:analysis:top Command Issue #994

Closed selisc closed 6 years ago

selisc commented 6 years ago

Hi,

I am using the n98-magerun version 1.101.1 for my Magento 1.9x version. When I execute this command

$ php n98-magerun.phar rewrites:analysis:top

then it shows [Exception]
Table 'my_database.core_url_rewrite' doesn't exist query

I have found that the issue is because its not considering the table prefix. Why?

My actual name of table with prefix is mg_core_url_rewrite. But when I execute any kind of n98-magerun command then it always considers without prefix like core_url_rewrite.

How to fix this issue?

ktomk commented 6 years ago

Please execute with -vvv for maximum verbosity and check if the configuration is found.

ktomk commented 6 years ago

If I see it right, the command is from a third-party: https://github.com/frosit/magerun-rewritetoolset so next that there is an issue in magerun itself which might be related to the error, it could also just be the point that this is related to the magerun-rewritetoolset project.

Can you confirm which (exact) third-party project you use?

selisc commented 6 years ago

I didn't use any third party extension for this, I just executed only the magerun command as given below :

$ php n98-magerun.phar rewrites:analysis:top

I think all commands are not accepting my database tablrprefix like sk_core_url_rewrite

So how to fix this and let me know how to execute the command which accepts table prefix?

cmuench commented 6 years ago

@selisc This is definitely not in the n98-magerun core scope. Please create an issue in the foreign repo. https://github.com/frosit/magerun-rewritetoolset

selisc commented 6 years ago

@cmuench for your kind information, I only installed the n98-magerun on my Magento root and executed the command $ php n98-magerun.phar rewrites:analysis:top

How to fix this?

cmuench commented 6 years ago

@selisc As written in my last comment. This command is not provided by n98-magerun itself. Please check if you have installed modules in ~/.n98-magerun/modules or in your project. Please have a look in this folders: https://github.com/netz98/n98-magerun/wiki/Modules#where-can-modules-be-placed

selisc commented 6 years ago

I have executed this command php n98-magerun.phar list and get below :

Available commands: help Displays help for a command install Install magento list Lists commands mysql-client Opens mysql client by database config from local.xml open-browser Open current project in browser (experimental) script Runs multiple n98-magerun commands self-update Updates n98-magerun.phar to the latest version. selfupdate Updates n98-magerun.phar to the latest version. shell Runs n98-magerun as shell uninstall Uninstall magento (drops database and empties current folder or folder set via installationFolder) admin admin:notifications Toggles admin notifications admin:user:change-password Changes the password of a adminhtml user. admin:user:change-status Set active status of an adminhtml user. If no option is set the status will be toggled. admin:user:create Create admin user. admin:user:delete Delete the account of a adminhtml user. admin:user:list List admin users. cache cache:clean Clean magento cache cache:dir:flush Flush (empty) Magento cache directory cache:disable Disables magento caches cache:enable Enables magento caches cache:flush Flush magento cache storage cache:list Lists all magento caches cache:report View inside the cache cache:view Prints a cache entry category category:create:dummy Create a dummy category cms cms:block:list List all cms blocks cms:block:toggle Toggle a cms block composer composer:diagnose Diagnoses the system to identify common errors. composer:init Creates a basic composer.json file in current directory. composer:install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. composer:require Adds required packages to your composer.json and installs them composer:search Search for packages composer:update Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file. composer:validate Validates a composer.json and composer.lock config config:delete Deletes a store config item config:dump Dump merged xml config config:get Get a core config item config:search Search system configuration descriptions. config:set Set a core config item customer customer:change-password Changes the password of a customer. customer:create Creates a new customer/user for shop frontend. customer:create:dummy Generate dummy customers. You can specify a count and a locale. customer:delete Delete Customer/s customer:info Loads basic customer info by email address. customer:list Lists customers db db:console Opens mysql client by database config from local.xml db:create Create currently configured database db:drop Drop current database db:dump Dumps database with mysqldump cli client db:import Imports database with mysql cli client according to database defined in local.xml db:info Dumps database informations db:maintain:check-tables Check database tables db:query Executes an SQL query on the database defined in local.xml db:status Shows important server status information or custom selected status values db:variables Shows important variables or custom selected design design:demo-notice Toggles demo store notice for a store view dev dev:class:lookup Resolves a grouped class name dev:code:model:method Code annotations: Reads the columns from a table and writes the getter and setter methods into the class file for @methods. dev:console Opens PHP interactive shell with initialized Mage::app() (Experimental) dev:email-template:usage Display database transactional email template usage dev:ide:phpstorm:meta Generates meta data file for PhpStorm auto completion (default version : 2016.2+) dev:log Toggle development log (system.log, exception.log) dev:log:db Turn on/off database query logging dev:log:size Get size of log file dev:merge-css Toggles CSS Merging dev:merge-js Toggles JS Merging dev:module:create Create and register a new magento module. dev:module:dependencies:from Show list of modules which depend on %s module dev:module:dependencies:on Show list of modules which given module depends on dev:module:disable Disable a module or all modules in codePool dev:module:enable Enable a module or all modules in codePool dev:module:list List all installed modules dev:module:observer:list Lists all registered observers dev:module:rewrite:conflicts Lists all magento rewrite conflicts dev:module:rewrite:list Lists all magento rewrites dev:module:update Update a Magento module. dev:profiler Toggles profiler for debugging dev:report:count Get count of report files dev:setup:script:attribute Creates attribute script for a given attribute code dev:symlinks Toggle allow symlinks setting dev:template-hints Toggles template hints dev:template-hints-blocks Toggles template hints block names dev:theme:duplicates Find duplicate files (templates, layout, locale, etc.) between two themes. dev:theme:info Displays settings of current design on particular store view dev:theme:list Lists all available themes dev:translate:admin Toggle inline translation tool for admin dev:translate:export Export inline translations dev:translate:set Adds a translation to core_translate table. Globally for locale dev:translate:shop Toggle inline translation tool for shop eav eav:attribute:create-dummy-values Create a dummy values for dropdown attributes eav:attribute:list Lists all EAV attributes eav:attribute:remove Removes attribute for a given attribute code eav:attribute:view View informations about an EAV attribute extension extension:download Download magento-connect package extension:install Install magento-connect package extension:list List magento connection extensions extension:search List magento connection extensions extension:upgrade Upgrade magento-connect package extension:validate Reads Magento Connect Config, and checks that installed package files are really there index index:list Lists all magento indexes index:list:mview Lists all magento mview indexes index:reindex Reindex a magento index by code index:reindex:all Reindex all magento indexes index:reindex:mview Reindex a magento index by code using the materialised view functionality local-config local-config:generate Generates local.xml config media media:cache:image:clear Clears image cache media:cache:jscss:clear Clears JS/CSS cache media:dump Creates an archive with content of media folder. rewrites rewrites:analysis:history Calculates a timeline of created duplicate rewrites. rewrites:analysis:top Shows the top ... of most duplicating products / category's. rewrites:analysis:totals Calculates the amount and percentage of duplicate rewrites per store. rewrites:benchmark:indexer Runs the indexer a couple of times to measure increase in url rewrites. rewrites:benchmark:resolve-urls Benchmarks URL resolve times by triggering sitemap generate actions. rewrites:benchmark:site-performance Benchmarks site performance by crawling the registered urls. rewrites:clean:disabled Cleans out some redundant rewrites based on disabled products or store views. [development] rewrites:clean:older-than Remove all dupes older than x days [development] rewrites:clean:yolo Removes ALL dupes. [development] rewrites:fix:products Make the url keys unique for duplicated products in a simple way by using Magento's methods [development]. rewrites:log:parse Parses access logs for whitelist URL's rewrites:url:csv Import whitelist url's from CSV, for example, google analytics rewrites:url:visitor Import visitor log Urls rewrites:url:whitelist Uses the urls gathered from sources to whitelist rewrites before cleaning script script:repo:list Lists all scripts in repository script:repo:run Run script from repository sys sys:check Checks Magento System sys:cron:history Last executed cronjobs with status. sys:cron:list Lists all cronjobs sys:cron:run Runs a cronjob by job code sys:info Prints infos about the current magento system. sys:maintenance Toggles maintenance mode. sys:modules:list List all installed modules sys:setup:change-version Change module setup resource version sys:setup:compare-versions Compare module version with core_resource table. sys:setup:incremental List new setup scripts to run, then runs one script sys:setup:remove Remove module setup resource entry sys:setup:run Runs all new setup scripts. sys:store:config:base-url:list Lists all base urls sys:store:list Lists all installed store-views sys:url:list Get all urls. sys:website:list Lists all websites

My doubt is why rewrites commands are showing the table prefix related issue?

cmuench commented 6 years ago

@selisc n98-magerun can be extended by modules. In your case there must be a module which provides a lot of additional commands. All the commands of namespace "rewrites:analysis:" are not in provided by the n98-magerun core tool.

If you run "n98-magerun.phar -vvv" you should see a list of all module which provide new commands.

Again, that is not part of the n98-magerun tool. We have no source code of this commands available. So we are not able to fix other ppl problem.

cmuench commented 6 years ago

@selisc Do you use Byte as hoster? Maybe this is already installed by your hosting provider.

This tool https://github.com/frosit/magerun-rewritetoolset is sponsored by Byte.

selisc commented 6 years ago

@cmuench I didn't use Byte as hoster.

Can you please confirm the command php n98-magerun.phar list is not core command of n98-magerun?

If yes, then why its showing in the list?

cmuench commented 6 years ago

@selisc The "list" command lists the core command AND all additionally installed commands. This can be command of external modules If you run "n98-magerun.phar -vvv" you see the loaded config. There must exit a yaml config file for each external module.

selisc commented 6 years ago

@cmuench Actually my main aim is to execute this command n98-magerun.phar rewrites:clean:older-than 30 days to delete the older url rewrites by using n98-magerun

The command is running but its doesn't considers my database table prefix and showing view table not found issue.

selisc commented 6 years ago

@cmuench this is what I am getting as you requested to execute this command n98-magerun.phar -vvv

Add command rewrites:analysis:history -> Frosit\Magento\Command\Rewrites\Analysis\HistoryCommand Add command rewrites:analysis:totals -> Frosit\Magento\Command\Rewrites\Analysis\TotalsCommand Add command rewrites:analysis:top -> Frosit\Magento\Command\Rewrites\Analysis\TopCommand Add command rewrites:benchmark:indexer -> Frosit\Magento\Command\Rewrites\Benchmark\IndexerCommand Add command rewrites:benchmark:site-performance -> Frosit\Magento\Command\Rewrites\Benchmark\SitePerformanceCommand Add command rewrites:benchmark:resolve-urls -> Frosit\Magento\Command\Rewrites\Benchmark\UrlResolveCommand Add command rewrites:clean:disabled -> Frosit\Magento\Command\Rewrites\Clean\DisabledCommand Add command rewrites:clean:yolo -> Frosit\Magento\Command\Rewrites\Clean\YoloCommand Add command rewrites:clean:older-than -> Frosit\Magento\Command\Rewrites\Clean\OlderThanCommand Add command rewrites:fix:products -> Frosit\Magento\Command\Rewrites\Fix\ProductsCommand Add command rewrites:log:parse -> Frosit\Magento\Command\Rewrites\Log\ParseCommand Add command rewrites:url:whitelist -> Frosit\Magento\Command\Rewrites\Url\WhitelistCommand Add command rewrites:url:csv -> Frosit\Magento\Command\Rewrites\Url\CsvCommand Add command rewrites:url:visitor -> Frosit\Magento\Command\Rewrites\Url\VisitorCommand

ktomk commented 6 years ago

As you can see these commands are added from a non-magerun namespace (Frosit\...). Such extra commands can be pre-installed on a per-system basis, so it must not be obvious that these aren't from Magerun at first look. Using -vvv makes this more visible (but only when to know for what to look for as there is a lot of information then).

ktomk commented 6 years ago

The original repository has this reported already, so this is a known issue: https://github.com/frosit/magerun-rewritetoolset/issues/2

selisc commented 6 years ago

Actually my main aim is to execute this command n98-magerun.phar rewrites:clean:older-than 30 days to delete the older url rewrites by using n98-magerun.

Any other fix for this?