Skip to content

Commit

Permalink
Merge pull request #39 from madalinoprea/1.2.0
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
madalinoprea committed Feb 5, 2016
2 parents e8a1840 + 183dc3d commit 04ff400
Show file tree
Hide file tree
Showing 97 changed files with 4,656 additions and 2,601 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Madalin Oprea

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
170 changes: 89 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,101 @@
# Magento Debug Toolbar
Based on robhudson's awesome work (<https://github.com/robhudson/django-debug-toolbar>) we've created a debug toolbar for Magento.
It is installed as a Magento module without hacking Magento's core.

Basic features are implemented and few others will come soon. Check the screenshots for current features: <https://github.com/madalinoprea/magneto-debug/wiki>

Or demo video on YouTube: http://www.youtube.com/watch?v=aqvgrmebcu4

## INSTALLATION

### A) Via Modman - Recommended (https://github.com/colinmollenhour/modman)

#### 1) Install Modman:

```
bash < <(wget -O - https://raw.github.com/colinmollenhour/modman/master/modman-installer)
```

or

```
bash < <(curl -s https://raw.github.com/colinmollenhour/modman/master/modman-installer)
source ~/.profile
```

#### 2) Allow symlinks for the templates directory (required for installation via Modman)

- For newer Magento versions (1.5.1.0 & above) you just need enable 'Allow Symlinks' from System - Configuration / Advanced / Developer / Template Settings
- For older Magento versions: http://www.tonigrigoriu.com/magento/magento-how-to-fix-template-path-errors-when-using-symlinks/

#### 3) Install Debug Toolbar module:

This repository represents an extension for Magento 1.x that offers a debug toolbar. The idea came from robhudson's [django-debug-toolbar](https://github.com/robhudson/django-debug-toolbar).



![Toolbar](docs/images/toolbar.png)

# Features

- **Request and Controller information**: lists request attributes and controller that handled the request
- **Models**: lists all models and collections loaded during the request; all executed SQL queries are listed
when SQL Profiler is enabled
- **Module listing**: lists available Magento modules with their status and their version;
also offers the ability to enable/disable them
- **Design Objects**: lists layout handlers loaded during current request and adds ability to see layout files
updates to a specific handle
- **Blocks**: offers information about instantiated and rendered block
- **Logs**: shows log lines added to system and exception 'during' the request.
- **Utils**: contains quick links to flush cache, enable template hints, enable SQL profiler
- **Configuration** offers ability to search Magento configurations (review cronjobs, event observers, etc)

# Installation


## Using Modman

- Make sure you have [Modman](https://github.com/colinmollenhour/modman) installed
- Allow symlinks for the templates directory (required for installations via Modman)
- For newer Magento versions (1.5.1.0 & above) you just need enable 'Allow Symlinks' from System - Configuration / Advanced / Developer / Template Settings
- For older Magento versions you need to change some code http://www.tonigrigoriu.com/magento/magento-how-to-fix-template-path-errors-when-using-symlinks/
- Install Debug Toolbar module:
```bash
cd [magento root folder]
modman init
modman clone https://github.com/madalinoprea/magneto-debug.git
```
- Flush Magento's cache
### How to update
I'm pretty lazy and I don't like to create Magento Connect packages. With modman you can effortlessly grab latest changes from github.
```
cd [magento root folder]
modman init
modman clone https://github.com/madalinoprea/magneto-debug.git
modman update magneto-debug
```
- Flush Magento's cache

- Make sure you've cleaned Magento's cache to enable the new module; hit refresh

#### How to update
I'm pretty lazy and I don't like to create Magento Connect packages. With modman you can effortlessly grab the latest changes from github.
`
modman update magneto-debug
`
- Clean Magento's cache to make sure new changes will be enabled.
## Via Magento Connect

### B) Via Magento Connect
Extension is not updated regularly. I recommend using modman.
Extension is not updated regularly on Magento Connect. My recommendation is to use modman.

`
```bash
cd [magento root folder]
sudo ./mage install community MagnetoDebug
`
```

Magento Connect extension package is available here: http://www.magentocommerce.com/magento-connect/sstoiana/extension/6714/magnetodebug

## FEATURES
- Now available in Admin (1.0.1 RC - fancy for I'm laizy to create Magento Connect package)
- Magento module listing; Toggle Magento modules on the fly
- Search configuration keys
- Display peak memory usage, script execution time
- Request information (controller name, action name, cookies variables, session variables, GET and POST variables)
- Models instantiated
- SQL queries executed for current request; ability to see queries' result or queries' execution plan (EXPLAIN)
- List Magento configuration
- Print layout handles for current request
- Find xml files where a specific layout handle is defined
- Created blocks, their associated templates; Preview templates' source code
- Quick actions:
- Toggle template hints
- Clear cache
- Toggle inline translation

## KNOWN ISSUES
We're working to correct these:

- To enable SQL profiler manually you have to add in your local.xml profiler tag `<profiler>1</profiler>` under connection, like in the example below:

```
<default_setup>
<connection>
<host><![CDATA[/var/run/mysqld/mysqld.sock]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[]]></password>
<dbname><![CDATA[magento]]></dbname>
<active>1</active>
<profiler>1</profiler>
</connection>
</default_setup>
```

- `Disable SQL Profiler` is not working, but `Enable SQL Profiler` works like a charm (or not)
# Issues, Ideas or Feedback

Use [issue tracker on GitHub](https://github.com/madalinoprea/magneto-debug/issues) to report issues, ideas or any feedback.

# Common Issues

- 'Mage Registry key already exists' exception is raised after installation
- `Mage registry key "_singleton/debug/observer" already exists` is reported when cache regeneration was corrupted.
Please try to flush Magento cache.

- I can't see toolbar.
- Toolbar is displayed in these conditions:
- module is installed and enabled
- toolbar is enabled from Admin / System / Configuration / Advanced - Developer Debug Toolbar (by default it's enabled)
- Magento is running in developer mode (MAGE_IS_DEVELOPER_MODE) Or your ip is listed under under 'Developer Client Restrictions'
- Check that module name Sheep_Debug is installed and enabled
- Check that 'Allow Symlinks' configuration is enabled for Modman installation

- I can't see toolbar on specific page
- Toolbar is added to all pages that have a structural block named `before_body_end`. By default this block is available on all Magento pages.
Eliminate a possible cache problem by disabling all caches. Try to determine if there are any customizations that have removed `before_body_end`.
# Change Log
- **1.2.0**:
- Fixes SELECT and DESCRIBE operations for long queries
- Better way to identify what logging lines were added during request
- Various minor UI improvements (order of the panel, panel titles)
- Structural changes to improve stability and prepare new features
- And ma
# Authors, contributors
- [Mario O](https://twitter.com/madalinoprea)
- [Other contributors](https://github.com/madalinoprea/magneto-debug/graphs/contributors)
# License
[MIT License](LICENSE.txt)
# Roadmap
- Replace jQuery with prototype
- Persist request info and add ability to view previous requests, including Ajax or API requests
- Reduce toolbar weight: simplify presented information, add separate request info view page
- Add request info listing (shows persisted request infos)
- Add unit tests
- Add Travis
- Add more detailed documentation
18 changes: 9 additions & 9 deletions Magneto_Debug.xml → Sheep_Debug.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<config>
<modules>
<Magneto_Debug>
<active>true</active>
<codePool>community</codePool>
</Magneto_Debug>
</modules>
</config>
<?xml version="1.0"?>
<config>
<modules>
<Sheep_Debug>
<active>true</active>
<codePool>community</codePool>
</Sheep_Debug>
</modules>
</config>
35 changes: 35 additions & 0 deletions code/Debug/Block/About.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* Class Sheep_Debug_Block_About
*
* @category Sheep
* @package Sheep_Debug
* @license Copyright: Pirate Sheep, 2016, All Rights reserved.
* @link https://piratesheep.com
*/
class Sheep_Debug_Block_About extends Sheep_Debug_Block_Panel
{

/**
* Show module version as subtitle
*
* @return string
*/
public function getSubTitle()
{
return $this->__('Version %s', $this->helper->getModuleVersion());
}


/**
* We don't have content for this panel
*
* @return bool
*/
public function hasContent()
{
return false;
}

}
62 changes: 58 additions & 4 deletions code/Debug/Block/Abstract.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,73 @@
<?php
class Magneto_Debug_Block_Abstract extends Mage_Core_Block_Template

/**
* Class Sheep_Debug_Block_Abstract
*
* @category Sheep
* @package Sheep_Subscription
* @license Copyright: Pirate Sheep, 2016, All Rights reserved.
* @link https://piratesheep.com
*
* @method setRequestInfo(Sheep_Debug_Model_RequestInfo $requestInfo)
*/
class Sheep_Debug_Block_Abstract extends Mage_Core_Block_Template
{
/** @var Sheep_Debug_Helper_Data */
protected $helper;

/** @var Sheep_Debug_Model_RequestInfo */
protected $requestInfo;


/**
* Sheep_Debug_Block_Abstract constructor.
*
* @param array $args
*/
public function __construct(array $args)
{
parent::__construct($args);
$this->helper = Mage::helper('sheep_debug');
}

/**
* By default we don't cache our blocks
*
* @return null
*/
public function getCacheLifetime()
{
return null;
}


public function getDefaultStoreId(){
return Mage::app()
->getWebsite()
->getDefaultGroup()
->getDefaultStoreId();
}

public function _getViewVars() {
return $this->_viewVars;
}

public function getShowTemplateHints()
{
return false;
}


/**
* Returns info attached to this block or returns current request's info
*
* TODO: Return specified request info
*
* @return Sheep_Debug_Model_RequestInfo
*/
public function getRequestInfo()
{
if ($this->requestInfo === null) {
$this->requestInfo = Mage::registry('sheep_debug_request_info') ?: Mage::getSingleton('sheep_debug/observer')->getRequestInfo();
}

return $this->requestInfo;
}
}
43 changes: 43 additions & 0 deletions code/Debug/Block/Array.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/**
* Class Sheep_Debug_Block_Array
*
* @category Sheep
* @package Sheep_Debug
* @license Copyright: Pirate Sheep, 2016, All Rights reserved.
* @link https://piratesheep.com
*
* @method string getTitle()
* @method setTitle(string $title)
* @method string getDescription()
* @method setDescription(string $title)
* @method setArray(array $data)
* @method array getArray()
*/
class Sheep_Debug_Block_Array extends Sheep_Debug_Block_Abstract
{

public function __construct(array $args)
{
parent::__construct($args);
$this->setTemplate('sheep_debug/array.phtml');
}


/**
* Returns data header based on its content
*
* @return array
*/
public function getHeader()
{
$header = array();
if ($data=$this->getArray()) {
$header = array_keys(reset($data));
}

return $header;
}

}
Loading

0 comments on commit 04ff400

Please sign in to comment.