Bubble Code Review for Magento
–
User Guide
Author: Johann Reinke Version: 1.1
Website: https://www.bubbleshop.net
Support: [email protected]
Table of Contents
1
Introducing Bubble Code Review ... 3
1.1
Features ... 3
1.2
Compatibility ... 3
2
Installation ... 3
3
How to use ... 3
3.1
Launch review from browser ... 3
3.2
Launch review from the command line ... 3
4
Analyze results ... 4
4.1
Server and Magento configuration ... 4
4.2
Pages load time and cache strategy ... 4
4.3
SQL debugging ... 5
4.4
Class rewrites ... 5
4.5
Bad practices (specific modules and templates) ... 6
5
Customize code review ... 7
5.1
Specific store ... 7
5.2
Specific URL ... 7
5.3
Script parameters ... 7
5.3.1
SQL queries count ... 7
5.3.2
Disable reports ... 8
5.3.3
Help ... 8
6
Reports ... 8
1 Introducing Bubble Code Review
1.1 Features
Here are the main features of Bubble Code Review extension for Magento: • Calculate pages load time
• Count and show SQL queries
• List all classes rewrites (models, blocks, helpers) and prevent potential conflicts • Show cache strategy of rendered blocks
• Check server configuration (PHP, APC, MySQL, ...) • Check Magento configuration
• Inspect local modules and theme templates to find potential bad practices • Automatic debugging of homepage, category view and product view • Count active and disabled modules
• Count entities (products, categories, customers, URL rewrites, ...) • Check forbidden URLs
• Run code review from browser or from command line • Custom stores and URLs debugging
• Automatic report generation
1.2 Compatibility
Bubble CMS Tree has been tested successfully on the following Magento versions: • Magento Community Edition 1.6.x, 1.7.x, 1.8.x, 1.9.x.
• Magento Enterprise Edition 1.11.x, 1.12.x, 1.13.x, 1.14.x.
2 Installation
• Backup your existing database
• Download and unzip extension in your Magento root folder
• Clear cache via “System > Cache Management > Flush Magento Cache”
Important! The module is not supposed to stay in a production environment indefinitely since there is a debug mode
available showing information that should not be retrieved by public users.
3 How to use
3.1 Launch review from browser
Once extension is installed, you just have to launch your favorite browser and to call your Magento store with the following URL:
http://mystore.com/shell/review.php
3.2 Launch review from the command line
You can also run the script from the command line by running the following command:
4 Analyze results
4.1 Server and Magento configuration
The first thing the script does is showing information about the server and Magento configuration.
It is important to try following the recommendations about the configuration for better performances of your Magento store.
4.2 Pages load time and cache strategy
One important section is load times of each rendered blocks of a page. The script also retrieves the cache strategy for each block.
The list is displayed as a tree structure in order to see blocks children easily.
4.3 SQL debugging
Another important section is the SQL queries debugging that allows you to see SQL queries that are run on each page. You can also see the queries per template or how often a same query is run.
Note: you can customize from how many queries count you want to display queries. Default is 2, more information on how to define queries count parameter below.
4.4 Class rewrites
The list of class rewrites is particularly useful to see in a second how many and which core classes are rewritten by the custom modules. It’s also possible to see the core classes that are rewritten twice or more and thus prevent potential conflicts.
4.5 Bad practices (specific modules and templates)
Best practices that Magento development implies must be respected in order to upgrade easily to a new version and to facilitate the source code understanding. The script checks automatically the custom modules (community and local) and the templates of the specified store view.
5 Customize code review
5.1 Specific store
The default behaviour is to run the code review on the default store view. In order to run the script on a specific store, you just have to add the store code as a parameter like this:
• Running from browser: /shell/review?store=french
• Running from CLI: php shell/review.php -- --store french
5.2 Specific URL
3 URLs are checked by default: • The homepage
• A random category page • A random product page
You can specify which page you want to debug by adding the URL as a parameter:
• Running from browser: /shell/review?url=http://mystore.com/my-custom-page.html
• Running from CLI: php shell/review.php -- --url http://mystore.com/my-custom-page.html If you specify a custom URL, the default pages will not be added to the code review.
5.3 Script parameters
5.3.1 SQL queries count
By default, only SQL queries that are run more than twice are displayed. If you want to modify this behavior, just add a count parameter to the script command:
• Running from browser: /shell/review?count=1
5.3.2 Disable reports
A report is automatically generated and saved after each review. You can disable this by adding a parameter like this: • Running from browser: /shell/review?no-report=1
• Running from CLI: php shell/review.php -- --no-report
5.3.3 Help
To show script help, just do:
• Running from browser: /shell/review?help • Running from CLI: php shell/review.php -- -h
6 Reports
Reports are generated each time a review is run (unless you disable it). They are simple text files located in