diff --git a/app/plugins/debug_kit2/README.mdown b/app/plugins/debug_kit2/README.mdown deleted file mode 100644 index c1c56b3e4..000000000 --- a/app/plugins/debug_kit2/README.mdown +++ /dev/null @@ -1,22 +0,0 @@ -# CakePHP DebugKit - -DebugKit provides a debugging toolbar and enhanced debugging tools for CakePHP applications. - -## Installation - -* Clone/Copy the files in this directory into `app/plugins/debug_kit` -* Include the toolbar component in your `app_controller.php`: - * `var $components = array('DebugKit.Toolbar');` -* Set debug mode to at least 1. - -## Documentation - -Further documentation including additional configuration and ways of extending DebugKit can be found in the [Lighthouse wiki](http://cakephp.lighthouseapp.com/projects/42880-debug-kit/overview) - -## Reporting issues - -If you have an issues with DebugKit please open a ticket on lighthouse http://cakephp.lighthouseapp.com/projects/42880-debug-kit/overview - -## Contributing - -If you'd like to contribute to DebugKit, check out the [Roadmap](http://cakephp.lighthouseapp.com/projects/42880/roadmap) for any planned features. You can fork the project add features and send pull requests, or open tickets on lighthouse. \ No newline at end of file diff --git a/app/plugins/debug_kit2/build.py b/app/plugins/debug_kit2/build.py deleted file mode 100644 index ba75dcf62..000000000 --- a/app/plugins/debug_kit2/build.py +++ /dev/null @@ -1,130 +0,0 @@ -#! /usr/bin/env python - -import sys, os -import tarfile, zipfile, gzip, bz2 -from optparse import OptionParser - -""" -Builds packaged releases of DebugKit so I don't have to do things manually. - -Excludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives. -""" -def main(): - parser = OptionParser(); - parser.add_option('-o', '--output-dir', dest="output_dir", - help="write the packages to DIR", metavar="DIR") - parser.add_option('-p', '--prefix-name', dest="prefix", - help="prefix used for the generated files") - parser.add_option('-k', '--skip', dest="skip", default="", - help="A comma separated list of files to skip") - parser.add_option('-s', '--source-dir', dest="source", default=".", - help="The source directory for the build process") - - (options, args) = parser.parse_args() - - if options.output_dir == '' or options.output_dir == options.source: - print 'Requires an output dir, and that output dir cannot be the same as the source one!' - exit() - - # append .git and build.py to the skip files - skip = options.skip.split(',') - skip.extend(['.git', '.gitignore', '.DS_Store', 'build.py']) - - # get list of files in top level dir. - files = os.listdir(options.source) - - os.chdir(options.source) - - # filter the files, I couldn't figure out how to do it in a more concise way. - for f in files[:]: - try: - skip.index(f) - files.remove(f) - except ValueError: - pass - - # make a boring tar file - destfile = ''.join([options.output_dir, options.prefix]) - tar_file_name = destfile + '.tar' - tar = tarfile.open(tar_file_name, 'w'); - for f in files: - tar.add(f) - tar.close() - print "Generated tar file" - - # make the gzip - if make_gzip(tar_file_name, destfile): - print "Generated gzip file" - else: - print "Could not generate gzip file" - - # make the bz2 - if make_bz2(tar_file_name, destfile): - print "Generated bz2 file" - else: - print "Could not generate bz2 file" - - # make the zip file - zip_recursive(destfile + '.zip', options.source, files) - print "Generated zip file\n" - -def make_gzip(tar_file, destination): - """ - Takes a tar_file and destination. Compressess the tar file and creates - a .tar.gzip - """ - tar_contents = open(tar_file, 'rb') - gzipfile = gzip.open(destination + '.tar.gz', 'wb') - gzipfile.writelines(tar_contents) - gzipfile.close() - tar_contents.close() - return True - -def make_bz2(tar_file, destination): - """ - Takes a tar_file and destination. Compressess the tar file and creates - a .tar.bz2 - """ - tar_contents = open(tar_file, 'rb') - bz2file = bz2.BZ2File(destination + '.tar.bz2', 'wb') - bz2file.writelines(tar_contents) - bz2file.close() - tar_contents.close() - return True - -def zip_recursive(destination, source_dir, rootfiles): - """ - Recursively zips source_dir into destination. - rootfiles should contain a list of files in the top level directory that - are to be included. Any top level files not in rootfiles will be omitted - from the zip file. - """ - zipped = zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED) - - for root, dirs, files in os.walk(source_dir): - inRoot = False - if root == source_dir: - inRoot = True - - if inRoot: - for d in dirs: - try: - rootfiles.index(d) - except ValueError: - dirs.remove(d) - - for f in files[:]: - if inRoot: - try: - rootfiles.index(f) - except ValueError: - continue - - fullpath = os.path.join(root, f) - zipped.write(fullpath) - zipped.close() - return destination - - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/app/plugins/debug_kit2/controllers/components/toolbar.php b/app/plugins/debug_kit2/controllers/components/toolbar.php deleted file mode 100644 index 64d2134be..000000000 --- a/app/plugins/debug_kit2/controllers/components/toolbar.php +++ /dev/null @@ -1,646 +0,0 @@ - false, - 'autoRun' => true - ); -/** - * Controller instance reference - * - * @var object - */ - var $controller; -/** - * Components used by DebugToolbar - * - * @var array - */ - var $components = array('RequestHandler'); -/** - * The default panels the toolbar uses. - * which panels are used can be configured when attaching the component - * - * @var array - */ - var $_defaultPanels = array('history', 'session', 'request', 'sqlLog', 'timer', 'log', 'variables'); -/** - * Loaded panel objects. - * - * @var array - */ - var $panels = array(); -/** - * javascript files component will be using - * - * @var array - **/ - var $javascript = array( - 'behavior' => '/debug_kit/js/js_debug_toolbar' - ); -/** - * CacheKey used for the cache file. - * - * @var string - **/ - var $cacheKey = 'toolbar_cache'; -/** - * Duration of the debug kit history cache - * - * @var string - **/ - var $cacheDuration = '+4 hours'; -/** - * initialize - * - * If debug is off the component will be disabled and not do any further time tracking - * or load the toolbar helper. - * - * @return bool - **/ - function initialize(&$controller, $settings) { - $this->settings = am($this->settings, $settings); - if (!Configure::read('debug') && empty($this->settings['forceEnable'])) { - $this->enabled = false; - return false; - } - if ($this->settings['autoRun'] == false && !isset($controller->params['url']['debug'])) { - $this->enabled = false; - return false; - } - App::import('Vendor', 'DebugKit.DebugKitDebugger'); - - DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'Component intitailization', true)); - DebugKitDebugger::startTimer('componentInit', __d('debug_kit', 'Component initialization and startup', true)); - - $panels = $this->_defaultPanels; - if (isset($settings['panels'])) { - $panels = $this->_makePanelList($settings['panels']); - unset($settings['panels']); - } - - $this->cacheKey .= $controller->Session->read('Config.userAgent'); - if (!isset($settings['history']) || (isset($settings['history']) && $settings['history'] !== false)) { - $this->_createCacheConfig(); - } - - $this->_loadPanels($panels, $settings); - - $this->_set($settings); - $this->controller =& $controller; - return false; - } -/** - * Go through user panels and remove default panels as indicated. - * - * @param array $userPanels The list of panels ther user has added removed. - * @return array Array of panels to use. - **/ - function _makePanelList($userPanels) { - $panels = $this->_defaultPanels; - foreach ($userPanels as $key => $value) { - if (is_numeric($key)) { - $panels[] = $value; - } - if (is_string($key) && $value === false) { - $index = array_search($key, $panels); - if ($index !== false) { - unset($panels[$index]); - } - } - } - return $panels; - } -/** - * Component Startup - * - * @return bool - **/ - function startup(&$controller) { - $currentViewClass = $controller->view; - $this->_makeViewClass($currentViewClass); - $controller->view = 'DebugKit.Debug'; - $isHtml = ( - !isset($controller->params['url']['ext']) || - (isset($controller->params['url']['ext']) && $controller->params['url']['ext'] == 'html') - ); - - if (!$this->RequestHandler->isAjax() && $isHtml) { - $format = 'Html'; - } else { - $format = 'FirePhp'; - } - $controller->helpers['DebugKit.Toolbar'] = array( - 'output' => sprintf('DebugKit.%sToolbar', $format), - 'cacheKey' => $this->cacheKey, - 'cacheConfig' => 'debug_kit', - 'forceEnable' => isset($this->settings['forceEnable'])? true : null, - ); - $panels = array_keys($this->panels); - foreach ($panels as $panelName) { - $this->panels[$panelName]->startup($controller); - } - DebugKitDebugger::stopTimer('componentInit'); - DebugKitDebugger::startTimer('controllerAction', __d('debug_kit', 'Controller action', true)); - DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'Controller action start', true)); - } -/** - * beforeRedirect callback - * - * @return void - **/ - function beforeRedirect(&$controller) { - if (!class_exists('DebugKitDebugger')) { - return null; - } - DebugKitDebugger::stopTimer('controllerAction'); - $vars = $this->_gatherVars($controller); - $this->_saveState($controller, $vars); - } -/** - * beforeRender callback - * - * Calls beforeRender on all the panels and set the aggregate to the controller. - * - * @return void - **/ - function beforeRender(&$controller) { - DebugKitDebugger::stopTimer('controllerAction'); - $vars = $this->_gatherVars($controller); - $this->_saveState($controller, $vars); - - $controller->set(array('debugToolbarPanels' => $vars, 'debugToolbarJavascript' => $this->javascript)); - DebugKitDebugger::startTimer('controllerRender', __d('debug_kit', 'Render Controller Action', true)); - DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'Controller render start', true)); - } -/** - * Load a toolbar state from cache - * - * @param int $key - * @return array - **/ - function loadState($key) { - $history = Cache::read($this->cacheKey, 'debug_kit'); - if (isset($history[$key])) { - return $history[$key]; - } - return array(); - } -/** - * Create the cache config for the history - * - * @return void - * @access protected - **/ - function _createCacheConfig() { - if (Configure::read('Cache.disable') !== true) { - Cache::config('debug_kit', array( - 'duration' => $this->cacheDuration, - 'engine' => 'File', - 'path' => CACHE - )); - } - } -/** - * collects the panel contents - * - * @return array Array of all panel beforeRender() - * @access protected - **/ - function _gatherVars(&$controller) { - $vars = array(); - $panels = array_keys($this->panels); - - foreach ($panels as $panelName) { - $panel =& $this->panels[$panelName]; - $panelName = Inflector::underscore($panelName); - $vars[$panelName]['content'] = $panel->beforeRender($controller); - $elementName = Inflector::underscore($panelName) . '_panel'; - if (isset($panel->elementName)) { - $elementName = $panel->elementName; - } - $vars[$panelName]['elementName'] = $elementName; - $vars[$panelName]['plugin'] = $panel->plugin; - $vars[$panelName]['title'] = $panel->title; - $vars[$panelName]['disableTimer'] = true; - } - return $vars; - } -/** - * Load Panels used in the debug toolbar - * - * @return void - * @access protected - **/ - function _loadPanels($panels, $settings) { - foreach ($panels as $panel) { - $className = $panel . 'Panel'; - if (!class_exists($className) && !App::import('Vendor', $className)) { - trigger_error(sprintf(__d('debug_kit', 'Could not load DebugToolbar panel %s', true), $panel), E_USER_WARNING); - continue; - } - if (strpos($className, '.') !== false) { - list($plugin, $className) = explode('.', $className); - } - $panelObj =& new $className($settings); - if (is_subclass_of($panelObj, 'DebugPanel') || is_subclass_of($panelObj, 'debugpanel')) { - $this->panels[$panel] =& $panelObj; - } - } - } -/** - * Makes the DoppleGangerView class if it doesn't already exist. - * This allows DebugView to be compatible with all view classes. - * - * @param string $baseClassName - * @access protected - * @return void - */ - function _makeViewClass($baseClassName) { - if (!class_exists('DoppelGangerView')) { - App::import('View', $baseClassName); - if (strpos($baseClassName, '.') !== false) { - list($plugin, $baseClassName) = explode('.', $baseClassName); - } - if (strpos($baseClassName, 'View') === false) { - $baseClassName .= 'View'; - } - $class = "class DoppelGangerView extends $baseClassName {}"; - $this->_eval($class); - } - } -/** - * Method wrapper for eval() for testing uses. - * - * @return void - **/ - function _eval($code) { - eval($code); - } -/** - * Save the current state of the toolbar varibles to the cache file. - * - * @param object $controller Controller instance - * @param array $vars Vars to save. - * @access protected - * @return void - **/ - function _saveState(&$controller, $vars) { - $config = Cache::config('debug_kit'); - if (empty($config) || !isset($this->panels['history'])) { - return; - } - $history = Cache::read($this->cacheKey, 'debug_kit'); - if (empty($history)) { - $history = array(); - } - if (count($history) == $this->panels['history']->history) { - array_pop($history); - } - unset($vars['history']); - array_unshift($history, $vars); - Cache::write($this->cacheKey, $history, 'debug_kit'); - } -} - -/** - * Debug Panel - * - * Abstract class for debug panels. - * - * @package cake.debug_kit - */ -class DebugPanel extends Object { -/** - * Defines which plugin this panel is from so the element can be located. - * - * @var string - */ - var $plugin = null; -/** - * Defines the title for displaying on the toolbar. - * - * @var string - */ - var $title = null; -/** - * startup the panel - * - * Pull information from the controller / request - * - * @param object $controller Controller reference. - * @return void - **/ - function startup(&$controller) { } -/** - * Prepare output vars before Controller Rendering. - * - * @param object $controller Controller reference. - * @return void - **/ - function beforeRender(&$controller) { } -} - -/** - * History Panel - * - * Provides debug information on previous requests. - * - * @package cake.debug_kit.panels - **/ -class HistoryPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * Number of history elements to keep - * - * @var string - **/ - var $history = 5; -/** - * Constructor - * - * @param array $settings Array of settings. - * @return void - **/ - function __construct($settings) { - if (isset($settings['history'])) { - $this->history = $settings['history']; - } - } -/** - * beforeRender callback function - * - * @return array contents for panel - **/ - function beforeRender(&$controller) { - $cacheKey = $controller->Toolbar->cacheKey; - $toolbarHistory = Cache::read($cacheKey, 'debug_kit'); - $historyStates = array(); - if (is_array($toolbarHistory) && !empty($toolbarHistory)) { - $prefix = array(); - if (!empty($controller->params['prefix'])) { - $prefix[$controller->params['prefix']] = false; - } - foreach ($toolbarHistory as $i => $state) { - if (!isset($state['request']['content']['params']['url']['url'])) { - continue; - } - $historyStates[] = array( - 'title' => $state['request']['content']['params']['url']['url'], - 'url' => array_merge($prefix, array( - 'plugin' => 'debug_kit', - 'controller' => 'toolbar_access', - 'action' => 'history_state', - $i + 1)) - ); - } - } - if (count($historyStates) >= $this->history) { - array_pop($historyStates); - } - return $historyStates; - } -} - -/** - * Variables Panel - * - * Provides debug information on the View variables. - * - * @package cake.debug_kit.panels - **/ -class VariablesPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * beforeRender callback - * - * @return array - **/ - function beforeRender(&$controller) { - return array_merge($controller->viewVars, array('$this->data' => $controller->data)); - } -} - -/** - * Session Panel - * - * Provides debug information on the Session contents. - * - * @package cake.debug_kit.panels - **/ -class SessionPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * beforeRender callback - * - * @param object $controller - * @access public - * @return array - */ - function beforeRender(&$controller) { - $sessions = $controller->Session->read(); - return $sessions; - } -} - -/** - * Request Panel - * - * Provides debug information on the Current request params. - * - * @package cake.debug_kit.panels - **/ -class RequestPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * beforeRender callback - grabs request params - * - * @return array - **/ - function beforeRender(&$controller) { - $out = array(); - $out['params'] = $controller->params; - if (isset($controller->Cookie)) { - $out['cookie'] = $controller->Cookie->read(); - } - $out['get'] = $_GET; - $out['currentRoute'] = Router::currentRoute(); - return $out; - } -} - -/** - * Timer Panel - * - * Provides debug information on all timers used in a request. - * - * @package cake.debug_kit.panels - **/ -class TimerPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * startup - add in necessary helpers - * - * @return void - **/ - function startup(&$controller) { - if (!in_array('Number', $controller->helpers)) { - $controller->helpers[] = 'Number'; - } - if (!in_array('SimpleGraph', $controller->helpers)) { - $controller->helpers[] = 'DebugKit.SimpleGraph'; - } - } -} - -/** - * SqlLog Panel - * - * Provides debug information on the SQL logs and provides links to an ajax explain interface. - * - * @package cake.debug_kit.panels - **/ -class SqlLogPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * Minimum number of Rows Per Millisecond that must be returned by a query before an explain - * is done. - * - * @var int - **/ - var $slowRate = 20; -/** - * Gets the connection names that should have logs + dumps generated. - * - * @param string $controller - * @access public - * @return void - */ - function beforeRender(&$controller) { - if (!class_exists('ConnectionManager')) { - return array(); - } - $connections = array(); - - $dbConfigs = ConnectionManager::sourceList(); - foreach ($dbConfigs as $configName) { - $db =& ConnectionManager::getDataSource($configName); - $driver = $db->config['driver']; - $explain = false; - $isExplainable = ($driver === 'mysql' || $driver === 'mysqli' || $driver === 'postgres'); - if ($isExplainable && $db->isInterfaceSupported('getLog')) { - $explain = true; - } - $connections[$configName] = $explain; - } - return array('connections' => $connections, 'threshold' => $this->slowRate); - } -} - -/** - * Log Panel - Reads log entries made this request. - * - * @package cake.debug_kit.panels - */ -class LogPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * Log files to scan - * - * @var array - */ - var $logFiles = array('error.log', 'debug.log'); -/** - * startup - * - * @return void - **/ - function startup(&$controller) { - if (!class_exists('CakeLog')) { - App::import('Core', 'CakeLog'); - } - } -/** - * beforeRender Callback - * - * @return array - **/ - function beforeRender(&$controller) { - $this->startTime = DebugKitDebugger::requestStartTime(); - $this->currentTime = DebugKitDebugger::requestTime(); - $out = array(); - foreach ($this->logFiles as $log) { - $file = LOGS . $log; - if (!file_exists($file)) { - continue; - } - $out[$log] = $this->_parseFile($file); - } - return $out; - } -/** - * parse a log file and find the relevant entries - * - * @param string $filename Name of file to read - * @access protected - * @return array - */ - function _parseFile($filename) { - $fh = fopen($filename, 'r'); - $timePattern = '/^(\d{4}-\d{2}\-\d{2}\s\d{1,2}\:\d{1,2}\:\d{1,2})\s(.*)/'; - - $out = array(); - $entry = ''; - $done = false; - - while (!feof($fh)) { - $line = fgets($fh); - if (preg_match($timePattern, $line, $matches)) { - if (strtotime($matches[1]) < $this->startTime) { - continue; - } - $out[] = $matches[1]; - $out[] = $matches[2]; - } elseif (count($out) - 1 > 0) { - $currentIndex = count($out) - 1; - while (!feof($fh)) { - $line = fgets($fh); - if (preg_match($timePattern, $line)) { - break; - } - $out[$currentIndex] .= $line; - } - } - } - fclose($fh); - return $out; - } -} - -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/controllers/toolbar_access_controller.php b/app/plugins/debug_kit2/controllers/toolbar_access_controller.php deleted file mode 100644 index bd566a080..000000000 --- a/app/plugins/debug_kit2/controllers/toolbar_access_controller.php +++ /dev/null @@ -1,103 +0,0 @@ - array('output' => 'DebugKit.HtmlToolbar'), - 'Javascript', 'Number', 'DebugKit.SimpleGraph' - ); - -/** - * Components - * - * @var array - **/ - var $components = array('RequestHandler', 'DebugKit.Toolbar'); - -/** - * beforeFilter callback - * - * @return void - **/ - function beforeFilter() { - parent::beforeFilter(); - if (isset($this->Toolbar)) { - $this->Toolbar->enabled = false; - } - $this->helpers['DebugKit.Toolbar']['cacheKey'] = $this->Toolbar->cacheKey; - $this->helpers['DebugKit.Toolbar']['cacheConfig'] = 'debug_kit'; - } - -/** - * Get a stored history state from the toolbar cache. - * - * @return void - **/ - function history_state($key = null) { - if (Configure::read('debug') == 0) { - return $this->redirect($this->referer()); - } - $oldState = $this->Toolbar->loadState($key); - $this->set('toolbarState', $oldState); - $this->set('debugKitInHistoryMode', true); - } - -/** - * Run SQL explain/profiling on queries. Checks the hash + the hashed queries, - * if there is mismatch a 404 will be rendered. If debug == 0 a 404 will also be - * rendered. No explain will be run if a 404 is made. - * - * @return void - */ - function sql_explain() { - if ( - empty($this->params['named']['sql']) || - empty($this->params['named']['ds']) || - empty($this->params['named']['hash']) || - Configure::read('debug') == 0 - ) { - $this->cakeError('error404', array(array( - 'message' => 'Invalid parameters' - ))); - } - App::import('Core', 'Security'); - $hash = Security::hash($this->params['named']['sql'] . $this->params['named']['ds'], null, true); - if ($hash !== $this->params['named']['hash']) { - $this->cakeError('error404', array(array( - 'message' => 'Invalid parameters' - ))); - } - $result = $this->ToolbarAccess->explainQuery($this->params['named']['ds'], $this->params['named']['sql']); - $this->set(compact('result')); - } -} \ No newline at end of file diff --git a/app/plugins/debug_kit2/debug_kit_app_controller.php b/app/plugins/debug_kit2/debug_kit_app_controller.php deleted file mode 100644 index 3b369d8d5..000000000 --- a/app/plugins/debug_kit2/debug_kit_app_controller.php +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/app/plugins/debug_kit2/debug_kit_app_model.php b/app/plugins/debug_kit2/debug_kit_app_model.php deleted file mode 100644 index e065b3f26..000000000 --- a/app/plugins/debug_kit2/debug_kit_app_model.php +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/app/plugins/debug_kit2/locale/debug_kit.pot b/app/plugins/debug_kit2/locale/debug_kit.pot deleted file mode 100644 index df4988dd1..000000000 --- a/app/plugins/debug_kit2/locale/debug_kit.pot +++ /dev/null @@ -1,138 +0,0 @@ -# LANGUAGE translation of Debug Kit Application -# Copyright 2008 Andy Dawson -# No version information was available in the source files. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: debug_kit-\n" -"POT-Creation-Date: 2009-05-27 09:47+0200\n" -"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" -"Last-Translator: Andy Dawson \n" -"Language-Team:\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Poedit-Basepath: ../../../\n" - -#: controllers/components/toolbar.php:91 -msgid "Component initialization and startup" -msgstr "" - -#: controllers/components/toolbar.php:140 -msgid "Controller Action" -msgstr "" - -#: controllers/components/toolbar.php:167 -msgid "Render Controller Action" -msgstr "" - -#: controllers/components/toolbar.php:231 -msgid "Could not load DebugToolbar panel %s" -msgstr "" - -#: views/elements/debug_toolbar.ctp:25 -msgid "There are no active panels. You must enable a panel to see its output." -msgstr "" - -#: views/elements/history_panel.ctp:21 -msgid "Request History" -msgstr "" - -#: views/elements/history_panel.ctp:23 -msgid "No previous requests logged." -msgstr "" - -#: views/elements/history_panel.ctp:25 -msgid "previous requests available" -msgstr "" - -#: views/elements/history_panel.ctp:27 -msgid "Restore to current request" -msgstr "" - -#: views/elements/log_panel.ctp:21 -msgid "Logs" -msgstr "" - -#: views/elements/log_panel.ctp:28 -msgid "Time" -msgstr "" - -#: views/elements/log_panel.ctp:28 -#: views/elements/timer_panel.ctp:54 -msgid "Message" -msgstr "" - -#: views/elements/log_panel.ctp:37 -msgid "There were no log entries made this request" -msgstr "" - -#: views/elements/request_panel.ctp:21 -msgid "Request" -msgstr "" - -#: views/elements/request_panel.ctp:35 -msgid "Current Route" -msgstr "" - -#: views/elements/session_panel.ctp:21 -msgid "Session" -msgstr "" - -#: views/elements/sql_log_panel.ctp:21 -msgid "Sql Logs" -msgstr "" - -#: views/elements/sql_log_panel.ctp:31 -msgid "toggle (%s) query explains for %s" -msgstr "" - -#: views/elements/sql_log_panel.ctp:39 -msgid "No slow queries!, or your database does not support EXPLAIN" -msgstr "" - -#: views/elements/sql_log_panel.ctp:44 -msgid "No active database connections" -msgstr "" - -#: views/elements/timer_panel.ctp:33 -msgid "Memory" -msgstr "" - -#: views/elements/timer_panel.ctp:35 -msgid "Current Memory Use" -msgstr "" - -#: views/elements/timer_panel.ctp:39 -msgid "Peak Memory Use" -msgstr "" - -#: views/elements/timer_panel.ctp:43 -msgid "Timers" -msgstr "" - -#: views/elements/timer_panel.ctp:45 -msgid "%s (ms)" -msgstr "" - -#: views/elements/timer_panel.ctp:46 -msgid "Total Request Time:" -msgstr "" - -#: views/elements/timer_panel.ctp:54 -msgid "Time in ms" -msgstr "" - -#: views/elements/timer_panel.ctp:54 -msgid "Graph" -msgstr "" - -#: views/elements/variables_panel.ctp:21 -msgid "View Variables" -msgstr "" - -#: views/helpers/simple_graph.php:79 -msgid "Starting %sms into the request, taking %sms" -msgstr "" - diff --git a/app/plugins/debug_kit2/locale/eng/LC_MESSAGES/debug_kit.po b/app/plugins/debug_kit2/locale/eng/LC_MESSAGES/debug_kit.po deleted file mode 100644 index 9aec83297..000000000 --- a/app/plugins/debug_kit2/locale/eng/LC_MESSAGES/debug_kit.po +++ /dev/null @@ -1,135 +0,0 @@ -# LANGUAGE translation of CakePHP Application -# Copyright YEAR NAME -# No version information was available in the source files. -# -#, fuzzy -msgid "" -msgstr "Project-Id-Version: PROJECT VERSION\n" - "POT-Creation-Date: 2009-05-27 09:47+0200\n" - "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" - "Last-Translator: NAME \n" - "Language-Team: LANGUAGE \n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" - "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - -#: controllers/components/toolbar.php:91 -msgid "Component initialization and startup" -msgstr "" - -#: controllers/components/toolbar.php:140 -msgid "Controller Action" -msgstr "" - -#: controllers/components/toolbar.php:167 -msgid "Render Controller Action" -msgstr "" - -#: controllers/components/toolbar.php:231 -msgid "Could not load DebugToolbar panel %s" -msgstr "" - -#: views/elements/debug_toolbar.ctp:25 -msgid "There are no active panels. You must enable a panel to see its output." -msgstr "" - -#: views/elements/history_panel.ctp:21 -msgid "Request History" -msgstr "" - -#: views/elements/history_panel.ctp:23 -msgid "No previous requests logged." -msgstr "" - -#: views/elements/history_panel.ctp:25 -msgid "previous requests available" -msgstr "" - -#: views/elements/history_panel.ctp:27 -msgid "Restore to current request" -msgstr "" - -#: views/elements/log_panel.ctp:21 -msgid "Logs" -msgstr "" - -#: views/elements/log_panel.ctp:28 -msgid "Time" -msgstr "" - -#: views/elements/log_panel.ctp:28 views/elements/timer_panel.ctp:54 -msgid "Message" -msgstr "" - -#: views/elements/log_panel.ctp:37 -msgid "There were no log entries made this request" -msgstr "" - -#: views/elements/request_panel.ctp:21 -msgid "Request" -msgstr "" - -#: views/elements/request_panel.ctp:35 -msgid "Current Route" -msgstr "" - -#: views/elements/session_panel.ctp:21 -msgid "Session" -msgstr "" - -#: views/elements/sql_log_panel.ctp:21 -msgid "Sql Logs" -msgstr "" - -#: views/elements/sql_log_panel.ctp:31 -msgid "toggle (%s) query explains for %s" -msgstr "" - -#: views/elements/sql_log_panel.ctp:39 -msgid "No slow queries!, or your database does not support EXPLAIN" -msgstr "" - -#: views/elements/sql_log_panel.ctp:44 -msgid "No active database connections" -msgstr "" - -#: views/elements/timer_panel.ctp:33 -msgid "Memory" -msgstr "" - -#: views/elements/timer_panel.ctp:35 -msgid "Current Memory Use" -msgstr "" - -#: views/elements/timer_panel.ctp:39 -msgid "Peak Memory Use" -msgstr "" - -#: views/elements/timer_panel.ctp:43 -msgid "Timers" -msgstr "" - -#: views/elements/timer_panel.ctp:45 -msgid "%s (ms)" -msgstr "" - -#: views/elements/timer_panel.ctp:46 -msgid "Total Request Time:" -msgstr "" - -#: views/elements/timer_panel.ctp:54 -msgid "Time in ms" -msgstr "" - -#: views/elements/timer_panel.ctp:54 -msgid "Graph" -msgstr "" - -#: views/elements/variables_panel.ctp:21 -msgid "View Variables" -msgstr "" - -#: views/helpers/simple_graph.php:79 -msgid "Starting %sms into the request, taking %sms" -msgstr "" diff --git a/app/plugins/debug_kit2/locale/spa/LC_MESSAGES/debug_kit.po b/app/plugins/debug_kit2/locale/spa/LC_MESSAGES/debug_kit.po deleted file mode 100644 index 0833a4942..000000000 --- a/app/plugins/debug_kit2/locale/spa/LC_MESSAGES/debug_kit.po +++ /dev/null @@ -1,135 +0,0 @@ -# LANGUAGE translation of CakePHP Application -# Copyright YEAR NAME -# No version information was available in the source files. -# -#, fuzzy -msgid "" -msgstr "Project-Id-Version: PROJECT VERSION\n" - "POT-Creation-Date: 2009-05-27 09:47+0200\n" - "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" - "Last-Translator: NAME \n" - "Language-Team: LANGUAGE \n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" - "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - -#: controllers/components/toolbar.php:91 -msgid "Component initialization and startup" -msgstr "" - -#: controllers/components/toolbar.php:140 -msgid "Controller Action" -msgstr "" - -#: controllers/components/toolbar.php:167 -msgid "Render Controller Action" -msgstr "" - -#: controllers/components/toolbar.php:231 -msgid "Could not load DebugToolbar panel %s" -msgstr "" - -#: views/elements/debug_toolbar.ctp:25 -msgid "There are no active panels. You must enable a panel to see its output." -msgstr "" - -#: views/elements/history_panel.ctp:21 -msgid "Request History" -msgstr "" - -#: views/elements/history_panel.ctp:23 -msgid "No previous requests logged." -msgstr "" - -#: views/elements/history_panel.ctp:25 -msgid "previous requests available" -msgstr "" - -#: views/elements/history_panel.ctp:27 -msgid "Restore to current request" -msgstr "" - -#: views/elements/log_panel.ctp:21 -msgid "Logs" -msgstr "" - -#: views/elements/log_panel.ctp:28 -msgid "Time" -msgstr "" - -#: views/elements/log_panel.ctp:28 views/elements/timer_panel.ctp:54 -msgid "Message" -msgstr "" - -#: views/elements/log_panel.ctp:37 -msgid "There were no log entries made this request" -msgstr "" - -#: views/elements/request_panel.ctp:21 -msgid "Request" -msgstr "" - -#: views/elements/request_panel.ctp:35 -msgid "Current Route" -msgstr "" - -#: views/elements/session_panel.ctp:21 -msgid "Session" -msgstr "" - -#: views/elements/sql_log_panel.ctp:21 -msgid "Sql Logs" -msgstr "" - -#: views/elements/sql_log_panel.ctp:31 -msgid "toggle (%s) query explains for %s" -msgstr "" - -#: views/elements/sql_log_panel.ctp:39 -msgid "No slow queries!, or your database does not support EXPLAIN" -msgstr "" - -#: views/elements/sql_log_panel.ctp:44 -msgid "No active database connections" -msgstr "" - -#: views/elements/timer_panel.ctp:33 -msgid "Memory" -msgstr "" - -#: views/elements/timer_panel.ctp:35 -msgid "Current Memory Use" -msgstr "" - -#: views/elements/timer_panel.ctp:39 -msgid "Peak Memory Use" -msgstr "" - -#: views/elements/timer_panel.ctp:43 -msgid "Timers" -msgstr "" - -#: views/elements/timer_panel.ctp:45 -msgid "%s (ms)" -msgstr "" - -#: views/elements/timer_panel.ctp:46 -msgid "Total Request Time:" -msgstr "" - -#: views/elements/timer_panel.ctp:54 -msgid "Time in ms" -msgstr "" - -#: views/elements/timer_panel.ctp:54 -msgid "Graph" -msgstr "" - -#: views/elements/variables_panel.ctp:21 -msgid "View Variables" -msgstr "" - -#: views/helpers/simple_graph.php:79 -msgid "Starting %sms into the request, taking %sms" -msgstr "" \ No newline at end of file diff --git a/app/plugins/debug_kit2/models/toolbar_access.php b/app/plugins/debug_kit2/models/toolbar_access.php deleted file mode 100644 index da1e23a08..000000000 --- a/app/plugins/debug_kit2/models/toolbar_access.php +++ /dev/null @@ -1,56 +0,0 @@ -config['driver']; - - $return = array(); - if ($driver === 'mysqli' || $driver === 'mysql' || $driver === 'postgres') { - $explained = $db->query('EXPLAIN ' . $query); - if ($driver === 'postgres') { - $queryPlan = array(); - foreach ($explained as $postgreValue) { - $queryPlan[] = array($postgreValue[0]['QUERY PLAN']); - } - $return = array_merge(array(array('')), $queryPlan); - } else { - $keys = array_keys($explained[0][0]); - foreach ($explained as $mysqlValue) { - $queryPlan[] = array_values($mysqlValue[0]); - } - $return = array_merge(array($keys), $queryPlan); - } - } - return $return; - } -} \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/controllers/components/toolbar.test.php b/app/plugins/debug_kit2/tests/cases/controllers/components/toolbar.test.php deleted file mode 100644 index 1ff6af9ae..000000000 --- a/app/plugins/debug_kit2/tests/cases/controllers/components/toolbar.test.php +++ /dev/null @@ -1,559 +0,0 @@ -_loadPanels($panels, $settings); - } - - function _eval($code) { - if ($this->evalTest) { - $this->evalCode = $code; - return; - } - eval($code); - } -} - -Mock::generate('DebugPanel'); - -if (!class_exists('AppController')) { - class AppController extends Controller { - - } -} - -class TestPanel extends DebugPanel { - -} - -/** -* DebugToolbar Test case -*/ -class DebugToolbarTestCase extends CakeTestCase { -/** - * fixtures. - * - * @var array - **/ - var $fixtures = array('core.article'); -/** - * Start test callback - * - * @access public - * @return void - **/ - function startTest() { - Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - $this->Controller =& new Controller(); - $this->Controller->params = Router::parse('/'); - $this->Controller->params['url']['url'] = '/'; - $this->Controller->uses = array(); - $this->Controller->components = array('TestToolBar'); - $this->Controller->constructClasses(); - $this->Controller->Toolbar =& $this->Controller->TestToolBar; - - $this->_server = $_SERVER; - $this->_paths = array(); - $this->_paths['plugins'] = App::path('plugins'); - $this->_paths['views'] = App::path('views'); - $this->_paths['vendors'] = App::path('vendors'); - $this->_paths['controllers'] = App::path('controllers'); - Configure::write('Cache.disable', false); - } -/** - * endTest - * - * @return void - **/ - function endTest() { - $_SERVER = $this->_server; - App::build(array( - 'plugins' => $this->_paths['plugins'], - 'views' => $this->_paths['views'], - 'controllers' => $this->_paths['controllers'], - 'vendors' => $this->_paths['vendors'] - ), true); - Configure::write('Cache.disable', true); - - unset($this->Controller); - if (class_exists('DebugKitDebugger')) { - DebugKitDebugger::clearTimers(); - DebugKitDebugger::clearMemoryPoints(); - } - } -/** - * test Loading of panel classes - * - * @return void - **/ - function testLoadPanels() { - $this->Controller->Toolbar->loadPanels(array('session', 'request')); - $this->assertTrue(is_a($this->Controller->Toolbar->panels['session'], 'SessionPanel')); - $this->assertTrue(is_a($this->Controller->Toolbar->panels['request'], 'RequestPanel')); - - $this->Controller->Toolbar->loadPanels(array('history'), array('history' => 10)); - $this->assertEqual($this->Controller->Toolbar->panels['history']->history, 10); - - $this->expectError(); - $this->Controller->Toolbar->loadPanels(array('randomNonExisting', 'request')); - } -/** - * test Loading of panel classes from a plugin - * - * @return void - **/ - function testLoadPluginPanels() { - $this->Controller->Toolbar->loadPanels(array('plugin.test')); - $this->assertTrue(is_a($this->Controller->Toolbar->panels['plugin.test'], 'TestPanel')); - } -/** - * test generating a DoppelGangerView with a pluginView. - * - * @return void - **/ - function testPluginViewParsing() { - App::import('Vendor', 'DebugKit.DebugKitDebugger'); - $this->Controller->Toolbar->evalTest = true; - $this->Controller->view = 'Plugin.OtherView'; - $this->Controller->Toolbar->startup($this->Controller); - $this->assertPattern('/class DoppelGangerView extends OtherView/', $this->Controller->Toolbar->evalCode); - } -/** - * test loading of vendor panels from test_app folder - * - * @access public - * @return void - */ - function testVendorPanels() { - $debugKitPath = App::pluginPath('DebugKit'); - $noDir = (empty($debugKitPath) || !file_exists($debugKitPath)); - $skip = $this->skipIf($noDir, 'Could not find debug_kit in plugin paths, skipping %s'); - if ($skip) { - return; - } - - App::build(array( - 'vendors' => array($debugKitPath . 'tests' . DS . 'test_app' . DS . 'vendors' . DS) - )); - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('test'), - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->assertTrue(isset($this->Controller->Toolbar->panels['test'])); - $this->assertTrue(is_a($this->Controller->Toolbar->panels['test'], 'TestPanel')); - } -/** - * test initialize - * - * @return void - * @access public - **/ - function testInitialize() { - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - - $this->assertFalse(empty($this->Controller->Toolbar->panels)); - - $timers = DebugKitDebugger::getTimers(); - $this->assertTrue(isset($timers['componentInit'])); - $memory = DebugKitDebugger::getMemoryPoints(); - $this->assertTrue(isset($memory['Component intitailization'])); - } -/** - * test initialize w/ custom panels and defaults - * - * @return void - * @access public - **/ - function testInitializeCustomPanelsWithDefaults() { - $this->Controller->components = array( - 'DebugKit.Toolbar' => array('panels' => array('test')) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - - $expected = array('history', 'session', 'request', 'sqlLog', 'timer', 'log', 'variables', 'test'); - $this->assertEqual($expected, array_keys($this->Controller->Toolbar->panels)); - } -/** - * test syntax for removing panels - * - * @return void - **/ - function testInitializeRemovingPanels() { - $this->Controller->components = array( - 'DebugKit.Toolbar' => array('panels' => array('session' => false, 'history' => false, 'test')) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - - $expected = array('request', 'sqlLog', 'timer', 'log', 'variables', 'test'); - $this->assertEqual($expected, array_keys($this->Controller->Toolbar->panels)); - } -/** - * ensure that enabled = false when debug == 0 on initialize - * - * @return void - **/ - function testDebugDisableOnInitialize() { - $_debug = Configure::read('debug'); - Configure::write('debug', 0); - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->assertFalse($this->Controller->Toolbar->enabled); - - Configure::write('debug', $_debug); - } -/** - * test that passing in forceEnable will enable the toolbar even if debug = 0 - * - * @return void - **/ - function testForceEnable() { - $_debug = Configure::read('debug'); - Configure::write('debug', 0); - $this->Controller->components = array('DebugKit.Toolbar' => array('forceEnable' => true)); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->assertTrue($this->Controller->Toolbar->enabled); - - Configure::write('debug', $_debug); - } -/** - * Test disabling autoRunning of toolbar - * - * @return void - **/ - function testAutoRunSettingFalse() { - $this->Controller->components = array('DebugKit.Toolbar' => array('autoRun' => false)); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->assertFalse($this->Controller->Toolbar->enabled); - } -/** - * test autorun = false with query string param - * - * @return void - **/ - function testAutoRunSettingWithQueryString() { - $this->Controller->params['url']['debug'] = true; - $this->Controller->components = array('DebugKit.Toolbar' => array('autoRun' => false)); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->assertTrue($this->Controller->Toolbar->enabled); - } -/** - * test startup - * - * @return void - **/ - function testStartup() { - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('MockDebug') - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Toolbar->panels['MockDebug']->expectOnce('startup'); - $this->Controller->Toolbar->startup($this->Controller); - - $this->assertEqual($this->Controller->view, 'DebugKit.Debug'); - $this->assertTrue(isset($this->Controller->helpers['DebugKit.Toolbar'])); - - $this->assertEqual($this->Controller->helpers['DebugKit.Toolbar']['output'], 'DebugKit.HtmlToolbar'); - $this->assertEqual($this->Controller->helpers['DebugKit.Toolbar']['cacheConfig'], 'debug_kit'); - $this->assertTrue(isset($this->Controller->helpers['DebugKit.Toolbar']['cacheKey'])); - - $timers = DebugKitDebugger::getTimers(); - $this->assertTrue(isset($timers['controllerAction'])); - $memory = DebugKitDebugger::getMemoryPoints(); - $this->assertTrue(isset($memory['Controller action start'])); - } -/** - * Test that cache config generation works. - * - * @return void - **/ - function testCacheConfigGeneration() { - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - - $results = Cache::config('debug_kit'); - $this->assertTrue(is_array($results)); - } -/** - * test state saving of toolbar - * - * @return void - **/ - function testStateSaving() { - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $configName = 'debug_kit'; - $this->Controller->Toolbar->cacheKey = 'toolbar_history'; - - $this->Controller->Component->startup($this->Controller); - $this->Controller->set('test', 'testing'); - $this->Controller->Component->beforeRender($this->Controller); - - $result = Cache::read('toolbar_history', $configName); - $this->assertEqual($result[0]['variables']['content']['test'], 'testing'); - Cache::delete('toolbar_history', $configName); - } -/** - * Test Before Render callback - * - * @return void - **/ - function testBeforeRender() { - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('MockDebug', 'session') - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Toolbar->panels['MockDebug']->expectOnce('beforeRender'); - $this->Controller->Toolbar->beforeRender($this->Controller); - - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarPanels'])); - $vars = $this->Controller->viewVars['debugToolbarPanels']; - - $expected = array( - 'plugin' => 'debug_kit', - 'elementName' => 'session_panel', - 'content' => $this->Controller->Session->read(), - 'disableTimer' => true, - 'title' => '' - ); - $this->assertEqual($expected, $vars['session']); - - $memory = DebugKitDebugger::getMemoryPoints(); - $this->assertTrue(isset($memory['Controller render start'])); - } -/** - * test that vars are gathered and state is saved on beforeRedirect - * - * @return void - **/ - function testBeforeRedirect() { - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('MockDebug', 'session', 'history') - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - - $configName = 'debug_kit'; - $this->Controller->Toolbar->cacheKey = 'toolbar_history'; - Cache::delete('toolbar_history', $configName); - - DebugKitDebugger::startTimer('controllerAction', 'testing beforeRedirect'); - $this->Controller->Toolbar->panels['MockDebug']->expectOnce('beforeRender'); - $this->Controller->Toolbar->beforeRedirect($this->Controller); - - $result = Cache::read('toolbar_history', $configName); - $this->assertTrue(isset($result[0]['session'])); - $this->assertTrue(isset($result[0]['mock_debug'])); - - $timers = DebugKitDebugger::getTimers(); - $this->assertTrue(isset($timers['controllerAction'])); - } -/** - * test that loading state (accessing cache) works. - * - * @return void - **/ - function testLoadState() { - $this->Controller->Toolbar->cacheKey = 'toolbar_history'; - - $data = array(0 => array('my data')); - Cache::write('toolbar_history', $data, 'debug_kit'); - $result = $this->Controller->Toolbar->loadState(0); - $this->assertEqual($result, $data[0]); - } -/** - * test the Log panel log reading. - * - * @return void - **/ - function testLogPanel() { - sleep(1); - $this->Controller->log('This is a log I made this request'); - $this->Controller->log('This is the second log I made this request'); - $this->Controller->log('This time in the debug log!', LOG_DEBUG); - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('log', 'session', 'history' => false, 'variables' => false, 'sqlLog' => false, - 'timer' => false) - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->viewVars['debugToolbarPanels']['log']; - - $this->assertEqual(count($result['content']), 2); - $this->assertEqual(count($result['content']['error.log']), 4); - $this->assertEqual(count($result['content']['debug.log']), 2); - - $this->assertEqual(trim($result['content']['debug.log'][1]), 'Debug: This time in the debug log!'); - $this->assertEqual(trim($result['content']['error.log'][1]), 'Error: This is a log I made this request'); - - $data = array( - 'Post' => array( - 'id' => 1, - 'title' => 'post!', - 'body' => 'some text here', - 'created' => '2009-11-07 23:23:23' - ), - 'Comment' => array( - 'id' => 23 - ) - ); - $this->Controller->log($data); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->viewVars['debugToolbarPanels']['log']; - $this->assertPattern('/\[created\] => 2009-11-07 23:23:23/', $result['content']['error.log'][5]); - $this->assertPattern('/\[Comment\] => Array/', $result['content']['error.log'][5]); - } -/** - * Test that history state urls set prefix = null and admin = null so generated urls do not - * adopt these params. - * - * @return void - **/ - function testHistoryUrlGenerationWithPrefixes() { - $configName = 'debug_kit'; - $this->Controller->params = array( - 'controller' => 'posts', - 'action' => 'edit', - 'admin' => 1, - 'prefix' => 'admin', - 'plugin' => 'cms', - 'url' => array( - 'url' => '/admin/cms/posts/edit/' - ) - ); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Toolbar->cacheKey = 'url_test'; - $this->Controller->Component->beforeRender($this->Controller); - - $result = $this->Controller->Toolbar->panels['history']->beforeRender($this->Controller); - $expected = array( - 'plugin' => 'debug_kit', 'controller' => 'toolbar_access', 'action' => 'history_state', - 0 => 1, 'admin' => false - ); - $this->assertEqual($result[0]['url'], $expected); - Cache::delete('url_test', $configName); - } -/** - * Test that the FireCake toolbar is used on AJAX requests - * - * @return void - **/ - function testAjaxToolbar() { - $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->assertEqual($this->Controller->helpers['DebugKit.Toolbar']['output'], 'DebugKit.FirePhpToolbar'); - } -/** - * Test that the toolbar does not interfere with requestAction - * - * @return void - **/ - function testNoRequestActionInterference() { - $debugKitPath = App::pluginPath('DebugKit'); - $noDir = (empty($debugKitPath) || !file_exists($debugKitPath)); - $skip = $this->skipIf($noDir, 'Could not find debug_kit in plugin paths, skipping %s'); - if ($skip) { - return; - } - - App::build(array( - 'controllers' => $debugKitPath . 'tests' . DS . 'test_app' . DS . 'controllers' . DS, - 'views' => array( - $debugKitPath . 'tests' . DS . 'test_app' . DS . 'views' . DS, - CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'libs' . DS . 'view' . DS - ), - 'plugins' => $this->_paths['plugins'] - )); - Router::reload(); - - $result = $this->Controller->requestAction('/debug_kit_test/request_action_return', array('return')); - $this->assertEqual($result, 'I am some value from requestAction.'); - - $result = $this->Controller->requestAction('/debug_kit_test/request_action_render', array('return')); - $this->assertEqual($result, 'I have been rendered.'); - } -/** - * test the sqlLog panel parsing of db->showLog - * - * @return void - **/ - function testSqlLogPanel() { - App::import('Core', 'Model'); - $Article = new Model(array('ds' => 'test_suite', 'name' => 'Article')); - $Article->find('first', array('conditions' => array('Article.id' => 1))); - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('SqlLog') - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->viewVars['debugToolbarPanels']['sql_log']; - - $this->assertTrue(isset($result['content']['test_suite']['queries'])); - $this->assertTrue(isset($result['content']['test_suite']['explains'])); - $query = array_pop($result['content']['test_suite']['queries']); - - $this->assertPattern('/\d/', $query[0], 'index not found. %s'); - $this->assertPattern('/SELECT `Article/', $query[1], 'query not found. %s'); - $this->assertEqual(count($query), 6, 'There are not 6 columns, something is wonky. %s'); - $this->assertEqual($query[3], 1); - $this->assertEqual($query[4], 1); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/models/toolbar_access.test.php b/app/plugins/debug_kit2/tests/cases/models/toolbar_access.test.php deleted file mode 100644 index 0be5eb4c0..000000000 --- a/app/plugins/debug_kit2/tests/cases/models/toolbar_access.test.php +++ /dev/null @@ -1,66 +0,0 @@ -Model =& new ToolbarAccess(); - } - -/** - * endTest - * - * @return void - */ - function endTest() { - unset($this->Model); - } - -/** - * test that explain query returns arrays of query information. - * - * @return void - */ - function testExplainQuery() { - $db =& ConnectionManager::getDataSource('test_suite'); - $sql = 'SELECT * FROM ' . $db->fullTableName('posts') . ';'; - $result = $this->Model->explainQuery('test_suite', $sql); - - $this->assertTrue(is_array($result)); - $this->assertFalse(empty($result)); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/test_objects.php b/app/plugins/debug_kit2/tests/cases/test_objects.php deleted file mode 100644 index 714b16195..000000000 --- a/app/plugins/debug_kit2/tests/cases/test_objects.php +++ /dev/null @@ -1,53 +0,0 @@ -sentHeaders[$name] = $value; - } -/** - * skip client detection as headers are not being sent. - * - * @access public - * @return void - */ - function detectClientExtension() { - return true; - } -/** - * Reset the fireCake - * - * @return void - **/ - function reset() { - $_this =& FireCake::getInstance(); - $_this->sentHeaders = array(); - $_this->_messageIndex = 1; - } -} - -?> diff --git a/app/plugins/debug_kit2/tests/cases/vendors/debug_kit_debugger.test.php b/app/plugins/debug_kit2/tests/cases/vendors/debug_kit_debugger.test.php deleted file mode 100644 index 81068848e..000000000 --- a/app/plugins/debug_kit2/tests/cases/vendors/debug_kit_debugger.test.php +++ /dev/null @@ -1,241 +0,0 @@ -assertTrue(DebugKitDebugger::startTimer('test1', 'this is my first test')); - usleep(5000); - $this->assertTrue(DebugKitDebugger::stopTimer('test1')); - $elapsed = DebugKitDebugger::elapsedTime('test1'); - $this->assertTrue($elapsed > 0.0050); - - $this->assertTrue(DebugKitDebugger::startTimer('test2', 'this is my second test')); - sleep(1); - $this->assertTrue(DebugKitDebugger::stopTimer('test2')); - $elapsed = DebugKitDebugger::elapsedTime('test2'); - $this->assertTrue($elapsed > 1); - - DebugKitDebugger::startTimer('test3'); - $this->assertFalse(DebugKitDebugger::elapsedTime('test3')); - $this->assertFalse(DebugKitDebugger::stopTimer('wrong')); - } -/** - * test timers with no names. - * - * @return void - **/ - function testAnonymousTimers() { - $this->assertTrue(DebugKitDebugger::startTimer()); - usleep(2000); - $this->assertTrue(DebugKitDebugger::stopTimer()); - $timers = DebugKitDebugger::getTimers(); - - $this->assertEqual(count($timers), 2); - end($timers); - $key = key($timers); - $lineNo = __LINE__ - 8; - - $file = Debugger::trimPath(__FILE__); - $expected = $file . ' line ' . $lineNo; - $this->assertEqual($key, $expected); - - $timer = $timers[$expected]; - $this->assertTrue($timer['time'] > 0.0020); - $this->assertEqual($timers[$expected]['message'], $expected); - } -/** - * Assert that nested anonymous timers don't get mixed up. - * - * @return void - **/ - function testNestedAnonymousTimers() { - $this->assertTrue(DebugKitDebugger::startTimer()); - usleep(100); - $this->assertTrue(DebugKitDebugger::startTimer()); - usleep(100); - $this->assertTrue(DebugKitDebugger::stopTimer()); - $this->assertTrue(DebugKitDebugger::stopTimer()); - - $timers = DebugKitDebugger::getTimers(); - $this->assertEqual(count($timers), 3, 'incorrect number of timers %s'); - $firstTimerLine = __LINE__ -9; - $secondTimerLine = __LINE__ -8; - $file = Debugger::trimPath(__FILE__); - - $this->assertTrue(isset($timers[$file . ' line ' . $firstTimerLine]), 'first timer is not set %s'); - $this->assertTrue(isset($timers[$file . ' line ' . $secondTimerLine]), 'second timer is not set %s'); - - $firstTimer = $timers[$file . ' line ' . $firstTimerLine]; - $secondTimer = $timers[$file . ' line ' . $secondTimerLine]; - $this->assertTrue($firstTimer['time'] > $secondTimer['time']); - } -/** - * test that calling startTimer with the same name does not overwrite previous timers - * and instead adds new ones. - * - * @return void - **/ - function testRepeatTimers() { - DebugKitDebugger::startTimer('my timer', 'This is the first call'); - usleep(100); - DebugKitDebugger::startTimer('my timer', 'This is the second call'); - usleep(100); - - DebugKitDebugger::stopTimer('my timer'); - DebugKitDebugger::stopTimer('my timer'); - - $timers = DebugKitDebugger::getTimers(); - $this->assertEqual(count($timers), 3, 'wrong timer count %s'); - - $this->assertTrue(isset($timers['my timer'])); - $this->assertTrue(isset($timers['my timer #2'])); - - $this->assertTrue($timers['my timer']['time'] > $timers['my timer #2']['time'], 'timer 2 is longer? %s'); - $this->assertEqual($timers['my timer']['message'], 'This is the first call'); - $this->assertEqual($timers['my timer #2']['message'], 'This is the second call #2'); - } -/** - * testRequestTime - * - * @access public - * @return void - */ - function testRequestTime() { - $result1 = DebugKitDebugger::requestTime(); - usleep(50); - $result2 = DebugKitDebugger::requestTime(); - $this->assertTrue($result1 < $result2); - } -/** - * test getting all the set timers. - * - * @return void - **/ - function testGetTimers() { - DebugKitDebugger::startTimer('test1', 'this is my first test'); - DebugKitDebugger::stopTimer('test1'); - usleep(50); - DebugKitDebugger::startTimer('test2'); - DebugKitDebugger::stopTimer('test2'); - $timers = DebugKitDebugger::getTimers(); - - $this->assertEqual(count($timers), 3); - $this->assertTrue(is_float($timers['test1']['time'])); - $this->assertTrue(isset($timers['test1']['message'])); - $this->assertTrue(isset($timers['test2']['message'])); - } -/** - * test memory usage - * - * @return void - **/ - function testMemoryUsage() { - $result = DebugKitDebugger::getMemoryUse(); - $this->assertTrue(is_int($result)); - - $result = DebugKitDebugger::getPeakMemoryUse(); - $this->assertTrue(is_int($result)); - } -/** - * test _output switch to firePHP - * - * @return void - */ - function testOutput() { - $firecake =& FireCake::getInstance('TestFireCake'); - Debugger::invoke(DebugKitDebugger::getInstance('DebugKitDebugger')); - Debugger::output('fb'); - $foo .= ''; - $result = $firecake->sentHeaders; - - $this->assertPattern('/GROUP_START/', $result['X-Wf-1-1-1-1']); - $this->assertPattern('/ERROR/', $result['X-Wf-1-1-1-2']); - $this->assertPattern('/GROUP_END/', $result['X-Wf-1-1-1-5']); - - Debugger::invoke(Debugger::getInstance('Debugger')); - Debugger::output(); - } -/** - * test making memory use markers. - * - * @return void - **/ - function testMemorySettingAndGetting() { - $result = DebugKitDebugger::setMemoryPoint('test marker'); - $this->assertTrue($result); - - $result = DebugKitDebugger::getMemoryPoints(true); - $this->assertEqual(count($result), 1); - $this->assertTrue(isset($result['test marker'])); - $this->assertTrue(is_numeric($result['test marker'])); - - $result = DebugKitDebugger::getMemoryPoints(); - $this->assertTrue(empty($result)); - - DebugKitDebugger::setMemoryPoint('test marker'); - DebugKitDebugger::setMemoryPoint('test marker'); - $result = DebugKitDebugger::getMemoryPoints(); - $this->assertEqual(count($result), 2); - $this->assertTrue(isset($result['test marker'])); - $this->assertTrue(isset($result['test marker #2'])); - } - -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/vendors/fire_cake.test.php b/app/plugins/debug_kit2/tests/cases/vendors/fire_cake.test.php deleted file mode 100644 index 517e799b7..000000000 --- a/app/plugins/debug_kit2/tests/cases/vendors/fire_cake.test.php +++ /dev/null @@ -1,340 +0,0 @@ -firecake =& FireCake::getInstance('TestFireCake'); - } -/** - * test getInstance cheat. - * - * If this fails the rest of the test is going to fail too. - * - * @return void - **/ - function testGetInstanceOverride() { - $instance =& FireCake::getInstance(); - $instance2 =& FireCake::getInstance(); - $this->assertReference($instance, $instance2); - $this->assertIsA($instance, 'FireCake'); - $this->assertIsA($instance, 'TestFireCake', 'Stored instance is not a copy of TestFireCake, test case is broken.'); - } -/** - * testsetoption - * - * @return void - **/ - function testSetOptions() { - FireCake::setOptions(array('includeLineNumbers' => false)); - $this->assertEqual($this->firecake->options['includeLineNumbers'], false); - } -/** - * test Log() - * - * @access public - * @return void - */ - function testLog() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::log('Testing'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '26|[{"Type":"LOG"},"Testing"]|'); - - FireCake::log('Testing', 'log-info'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '45|[{"Type":"LOG","Label":"log-info"},"Testing"]|'); - } -/** - * test info() - * - * @access public - * @return void - */ - function testInfo() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::info('I have information'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '38|[{"Type":"INFO"},"I have information"]|'); - - FireCake::info('I have information', 'info-label'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '59|[{"Type":"INFO","Label":"info-label"},"I have information"]|'); - } -/** - * test info() - * - * @access public - * @return void - */ - function testWarn() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::warn('A Warning'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '29|[{"Type":"WARN"},"A Warning"]|'); - - FireCake::warn('A Warning', 'Bzzz'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '44|[{"Type":"WARN","Label":"Bzzz"},"A Warning"]|'); - } -/** - * test error() - * - * @access public - * @return void - **/ - function testError() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::error('An error'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '29|[{"Type":"ERROR"},"An error"]|'); - - FireCake::error('An error', 'wonky'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '45|[{"Type":"ERROR","Label":"wonky"},"An error"]|'); - } -/** - * test dump() - * - * @return void - **/ - function testDump() { - FireCake::dump('mydump', array('one' => 1, 'two' => 2)); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-2-1-1'], '28|{"mydump":{"one":1,"two":2}}|'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-2'])); - } -/** - * test table() generation - * - * @return void - **/ - function testTable() { - $table[] = array('Col 1 Heading','Col 2 Heading'); - $table[] = array('Row 1 Col 1','Row 1 Col 2'); - $table[] = array('Row 2 Col 1','Row 2 Col 2'); - $table[] = array('Row 3 Col 1','Row 3 Col 2'); - FireCake::table('myTrace', $table); - $expected = '162|[{"Type":"TABLE","Label":"myTrace"},[["Col 1 Heading","Col 2 Heading"],["Row 1 Col 1","Row 1 Col 2"],["Row 2 Col 1","Row 2 Col 2"],["Row 3 Col 1","Row 3 Col 2"]]]|'; - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], $expected); - } -/** - * testStringEncoding - * - * @return void - **/ - function testStringEncode() { - $vars = array(1,2,3); - $result = $this->firecake->stringEncode($vars); - $this->assertEqual($result, array(1,2,3)); - - $this->firecake->setOptions(array('maxArrayDepth' => 3)); - $deep = array(1 => array(2 => array(3))); - $result = $this->firecake->stringEncode($deep); - $this->assertEqual($result, array(1 => array(2 => '** Max Array Depth (3) **'))); - } -/** - * test object encoding - * - * @return void - **/ - function testStringEncodeObjects() { - $obj =& FireCake::getInstance(); - $result = $this->firecake->stringEncode($obj); - - $this->assertTrue(is_array($result)); - $this->assertEqual($result['_defaultOptions']['useNativeJsonEncode'], true); - $this->assertEqual($result['_log'], null); - $this->assertEqual($result['_encodedObjects'][0], '** Recursion (TestFireCake) **'); - } -/** - * test trace() - * - * @return void - **/ - function testTrace() { - FireCake::trace('myTrace'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $dump = $this->firecake->sentHeaders['X-Wf-1-1-1-1']; - $this->assertPattern('/"Message":"myTrace"/', $dump); - $this->assertPattern('/"Trace":\[/', $dump); - } -/** - * test enabling and disabling of FireCake output - * - * @return void - **/ - function testEnableDisable() { - FireCake::disable(); - FireCake::trace('myTrace'); - $this->assertTrue(empty($this->firecake->sentHeaders)); - - FireCake::enable(); - FireCake::trace('myTrace'); - $this->assertFalse(empty($this->firecake->sentHeaders)); - } - -/** - * test correct line continuation markers on multi line headers. - * - * @access public - * @return void - */ - function testMultiLineOutput() { - $skip = $this->skipIf(!PHP5, 'Output is not long enough with PHP4'); - if ($skip) { - return; - } - FireCake::trace('myTrace'); - - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3); - $header = $this->firecake->sentHeaders['X-Wf-1-1-1-1']; - $this->assertEqual(substr($header, -2), '|\\'); - - $header = $this->firecake->sentHeaders['X-Wf-1-1-1-2']; - $this->assertEqual(substr($header, -2), '|\\'); - - $header = $this->firecake->sentHeaders['X-Wf-1-1-1-3']; - $this->assertEqual(substr($header, -1), '|'); - } -/** - * test inclusion of line numbers - * - * @return void - **/ - function testIncludeLineNumbers() { - FireCake::setOptions(array('includeLineNumbers' => true)); - FireCake::info('Testing'); - $result = $this->firecake->sentHeaders['X-Wf-1-1-1-1']; - $this->assertPattern('/"File"\:".*fire_cake.test.php/', $result); - $this->assertPattern('/"Line"\:\d+/', $result); - } -/** - * test Group messages - * - * @return void - **/ - function testGroup() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::group('test'); - FireCake::info('my info'); - FireCake::groupEnd(); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '63|[{"Collapsed":"true","Type":"GROUP_START","Label":"test"},null]|'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-3'], '27|[{"Type":"GROUP_END"},null]|'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3); - } -/** - * test fb() parameter parsing - * - * @return void - **/ - function testFbParameterParsing() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::fb('Test'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '23|[{"Type":"LOG"},"Test"]|'); - - FireCake::fb('Test', 'warn'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '24|[{"Type":"WARN"},"Test"]|'); - - FireCake::fb('Test', 'Custom label', 'warn'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-3'], '47|[{"Type":"WARN","Label":"Custom label"},"Test"]|'); - - $this->expectError(); - $this->assertFalse(FireCake::fb('Test', 'Custom label', 'warn', 'more parameters')); - - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3); - } -/** - * Test defaulting to log if incorrect message type is used - * - * @return void - **/ - function testIncorrectMessageType() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::fb('Hello World', 'foobared'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '30|[{"Type":"LOG"},"Hello World"]|'); - } -/** - * testClientExtensionDetection. - * - * @return void - **/ - function testDetectClientExtension() { - $back = env('HTTP_USER_AGENT'); - $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 FirePHP/0.2.1'; - $this->assertTrue(FireCake::detectClientExtension()); - - $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 FirePHP/0.0.4'; - $this->assertFalse(FireCake::detectClientExtension()); - - $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4'; - $this->assertFalse(FireCake::detectClientExtension()); - $_SERVER['HTTP_USER_AGENT'] = $back; - } -/** - * test of Non Native JSON encoding. - * - * @return void - **/ - function testNonNativeEncoding() { - FireCake::setOptions(array('useNativeJsonEncode' => false)); - $json = FireCake::jsonEncode(array('one' => 1, 'two' => 2)); - $this->assertEqual($json, '{"one":1,"two":2}'); - - $json = FireCake::jsonEncode(array(1,2,3)); - $this->assertEqual($json, '[1,2,3]'); - - $json = FireCake::jsonEncode(FireCake::getInstance()); - $this->assertPattern('/"options"\:\{"maxObjectDepth"\:\d*,/', $json); - } -/** - * reset the FireCake counters and headers. - * - * @access public - * @return void - */ - function tearDown() { - TestFireCake::reset(); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/views/debug.test.php b/app/plugins/debug_kit2/tests/cases/views/debug.test.php deleted file mode 100644 index 3f09ca813..000000000 --- a/app/plugins/debug_kit2/tests/cases/views/debug.test.php +++ /dev/null @@ -1,157 +0,0 @@ - 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - $this->Controller =& ClassRegistry::init('Controller'); - $this->View =& new DebugView($this->Controller, false); - $this->_debug = Configure::read('debug'); - $this->_paths = array(); - $this->_paths['plugins'] = App::path('plugins'); - $this->_paths['views'] = App::path('views'); - $this->_paths['vendors'] = App::path('vendors'); - $this->_paths['controllers'] = App::path('controllers'); - } -/** - * tear down function - * - * @return void - **/ - function endTest() { - App::build(array( - 'plugins' => $this->_paths['plugins'], - 'views' => $this->_paths['views'], - 'vendors' => $this->_paths['vendors'], - 'controllers' => $this->_paths['controllers'] - )); - - unset($this->View, $this->Controller); - DebugKitDebugger::clearTimers(); - Configure::write('debug', $this->_debug); - } -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - App::build(array( - 'views' => array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - ) - ), true); - } -/** - * test that element timers are working - * - * @return void - **/ - function testElementTimers() { - $result = $this->View->element('test_element'); - $this->assertPattern('/^this is the test element$/', $result); - - $result = DebugKitDebugger::getTimers(); - $this->assertTrue(isset($result['render_test_element.ctp'])); - } -/** - * test rendering and ensure that timers are being set. - * - * @access public - * @return void - */ - function testRenderTimers() { - $this->Controller->viewPath = 'posts'; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index'), - 'base' => null, - 'here' => '/posts/index', - ); - $this->Controller->layout = 'default'; - $View =& new DebugView($this->Controller, false); - $View->render('index'); - - $result = DebugKitDebugger::getTimers(); - $this->assertEqual(count($result), 4); - $this->assertTrue(isset($result['viewRender'])); - $this->assertTrue(isset($result['render_default.ctp'])); - $this->assertTrue(isset($result['render_index.ctp'])); - - $result = DebugKitDebugger::getMemoryPoints(); - $this->assertTrue(isset($result['View render complete'])); - } -/** - * Test for correct loading of helpers into custom view - * - * @return void - */ - function testLoadHelpers() { - $loaded = array(); - $result = $this->View->_loadHelpers($loaded, array('Html', 'Javascript', 'Number')); - $this->assertTrue(is_object($result['Html'])); - $this->assertTrue(is_object($result['Javascript'])); - $this->assertTrue(is_object($result['Number'])); - } -/** - * test that $out is returned when a layout is rendered instead of the empty - * $this->output. As this causes issues with requestAction() - * - * @return void - **/ - function testProperReturnUnderRequestAction() { - $plugins = App::path('plugins'); - $views = App::path('views'); - $testapp = $plugins[1] . 'debug_kit' . DS . 'tests' . DS . 'test_app' . DS . 'views' . DS; - array_unshift($views, $testapp); - App::build(array('views' => $views), true); - - $this->View->set('test', 'I have been rendered.'); - $this->View->viewPath = 'debug_kit_test'; - $this->View->layout = false; - $result = $this->View->render('request_action_render'); - - $this->assertEqual($result, 'I have been rendered.'); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/views/helpers/fire_php_toolbar.test.php b/app/plugins/debug_kit2/tests/cases/views/helpers/fire_php_toolbar.test.php deleted file mode 100644 index dee687480..000000000 --- a/app/plugins/debug_kit2/tests/cases/views/helpers/fire_php_toolbar.test.php +++ /dev/null @@ -1,147 +0,0 @@ - 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - - $this->Toolbar =& new ToolbarHelper(array('output' => 'DebugKit.FirePhpToolbar')); - $this->Toolbar->FirePhpToolbar =& new FirePhpToolbarHelper(); - - $this->Controller =& ClassRegistry::init('Controller'); - if (isset($this->_debug)) { - Configure::write('debug', $this->_debug); - } - } -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - $this->_viewPaths = Configure::read('viewPaths'); - Configure::write('viewPaths', array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - )); - $this->_debug = Configure::read('debug'); - $this->firecake =& FireCake::getInstance(); - } -/** - * test neat array (dump)creation - * - * @return void - */ - function testMakeNeatArray() { - $this->Toolbar->makeNeatArray(array(1,2,3)); - $result = $this->firecake->sentHeaders; - $this->assertTrue(isset($result['X-Wf-1-1-1-1'])); - $this->assertPattern('/\[1,2,3\]/', $result['X-Wf-1-1-1-1']); - } -/** - * testAfterlayout element rendering - * - * @return void - */ - function testAfterLayout(){ - $this->Controller->viewPath = 'posts'; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index', 'ext' => 'xml'), - 'base' => null, - 'here' => '/posts/index', - ); - $this->Controller->layout = 'default'; - $this->Controller->uses = null; - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->constructClasses(); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->render(); - $this->assertNoPattern('/debug-toolbar/', $result); - $result = $this->firecake->sentHeaders; - $this->assertTrue(is_array($result)); - } -/** - * test starting a panel - * - * @return void - **/ - function testPanelStart() { - $this->Toolbar->panelStart('My Panel', 'my_panel'); - $result = $this->firecake->sentHeaders; - $this->assertPattern('/GROUP_START.+My Panel/', $result['X-Wf-1-1-1-1']); - } -/** - * test ending a panel - * - * @return void - **/ - function testPanelEnd() { - $this->Toolbar->panelEnd(); - $result = $this->firecake->sentHeaders; - $this->assertPattern('/GROUP_END/', $result['X-Wf-1-1-1-1']); - } -/** - * endTest() - * - * @return void - */ - function endTest() { - TestFireCake::reset(); - } -/** - * reset the view paths - * - * @return void - **/ - function endCase() { - Configure::write('viewPaths', $this->_viewPaths); - } -/** - * tearDown - * - * @access public - * @return void - */ - function tearDown() { - unset($this->Toolbar, $this->Controller); - ClassRegistry::removeObject('view'); - ClassRegistry::flush(); - Router::reload(); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/views/helpers/html_toolbar.test.php b/app/plugins/debug_kit2/tests/cases/views/helpers/html_toolbar.test.php deleted file mode 100644 index 01c2e4f7d..000000000 --- a/app/plugins/debug_kit2/tests/cases/views/helpers/html_toolbar.test.php +++ /dev/null @@ -1,352 +0,0 @@ - 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - - $this->Toolbar =& new ToolbarHelper(array('output' => 'DebugKit.HtmlToolbar')); - $this->Toolbar->HtmlToolbar =& new HtmlToolbarHelper(); - $this->Toolbar->HtmlToolbar->Html =& new HtmlHelper(); - $this->Toolbar->HtmlToolbar->Javascript =& new JavascriptHelper(); - - $this->Controller =& ClassRegistry::init('Controller'); - if (isset($this->_debug)) { - Configure::write('debug', $this->_debug); - } - } -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - $this->_viewPaths = Configure::read('viewPaths'); - Configure::write('viewPaths', array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - )); - $this->_debug = Configure::read('debug'); - } -/** - * test Neat Array formatting - * - * @return void - **/ - function testMakeNeatArray() { - $in = false; - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - - $in = null; - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - - $in = true; - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - - $in = array(); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - - $in = array('key' => 'value'); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - - $in = array('key' => null); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - - $in = array('key' => 'value', 'foo' => 'bar'); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - - $in = array( - 'key' => 'value', - 'foo' => array( - 'this' => 'deep', - 'another' => 'value' - ) - ); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - ' array('class' => 'neat-array depth-1')), - 'assertTags($result, $expected); - - $in = array( - 'key' => 'value', - 'foo' => array( - 'this' => 'deep', - 'another' => 'value' - ), - 'lotr' => array( - 'gandalf' => 'wizard', - 'bilbo' => 'hobbit' - ) - ); - $result = $this->Toolbar->makeNeatArray($in, 1); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0 expanded'), - ' array('class' => 'neat-array depth-1')), - ' array('class' => 'neat-array depth-1')), - 'assertTags($result, $expected); - - $result = $this->Toolbar->makeNeatArray($in, 2); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0 expanded'), - ' array('class' => 'neat-array depth-1 expanded')), - ' array('class' => 'neat-array depth-1 expanded')), - 'assertTags($result, $expected); - - $in = array('key' => 'value', 'array' => array()); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - 'assertTags($result, $expected); - } - -/** - * Test injection of toolbar - * - * @return void - **/ - function testInjectToolbar() { - $this->Controller->viewPath = 'posts'; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index'), - 'base' => null, - 'here' => '/posts/index', - ); - $this->Controller->helpers = array('Html', 'Javascript', 'DebugKit.Toolbar'); - $this->Controller->layout = 'default'; - $this->Controller->uses = null; - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->constructClasses(); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->render(); - $result = str_replace(array("\n", "\r"), '', $result); - $this->assertPattern('#
.+
#', $result); - } - -/** - * test injection of javascript - * - * @return void - **/ - function testJavascriptInjection() { - $this->Controller->viewPath = 'posts'; - $this->Controller->uses = null; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index'), - 'base' => '/', - 'here' => '/posts/index', - ); - $this->Controller->helpers = array('Javascript', 'Html'); - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->layout = 'default'; - $this->Controller->constructClasses(); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->render(); - $result = str_replace(array("\n", "\r"), '', $result); - $this->assertPattern('#\s?#', $result); - } - -/** - * test message creation - * - * @return void - */ - function testMessage() { - $result = $this->Toolbar->message('test', 'one, two'); - $expected = array( - 'assertTags($result, $expected); - } -/** - * Test Table generation - * - * @return void - */ - function testTable() { - $rows = array( - array(1,2), - array(3,4), - ); - $result = $this->Toolbar->table($rows); - $expected = array( - 'table' => array('class' =>'debug-table'), - array('tr' => array('class' => 'odd')), - ' array('class' => 'even')), - 'assertTags($result, $expected); - } -/** - * test starting a panel - * - * @return void - **/ - function testStartPanel() { - $result = $this->Toolbar->panelStart('My Panel', 'my_panel'); - $expected = array( - 'a' => array('href' => '#my_panel'), - 'My Panel', - '/a' - ); - $this->assertTags($result, $expected); - } -/** - * test ending a panel - * - * @return void - **/ - function testPanelEnd() { - $result = $this->Toolbar->panelEnd(); - $this->assertNull($result); - } -/** - * reset the view paths - * - * @return void - **/ - function endCase() { - Configure::write('viewPaths', $this->_viewPaths); - } - -/** - * tearDown - * - * @access public - * @return void - */ - function tearDown() { - unset($this->Toolbar, $this->Controller); - ClassRegistry::removeObject('view'); - ClassRegistry::flush(); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/cases/views/helpers/toolbar.test.php b/app/plugins/debug_kit2/tests/cases/views/helpers/toolbar.test.php deleted file mode 100644 index 1e1584883..000000000 --- a/app/plugins/debug_kit2/tests/cases/views/helpers/toolbar.test.php +++ /dev/null @@ -1,170 +0,0 @@ - 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - - $this->Toolbar =& new ToolbarHelper(array( - 'output' => 'MockBackendHelper', - 'cacheKey' => 'debug_kit_toolbar_test_case', - 'cacheConfig' => 'default' - )); - $this->Toolbar->MockBackend = new MockBackendHelper(); - - $this->Controller =& ClassRegistry::init('Controller'); - if (isset($this->_debug)) { - Configure::write('debug', $this->_debug); - } - } -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - $this->_viewPaths = Configure::read('viewPaths'); - Configure::write('viewPaths', array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - )); - $this->_debug = Configure::read('debug'); - } -/** - * test cache writing for views. - * - * @return void - **/ - function testCacheWrite() { - $result = $this->Toolbar->writeCache('test', array('stuff', 'to', 'cache')); - $this->assertTrue($result); - } -/** - * Ensure that the cache writing only affects the - * top most level of the history stack. As this is where the current request is stored. - * - * @return void - **/ - function testOnlyWritingToFirstElement() { - $values = array( - array('test' => array('content' => array('first', 'values'))), - array('test' => array('content' => array('second', 'values'))), - ); - Cache::write('debug_kit_toolbar_test_case', $values, 'default'); - $this->Toolbar->writeCache('test', array('new', 'values')); - - $result = $this->Toolbar->readCache('test'); - $this->assertEqual($result, array('new', 'values')); - - $result = $this->Toolbar->readCache('test', 1); - $this->assertEqual($result, array('second', 'values')); - } -/** - * test cache reading for views - * - * @return void - **/ - function testCacheRead() { - $result = $this->Toolbar->writeCache('test', array('stuff', 'to', 'cache')); - $this->assertTrue($result, 'Cache write failed %s'); - - $result = $this->Toolbar->readCache('test'); - $this->assertEqual($result, array('stuff', 'to', 'cache'), 'Cache value is wrong %s'); - - $result = $this->Toolbar->writeCache('test', array('new', 'stuff')); - $this->assertTrue($result, 'Cache write failed %s'); - - $result = $this->Toolbar->readCache('test'); - $this->assertEqual($result, array('new', 'stuff'), 'Cache value is wrong %s'); - } -/** - * Test that reading/writing doesn't work with no cache config. - * - * @return void - **/ - function testNoCacheConfigPresent() { - $this->Toolbar = new ToolbarHelper(array('output' => 'MockBackendHelper')); - - $result = $this->Toolbar->writeCache('test', array('stuff', 'to', 'cache')); - $this->assertFalse($result, 'Writing to cache succeeded with no cache config %s'); - - $result = $this->Toolbar->readCache('test'); - $this->assertFalse($result, 'Reading cache succeeded with no cache config %s'); - } -/** - * ensure that getQueryLogs works and writes to the cache so the history panel will - * work. - * - * @return void - */ - function testGetQueryLogs() { - $model =& new Model(array('ds' => 'test_suite', 'table' => 'posts')); - $model->find('all'); - $model->find('first'); - - $result = $this->Toolbar->getQueryLogs('test_suite', array('cache' => false)); - $this->assertTrue(is_array($result)); - $this->assertTrue(count($result) >= 2, 'Should be more than 2 queries in the log %s'); - $this->assertTrue(isset($result[0]['actions'])); - - Cache::delete('debug_kit_toolbar_test_case', 'default'); - $this->Toolbar->getQueryLogs('test_suite', array('cache' => true)); - - $cached = $this->Toolbar->readCache('sql_log'); - $this->assertTrue(isset($cached['test_suite'])); - $this->assertEqual($cached['test_suite'][0], $result[0]); - - } -/** - * reset the view paths - * - * @return void - **/ - function endCase() { - Configure::write('viewPaths', $this->_viewPaths); - Cache::delete('debug_kit_toolbar_test_case', 'default'); - } -/** - * endTest - * - * @access public - * @return void - */ - function endTest() { - unset($this->Toolbar, $this->Controller); - ClassRegistry::removeObject('view'); - ClassRegistry::flush(); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/groups/view_group.group.php b/app/plugins/debug_kit2/tests/groups/view_group.group.php deleted file mode 100644 index 4434089c4..000000000 --- a/app/plugins/debug_kit2/tests/groups/view_group.group.php +++ /dev/null @@ -1,45 +0,0 @@ - \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/test_app/controllers/debug_kit_test_controller.php b/app/plugins/debug_kit2/tests/test_app/controllers/debug_kit_test_controller.php deleted file mode 100644 index 52e3ec3f2..000000000 --- a/app/plugins/debug_kit2/tests/test_app/controllers/debug_kit_test_controller.php +++ /dev/null @@ -1,36 +0,0 @@ -autoRender = false; - return 'I am some value from requestAction.'; - } - - function request_action_render() { - $this->set('test', 'I have been rendered.'); - } - -} \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/test_app/vendors/test_panel.php b/app/plugins/debug_kit2/tests/test_app/vendors/test_panel.php deleted file mode 100644 index 5a111ed67..000000000 --- a/app/plugins/debug_kit2/tests/test_app/vendors/test_panel.php +++ /dev/null @@ -1,25 +0,0 @@ -testPanel = true; - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/tests/test_app/views/debug_kit_test/request_action_render.ctp b/app/plugins/debug_kit2/tests/test_app/views/debug_kit_test/request_action_render.ctp deleted file mode 100644 index 172d541d7..000000000 --- a/app/plugins/debug_kit2/tests/test_app/views/debug_kit_test/request_action_render.ctp +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/plugins/debug_kit2/vendors/debug_kit_debugger.php b/app/plugins/debug_kit2/vendors/debug_kit_debugger.php deleted file mode 100644 index 6428bebe7..000000000 --- a/app/plugins/debug_kit2/vendors/debug_kit_debugger.php +++ /dev/null @@ -1,401 +0,0 @@ -__benchmarks) { - return; - } - $timers = array_values(DebugKitDebugger::getTimers()); - $end = end($timers); - echo ''; - echo ''; - echo ''; - $i = 0; - foreach ($timers as $timer) { - $indent = 0; - for ($j = 0; $j < $i; $j++) { - if (($timers[$j]['end']) > ($timer['start']) && ($timers[$j]['end']) > ($timer['end'])) { - $indent++; - } - } - $indent = str_repeat(' ยป ', $indent); - - extract($timer); - $start = round($start * 1000, 0); - $end = round($end * 1000, 0); - $time = round($time * 1000, 0); - echo ""; - $i++; - } - echo '
Debug timer info
MessageStart Time (ms)End Time (ms)Duration (ms)
{$indent}$message$start$end$time
'; - } -/** - * Start an benchmarking timer. - * - * @param string $name The name of the timer to start. - * @param string $message A message for your timer - * @return bool true - * @static - **/ - function startTimer($name = null, $message = null) { - $start = getMicrotime(); - $_this =& DebugKitDebugger::getInstance(); - - if (!$name) { - $named = false; - $calledFrom = debug_backtrace(); - $_name = $name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line']; - } else { - $named = true; - } - - if (!$message) { - $message = $name; - } - - $_name = $name; - $i = 1; - while (isset($_this->__benchmarks[$name])) { - $i++; - $name = $_name . ' #' . $i; - } - - if ($i > 1) { - $message .= ' #' . $i; - } - - $_this->__benchmarks[$name] = array( - 'start' => $start, - 'message' => $message, - 'named' => $named - ); - return true; - } -/** - * Stop a benchmarking timer. - * - * $name should be the same as the $name used in startTimer(). - * - * @param string $name The name of the timer to end. - * @access public - * @return boolean true if timer was ended, false if timer was not started. - * @static - */ - function stopTimer($name = null) { - $end = getMicrotime(); - $_this =& DebugKitDebugger::getInstance(); - if (!$name) { - $names = array_reverse(array_keys($_this->__benchmarks)); - foreach($names as $name) { - if (!empty($_this->__benchmarks[$name]['end'])) { - continue; - } - if (empty($_this->__benchmarks[$name]['named'])) { - break; - } - } - } else { - $i = 1; - $_name = $name; - while (isset($_this->__benchmarks[$name])) { - if (empty($_this->__benchmarks[$name]['end'])) { - break; - } - $i++; - $name = $_name . ' #' . $i; - } - } - if (!isset($_this->__benchmarks[$name])) { - return false; - } - $_this->__benchmarks[$name]['end'] = $end; - return true; - } -/** - * Get all timers that have been started and stopped. - * Calculates elapsed time for each timer. If clear is true, will delete existing timers - * - * @param bool $clear false - * @return array - * @access public - **/ - function getTimers($clear = false) { - $_this =& DebugKitDebugger::getInstance(); - $start = DebugKitDebugger::requestStartTime(); - $now = getMicrotime(); - - $times = array(); - if (!empty($_this->__benchmarks)) { - $firstTimer = current($_this->__benchmarks); - $_end = $firstTimer['start']; - } else { - $_end = $now; - } - $times['Core Processing (Derived)'] = array( - 'message' => __d('debug_kit', 'Core Processing (Derived)', true), - 'start' => 0, - 'end' => $_end - $start, - 'time' => round($_end - $start, 6), - 'named' => null - ); - foreach ($_this->__benchmarks as $name => $timer) { - if (!isset($timer['end'])) { - $timer['end'] = $now; - } - $times[$name] = array_merge($timer, array( - 'start' => $timer['start'] - $start, - 'end' => $timer['end'] - $start, - 'time' => DebugKitDebugger::elapsedTime($name) - )); - } - if ($clear) { - $_this->__benchmarks = array(); - } - return $times; - } -/** - * Clear all existing timers - * - * @return bool true - **/ - function clearTimers() { - $_this =& DebugKitDebugger::getInstance(); - $_this->__benchmarks = array(); - return true; - } -/** - * Get the difference in time between the timer start and timer end. - * - * @param $name string the name of the timer you want elapsed time for. - * @param $precision int the number of decimal places to return, defaults to 5. - * @return float number of seconds elapsed for timer name, 0 on missing key - * @static - **/ - function elapsedTime($name = 'default', $precision = 5) { - $_this =& DebugKitDebugger::getInstance(); - if (!isset($_this->__benchmarks[$name]['start']) || !isset($_this->__benchmarks[$name]['end'])) { - return 0; - } - return round($_this->__benchmarks[$name]['end'] - $_this->__benchmarks[$name]['start'], $precision); - } -/** - * Get the total execution time until this point - * - * @access public - * @return float elapsed time in seconds since script start. - * @static - */ - function requestTime() { - $start = DebugKitDebugger::requestStartTime(); - $now = getMicroTime(); - return ($now - $start); - } -/** - * get the time the current request started. - * - * @access public - * @return float time of request start - * @static - */ - function requestStartTime() { - if (defined('TIME_START')) { - $startTime = TIME_START; - } else if (isset($GLOBALS['TIME_START'])) { - $startTime = $GLOBALS['TIME_START']; - } else { - $startTime = env('REQUEST_TIME'); - } - return $startTime; - } -/** - * get current memory usage - * - * @return integer number of bytes ram currently in use. 0 if memory_get_usage() is not available. - * @static - **/ - function getMemoryUse() { - if (!function_exists('memory_get_usage')) { - return 0; - } - return memory_get_usage(); - } -/** - * Get peak memory use - * - * @return integer peak memory use (in bytes). Returns 0 if memory_get_peak_usage() is not available - * @static - **/ - function getPeakMemoryUse() { - if (!function_exists('memory_get_peak_usage')) { - return 0; - } - return memory_get_peak_usage(); - } -/** - * Stores a memory point in the internal tracker. - * Takes a optional message name which can be used to identify the memory point. - * If no message is supplied a debug_backtrace will be done to identifty the memory point. - * If you don't have memory_get_xx methods this will not work. - * - * @param string $message Message to identify this memory point. - * @return boolean - **/ - function setMemoryPoint($message = null) { - $memoryUse = DebugKitDebugger::getMemoryUse(); - if (!$message) { - $named = false; - $trace = debug_backtrace(); - $message = Debugger::trimpath($trace[0]['file']) . ' line ' . $trace[0]['line']; - } - $self =& DebugKitDebugger::getInstance(); - if (isset($self->__memoryPoints[$message])) { - $originalMessage = $message; - $i = 1; - while (isset($self->__memoryPoints[$message])) { - $i++; - $message = $originalMessage . ' #' . $i; - } - } - $self->__memoryPoints[$message] = $memoryUse; - return true; - } -/** - * Get all the stored memory points - * - * @param boolean $clear Whether you want to clear the memory points as well. Defaults to false. - * @return array Array of memory marks stored so far. - **/ - function getMemoryPoints($clear = false) { - $self =& DebugKitDebugger::getInstance(); - $marks = $self->__memoryPoints; - if ($clear) { - $self->__memoryPoints = array(); - } - return $marks; - } -/** - * Clear out any existing memory points - * - * @return void - **/ - function clearMemoryPoints() { - $self =& DebugKitDebugger::getInstance(); - $self->__memoryPoints = array(); - } -/** - * Handles object conversion to debug string. - * - * @param string $var Object to convert - * @access protected - */ - function _output($data = array()) { - extract($data); - if (is_array($level)) { - $error = $level['error']; - $code = $level['code']; - if (isset($level['helpID'])) { - $helpID = $level['helpID']; - } else { - $helpID = ''; - } - $description = $level['description']; - $file = $level['file']; - $line = $level['line']; - $context = $level['context']; - $level = $level['level']; - } - $files = $this->trace(array('start' => 2, 'format' => 'points')); - $listing = $this->excerpt($files[0]['file'], $files[0]['line'] - 1, 1); - $trace = $this->trace(array('start' => 2, 'depth' => '20')); - - if ($this->_outputFormat == 'fb') { - $kontext = array(); - foreach ((array)$context as $var => $value) { - $kontext[] = "\${$var}\t=\t" . $this->exportVar($value, 1); - } - $this->_fireError($error, $code, $description, $file, $line, $trace, $kontext); - } else { - $data = compact( - 'level', 'error', 'code', 'helpID', 'description', 'file', 'path', 'line', 'context' - ); - echo parent::_output($data); - } - } -/** - * Create a FirePHP error message - * - * @param string $error Name of error - * @param string $code Code of error - * @param string $description Description of error - * @param string $file File error occured in - * @param string $line Line error occured on - * @param string $trace Stack trace at time of error - * @param string $context context of error - * @return void - * @access protected - */ - function _fireError($error, $code, $description, $file, $line, $trace, $context) { - $name = $error . ' - ' . $description; - $message = "$error $code $description on line: $line in file: $file"; - FireCake::group($name); - FireCake::error($message, $name); - FireCake::log($context, 'Context'); - FireCake::log($trace, 'Trace'); - FireCake::groupEnd(); - } -} - - -Debugger::invoke(DebugKitDebugger::getInstance()); -Debugger::getInstance('DebugKitDebugger'); -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/vendors/fire_cake.php b/app/plugins/debug_kit2/vendors/fire_cake.php deleted file mode 100644 index d3faaaa1b..000000000 --- a/app/plugins/debug_kit2/vendors/fire_cake.php +++ /dev/null @@ -1,547 +0,0 @@ - 10, - 'maxArrayDepth' => 20, - 'useNativeJsonEncode' => true, - 'includeLineNumbers' => true, - ); -/** - * Message Levels for messages sent via FirePHP - * - * @var array - */ - var $_levels = array( - 'log' => 'LOG', - 'info' => 'INFO', - 'warn' => 'WARN', - 'error' => 'ERROR', - 'dump' => 'DUMP', - 'trace' => 'TRACE', - 'exception' => 'EXCEPTION', - 'table' => 'TABLE', - 'groupStart' => 'GROUP_START', - 'groupEnd' => 'GROUP_END', - ); - - var $_version = '0.2.1'; -/** - * internal messageIndex counter - * - * @var int - * @access protected - */ - var $_messageIndex = 1; -/** - * stack of objects encoded by stringEncode() - * - * @var array - **/ - var $_encodedObjects = array(); -/** - * methodIndex to include in tracebacks when using includeLineNumbers - * - * @var array - **/ - var $_methodIndex = array('info', 'log', 'warn', 'error', 'table', 'trace'); -/** - * FireCake output status - * - * @var bool - **/ - var $_enabled = true; -/** - * get Instance of the singleton - * - * @param string $class Class instance to store in the singleton. Used with subclasses and Tests. - * @access public - * @static - * @return void - */ - function &getInstance($class = null) { - static $instance = array(); - if (!empty($class)) { - if (!$instance || strtolower($class) != strtolower(get_class($instance[0]))) { - $instance[0] =& new $class(); - $instance[0]->setOptions(); - } - } - if (!isset($instance[0]) || !$instance[0]) { - $instance[0] =& new FireCake(); - $instance[0]->setOptions(); - } - return $instance[0]; - } -/** - * setOptions - * - * @param array $options Array of options to set. - * @access public - * @static - * @return void - */ - function setOptions($options = array()) { - $_this =& FireCake::getInstance(); - if (empty($_this->options)) { - $_this->options = array_merge($_this->_defaultOptions, $options); - } else { - $_this->options = array_merge($_this->options, $options); - } - } -/** - * Return boolean based on presence of FirePHP extension - * - * @access public - * @return boolean - **/ - function detectClientExtension() { - $ua = FireCake::getUserAgent(); - if (!preg_match('/\sFirePHP\/([\.|\d]*)\s?/si', $ua, $match) || !version_compare($match[1], '0.0.6', '>=')) { - return false; - } - return true; - } -/** - * Get the Current UserAgent - * - * @access public - * @static - * @return string UserAgent string of active client connection - **/ - function getUserAgent() { - return env('HTTP_USER_AGENT'); - } -/** - * Disable FireCake output - * All subsequent output calls will not be run. - * - * @return void - **/ - function disable() { - $_this =& FireCake::getInstance(); - $_this->_enabled = false; - } -/** - * Enable FireCake output - * - * @return void - **/ - function enable() { - $_this =& FireCake::getInstance(); - $_this->_enabled = true; - } -/** - * Convenience wrapper for LOG messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function log($message, $label = null) { - FireCake::fb($message, $label, 'log'); - } -/** - * Convenience wrapper for WARN messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function warn($message, $label = null) { - FireCake::fb($message, $label, 'warn'); - } -/** - * Convenience wrapper for INFO messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function info($message, $label = null) { - FireCake::fb($message, $label, 'info'); - } -/** - * Convenience wrapper for ERROR messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function error($message, $label = null) { - FireCake::fb($message, $label, 'error'); - } -/** - * Convenience wrapper for TABLE messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function table($label, $message) { - FireCake::fb($message, $label, 'table'); - } -/** - * Convenience wrapper for DUMP messages - * - * @param string $message Message to log - * @param string $label Unique label for message - * @access public - * @static - * @return void - */ - function dump($label, $message) { - FireCake::fb($message, $label, 'dump'); - } -/** - * Convenience wrapper for TRACE messages - * - * @param string $label Label for message (optional) - * @access public - * @return void - */ - function trace($label) { - FireCake::fb($label, 'trace'); - } -/** - * Convenience wrapper for GROUP messages - * Messages following the group call will be nested in a group block - * - * @param string $label Label for group (optional) - * @access public - * @return void - */ - function group($label) { - FireCake::fb(null, $label, 'groupStart'); - } -/** - * Convenience wrapper for GROUPEND messages - * Closes a group block - * - * @param string $label Label for group (optional) - * @access public - * @return void - */ - function groupEnd() { - FireCake::fb(null, null, 'groupEnd'); - } -/** - * fb - Send messages with FireCake to FirePHP - * - * Much like FirePHP's fb() this method can be called with various parameter counts - * fb($message) - Just send a message defaults to LOG type - * fb($message, $type) - Send a message with a specific type - * fb($message, $label, $type) - Send a message with a custom label and type. - * - * @param mixed $message Message to output. For other parameters see usage above. - * @static - * @return void - **/ - function fb($message) { - $_this =& FireCake::getInstance(); - - if (headers_sent($filename, $linenum)) { - trigger_error(sprintf(__d('debug_kit', 'Headers already sent in %s on line %s. Cannot send log data to FirePHP.', true), $filename, $linenum), E_USER_WARNING); - return false; - } - if (!$_this->_enabled || !$_this->detectClientExtension()) { - return false; - } - - $args = func_get_args(); - $type = $label = null; - switch (count($args)) { - case 1: - $type = $_this->_levels['log']; - break; - case 2: - $type = $args[1]; - break; - case 3: - $type = $args[2]; - $label = $args[1]; - break; - default: - trigger_error(__d('debug_kit', 'Incorrect parameter count for FireCake::fb()', true), E_USER_WARNING); - return false; - } - if (isset($_this->_levels[$type])) { - $type = $_this->_levels[$type]; - } else { - $type = $_this->_levels['log']; - } - - $meta = array(); - $skipFinalObjectEncode = false; - if ($type == $_this->_levels['trace']) { - $trace = debug_backtrace(); - if (!$trace) { - return false; - } - $message = $_this->_parseTrace($trace, $args[0]); - $skipFinalObjectEncode = true; - } - - if ($_this->options['includeLineNumbers']) { - if (!isset($meta['file']) || !isset($meta['line'])) { - $trace = debug_backtrace(); - for ($i = 0, $len = count($trace); $i < $len ; $i++) { - $keySet = (isset($trace[$i]['class']) && isset($trace[$i]['function'])); - $selfCall = ($keySet && - strtolower($trace[$i]['class']) == 'firecake' && - in_array($trace[$i]['function'], $_this->_methodIndex) - ); - if ($selfCall) { - $meta['File'] = isset($trace[$i]['file']) ? Debugger::trimPath($trace[$i]['file']) : ''; - $meta['Line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : ''; - break; - } - } - } - } - - $structureIndex = 1; - if ($type == $_this->_levels['dump']) { - $structureIndex = 2; - $_this->_sendHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); - } else { - $_this->_sendHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); - } - - $_this->_sendHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); - $_this->_sendHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'. $_this->_version); - if ($type == $_this->_levels['groupStart']) { - $meta['Collapsed'] = 'true'; - } - if ($type == $_this->_levels['dump']) { - $dump = $_this->jsonEncode($message); - $msg = '{"' . $label .'":' . $dump .'}'; - } else { - $meta['Type'] = $type; - if ($label !== null) { - $meta['Label'] = $label; - } - $msg = '[' . $_this->jsonEncode($meta) . ',' . $_this->jsonEncode($message, $skipFinalObjectEncode).']'; - } - - $lines = explode("\n", chunk_split($msg, 5000, "\n")); - - foreach ($lines as $i => $line) { - if (empty($line)) { - continue; - } - $header = 'X-Wf-1-' . $structureIndex . '-1-' . $_this->_messageIndex; - if (count($lines) > 2) { - $first = ($i == 0) ? strlen($msg) : ''; - $end = ($i < count($lines) - 2) ? '\\' : ''; - $message = $first . '|' . $line . '|' . $end; - $_this->_sendHeader($header, $message); - } else { - $_this->_sendHeader($header, strlen($line) . '|' . $line . '|'); - } - $_this->_messageIndex++; - if ($_this->_messageIndex > 99999) { - trigger_error(__d('debug_kit', 'Maximum number (99,999) of messages reached!', true), E_USER_WARNING); - } - } - $_this->_sendHeader('X-Wf-1-Index', $_this->_messageIndex - 1); - return true; - } -/** - * Parse a debug backtrace - * - * @param array $trace Debug backtrace output - * @access protected - * @return array - **/ - function _parseTrace($trace, $messageName) { - $message = array(); - for ($i = 0, $len = count($trace); $i < $len ; $i++) { - $keySet = (isset($trace[$i]['class']) && isset($trace[$i]['function'])); - $selfCall = ($keySet && $trace[$i]['class'] == 'FireCake'); - if (!$selfCall) { - $message = array( - 'Class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : '', - 'Type' => isset($trace[$i]['type']) ? $trace[$i]['type'] : '', - 'Function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : '', - 'Message' => $messageName, - 'File' => isset($trace[$i]['file']) ? Debugger::trimPath($trace[$i]['file']) : '', - 'Line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : '', - 'Args' => isset($trace[$i]['args']) ? $this->stringEncode($trace[$i]['args']) : '', - 'Trace' => $this->_escapeTrace(array_splice($trace, $i + 1)) - ); - break; - } - } - return $message; - } -/** - * Fix a trace for use in output - * - * @param mixed $trace Trace to fix - * @access protected - * @static - * @return string - **/ - function _escapeTrace($trace) { - for ($i = 0, $len = count($trace); $i < $len; $i++) { - if (isset($trace[$i]['file'])) { - $trace[$i]['file'] = Debugger::trimPath($trace[$i]['file']); - } - if (isset($trace[$i]['args'])) { - $trace[$i]['args'] = $this->stringEncode($trace[$i]['args']); - } - } - return $trace; - } -/** - * Encode non string objects to string. - * Filter out recursion, so no errors are raised by json_encode or $javascript->object() - * - * @param mixed $object Object or variable to encode to string. - * @param int $objectDepth Current Depth in object chains. - * @param int $arrayDepth Current Depth in array chains. - * @static - * @return void - **/ - function stringEncode($object, $objectDepth = 1, $arrayDepth = 1) { - $_this =& FireCake::getInstance(); - $return = array(); - if (is_resource($object)) { - return '** ' . (string)$object . '**'; - } - if (is_object($object)) { - if ($objectDepth == $_this->options['maxObjectDepth']) { - return '** Max Object Depth (' . $_this->options['maxObjectDepth'] . ') **'; - } - foreach ($_this->_encodedObjects as $encoded) { - if ($encoded === $object) { - return '** Recursion (' . get_class($object) . ') **'; - } - } - $_this->_encodedObjects[] =& $object; - - $return['__className'] = $class = get_class($object); - $properties = (array)$object; - foreach ($properties as $name => $property) { - $return[$name] = FireCake::stringEncode($property, 1, $objectDepth + 1); - } - array_pop($_this->_encodedObjects); - } - if (is_array($object)) { - if ($arrayDepth == $_this->options['maxArrayDepth']) { - return '** Max Array Depth ('. $_this->options['maxArrayDepth'] . ') **'; - } - foreach ($object as $key => $value) { - $return[$key] = FireCake::stringEncode($value, 1, $arrayDepth + 1); - } - } - if (is_string($object) || is_numeric($object) || is_bool($object) || is_null($object)) { - return $object; - } - return $return; - } -/** - * Encode an object into JSON - * - * @param mixed $object Object or array to json encode - * @param boolean $doIt - * @access public - * @static - * @return string - **/ - function jsonEncode($object, $skipEncode = false) { - $_this =& FireCake::getInstance(); - if (!$skipEncode) { - $object = FireCake::stringEncode($object); - } - - if (function_exists('json_encode') && $_this->options['useNativeJsonEncode']) { - return json_encode($object); - } else { - return FireCake::_jsonEncode($object); - } - } -/** - * jsonEncode Helper method for PHP4 compatibility - * - * @param mixed $object Something to encode - * @access protected - * @static - * @return string - **/ - function _jsonEncode($object) { - if (!class_exists('JavascriptHelper')) { - App::import('Helper', 'Javascript'); - } - $javascript =& new JavascriptHelper(); - $javascript->useNative = false; - if (is_string($object)) { - return '"' . $javascript->escapeString($object) . '"'; - } - return $javascript->object($object); - } -/** - * Send Headers - write headers. - * - * @access protected - * @return void - **/ - function _sendHeader($name, $value) { - header($name . ': ' . $value); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/vendors/shells/benchmark.php b/app/plugins/debug_kit2/vendors/shells/benchmark.php deleted file mode 100644 index aa64231cd..000000000 --- a/app/plugins/debug_kit2/vendors/shells/benchmark.php +++ /dev/null @@ -1,168 +0,0 @@ -args) || count($this->args) > 1) { - return $this->help(); - } - - $url = $this->args[0]; - $defaults = array('t' => 100, 'n' => 10); - $options = array_merge($defaults, $this->params); - $times = array(); - - $this->out(String::insert(__d('debug_kit', '-> Testing :url', true), compact('url'))); - $this->out(""); - for ($i = 0; $i < $options['n']; $i++) { - if (floor($options['t'] - array_sum($times)) <= 0 || $options['n'] <= 1) { - break; - } - - $start = microtime(true); - file_get_contents($url); - $stop = microtime(true); - - $times[] = $stop - $start; - } - $this->_results($times); - } -/** - * Prints calculated results - * - * @param array $times Array of time values - * @return void - * @access protected - */ - function _results($times) { - $duration = array_sum($times); - $requests = count($times); - - $this->out(String::insert(__d('debug_kit', 'Total Requests made: :requests', true), compact('requests'))); - $this->out(String::insert(__d('debug_kit', 'Total Time elapsed: :duration (seconds)', true), compact('duration'))); - - $this->out(""); - - $this->out(String::insert(__d('debug_kit', 'Requests/Second: :rps req/sec', true), array( - 'rps' => round($requests / $duration, 3) - ))); - - $this->out(String::insert(__d('debug_kit', 'Average request time: :average-time seconds', true), array( - 'average-time' => round($duration / $requests, 3) - ))); - - $this->out(String::insert(__d('debug_kit', 'Standard deviation of average request time: :std-dev', true), array( - 'std-dev' => round($this->_deviation($times, true), 3) - ))); - - $this->out(String::insert(__d('debug_kit', 'Longest/shortest request: :longest sec/:shortest sec', true), array( - 'longest' => round(max($times), 3), - 'shortest' => round(min($times), 3) - ))); - - $this->out(""); - - } -/** - * One-pass, numerically stable calculation of population variance. - * - * Donald E. Knuth (1998). - * The Art of Computer Programming, volume 2: Seminumerical Algorithms, 3rd edn., - * p. 232. Boston: Addison-Wesley. - * - * @param array $times Array of values - * @param boolean $sample If true, calculates an unbiased estimate of the population - * variance from a finite sample. - * @return float Variance - * @access protected - */ - function _variance($times, $sample = true) { - $n = $mean = $M2 = 0; - - foreach($times as $time){ - $n += 1; - $delta = $time - $mean; - $mean = $mean + $delta/$n; - $M2 = $M2 + $delta*($time - $mean); - } - - if ($sample) $n -= 1; - - return $M2/$n; - } -/** - * Calculate the standard deviation. - * - * @param array $times Array of values - * @return float Standard deviation - * @access protected - */ - function _deviation($times, $sample = true) { - return sqrt($this->_variance($times, $sample)); - } -/** - * Help for Benchmark shell - * - * @return void - * @access public - */ - function help() { - $this->out(__d('debug_kit', "DebugKit Benchmark Shell", true)); - $this->out(""); - $this->out(__d('debug_kit', "\tAllows you to obtain some rough benchmarking statistics \n\tabout a fully qualified URL.", true)); - $this->out(""); - $this->out(__d('debug_kit', "\tUse:", true)); - $this->out(__d('debug_kit', "\t\tcake benchmark [-n iterations] [-t timeout] url", true)); - $this->out(""); - $this->out(__d('debug_kit', "\tParams:", true)); - $this->out(__d('debug_kit', "\t\t-n Number of iterations to perform. Defaults to 10. \n\t\t Must be an integer.", true)); - $this->out(__d('debug_kit', "\t\t-t Maximum total time for all iterations, in seconds. \n\t\t Defaults to 100. Must be an integer.", true)); - $this->out(""); - $this->out(__d('debug_kit', "\tIf a single iteration takes more than the \n\ttimeout specified, only one request will be made.", true)); - $this->out(""); - $this->out(__d('debug_kit', "\tExample Use:", true)); - $this->out(__d('debug_kit', "\t\tcake benchmark -n 10 -t 100 http://localhost/testsite", true)); - $this->out(""); - $this->out(__d('debug_kit', "\tNote that this benchmark does not include browser render time", true)); - $this->out(""); - $this->hr(); - $this->out(""); - } -} - -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/debug.php b/app/plugins/debug_kit2/views/debug.php deleted file mode 100644 index 73cf305ff..000000000 --- a/app/plugins/debug_kit2/views/debug.php +++ /dev/null @@ -1,82 +0,0 @@ -loaded['toolbar'])) { - $backend = $this->loaded['toolbar']->getName(); - $this->loaded['toolbar']->{$backend}->send(); - } - if (empty($this->output)) { - return $out; - } - //Temporary work around to hide the SQL dump at page bottom - Configure::write('debug', 0); - return $this->output; - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/debug_toolbar.ctp b/app/plugins/debug_kit2/views/elements/debug_toolbar.ctp deleted file mode 100644 index b7172b0f4..000000000 --- a/app/plugins/debug_kit2/views/elements/debug_toolbar.ctp +++ /dev/null @@ -1,56 +0,0 @@ - -
- -

- - - -
\ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/history_panel.ctp b/app/plugins/debug_kit2/views/elements/history_panel.ctp deleted file mode 100644 index 235816e3a..000000000 --- a/app/plugins/debug_kit2/views/elements/history_panel.ctp +++ /dev/null @@ -1,195 +0,0 @@ - -

- -

- - -
    -
  • link(__d('debug_kit', 'Restore to current request', true), - '#', array('class' => 'history-link', 'id' => 'history-restore-current')); ?> -
  • - -
  • link($previous['title'], $previous['url'], array('class' => 'history-link')); ?>
  • - -
- - - \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/log_panel.ctp b/app/plugins/debug_kit2/views/elements/log_panel.ctp deleted file mode 100644 index fbb68c124..000000000 --- a/app/plugins/debug_kit2/views/elements/log_panel.ctp +++ /dev/null @@ -1,40 +0,0 @@ - -

-
- $logs): ?> -

- 0): - $headers = array(__d('debug_kit', 'Time', true), __d('debug_kit', 'Message', true)); - $rows = array(); - for ($i = 0; $i < $len; $i += 2): - $rows[] = array( - $logs[$i], h($logs[$i + 1]) - ); - endfor; - echo $toolbar->table($rows, $headers, array('title' => $logName)); - else: ?> -

- - -
\ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/request_panel.ctp b/app/plugins/debug_kit2/views/elements/request_panel.ctp deleted file mode 100644 index 3b48f966c..000000000 --- a/app/plugins/debug_kit2/views/elements/request_panel.ctp +++ /dev/null @@ -1,36 +0,0 @@ - -

-

Cake Params

-makeNeatArray($content['params']); ?> - -

$_GET

-makeNeatArray($content['get']); ?> - -

Cookie

- - makeNeatArray($content['cookie']); ?> - -

To view Cookies, add CookieComponent to Controller

- - -

-makeNeatArray($content['currentRoute']); ?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/session_panel.ctp b/app/plugins/debug_kit2/views/elements/session_panel.ctp deleted file mode 100644 index 3b620f860..000000000 --- a/app/plugins/debug_kit2/views/elements/session_panel.ctp +++ /dev/null @@ -1,22 +0,0 @@ - -

-makeNeatArray($content); ?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/sql_log_panel.ctp b/app/plugins/debug_kit2/views/elements/sql_log_panel.ctp deleted file mode 100644 index 8f2b80e4e..000000000 --- a/app/plugins/debug_kit2/views/elements/sql_log_panel.ctp +++ /dev/null @@ -1,90 +0,0 @@ -readCache('sql_log', $this->params['pass'][0]); -} -?> -

- - $explain): ?> -
-

- getQueryLogs($dbName, array( - 'explain' => $explain, 'threshold' => $content['threshold'] - )); - else: - $queryLog = $content[$dbName]; - endif; - echo $toolbar->table($queryLog, $headers, array('title' => 'SQL Log ' . $dbName)); - ?> -

-
- -

-
-
- -message('Warning', __d('debug_kit', 'No active database connections', true)); -endif; ?> - - \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/timer_panel.ctp b/app/plugins/debug_kit2/views/elements/timer_panel.ctp deleted file mode 100644 index e0de45ba6..000000000 --- a/app/plugins/debug_kit2/views/elements/timer_panel.ctp +++ /dev/null @@ -1,108 +0,0 @@ -readCache('timer', $this->params['pass'][0]); - if (is_array($content)): - extract($content); - endif; -endif; -?> -
-

-
- message(__d('debug_kit', 'Peak Memory Use', true), $number->toReadableSize($peakMemory)); ?> -
- - $value): - $rows[] = array($key, $number->toReadableSize($value)); - endforeach; - - echo $toolbar->table($rows, $headers); - ?> -
- -
-

-
- precision($requestTime * 1000, 0)); ?> - message(__d('debug_kit', 'Total Request Time:', true), $totalTime)?> -
- $timeInfo): - $indent = 0; - for ($j = 0; $j < $i; $j++) { - if (($values[$j]['end'] > $timeInfo['start']) && ($values[$j]['end']) > ($timeInfo['end'])) { - $indent++; - } - } - $indent = str_repeat(' ยป ', $indent); - $rows[] = array( - $indent . $timeInfo['message'], - $number->precision($timeInfo['time'] * 1000, 2), - $simpleGraph->bar( - $number->precision($timeInfo['time'] * 1000, 2), - $number->precision($timeInfo['start'] * 1000, 2), - array( - 'max' => $maxTime * 1000, - 'requestTime' => $requestTime * 1000, - ) - ) - ); - $i++; -endforeach; - -if (strtolower($toolbar->getName()) == 'firephptoolbar'): - for ($i = 0, $len = count($rows); $i < $len; $i++): - unset($rows[$i][2]); - endfor; - unset($headers[2]); -endif; - -echo $toolbar->table($rows, $headers, array('title' => 'Timers')); - -if (!isset($debugKitInHistoryMode)): - $toolbar->writeCache('timer', compact('timers', 'currentMemory', 'peakMemory', 'requestTime')); -endif; -?> -
\ No newline at end of file diff --git a/app/plugins/debug_kit2/views/elements/variables_panel.ctp b/app/plugins/debug_kit2/views/elements/variables_panel.ctp deleted file mode 100644 index 7f97eb736..000000000 --- a/app/plugins/debug_kit2/views/elements/variables_panel.ctp +++ /dev/null @@ -1,25 +0,0 @@ - -

-validationErrors'] = $this->validationErrors; -$content['Loaded Helpers'] = array_keys($this->loaded); -echo $toolbar->makeNeatArray($content); ?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/helpers/fire_php_toolbar.php b/app/plugins/debug_kit2/views/helpers/fire_php_toolbar.php deleted file mode 100644 index b0afa8565..000000000 --- a/app/plugins/debug_kit2/views/helpers/fire_php_toolbar.php +++ /dev/null @@ -1,97 +0,0 @@ - 'firePHP', 'forceEnable' => false); -/** - * send method - * - * @return void - * @access protected - */ - function send() { - $view =& ClassRegistry::getObject('view'); - $view->element('debug_toolbar', array('plugin' => 'debug_kit', 'disableTimer' => true)); - } -/** - * makeNeatArray. - * - * wraps FireCake::dump() allowing panel elements to continue functioning - * - * @param string $values - * @return void - */ - function makeNeatArray($values) { - FireCake::info($values); - } -/** - * Create a simple message - * - * @param string $label Label of message - * @param string $message Message content - * @return void - */ - function message($label, $message) { - FireCake::log($message, $label); - } -/** - * Generate a table with FireCake - * - * @param array $rows Rows to print - * @param array $headers Headers for table - * @param array $options Additional options and params - * @return void - */ - function table($rows, $headers, $options = array()) { - $title = $headers[0]; - if (isset($options['title'])) { - $title = $options['title']; - } - array_unshift($rows, $headers); - FireCake::table($title, $rows); - } -/** - * Start a panel which is a 'Group' in FirePHP - * - * @return void - **/ - function panelStart($title, $anchor) { - FireCake::group($title); - } -/** - * End a panel (Group) - * - * @return void - **/ - function panelEnd() { - FireCake::groupEnd(); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/helpers/html_toolbar.php b/app/plugins/debug_kit2/views/helpers/html_toolbar.php deleted file mode 100644 index ca0a7b8eb..000000000 --- a/app/plugins/debug_kit2/views/helpers/html_toolbar.php +++ /dev/null @@ -1,181 +0,0 @@ - 'html', 'forceEnable' => false); -/** - * Recursively goes through an array and makes neat HTML out of it. - * - * @param mixed $values Array to make pretty. - * @param int $openDepth Depth to add open class - * @param int $currentDepth current depth. - * @return string - **/ - function makeNeatArray($values, $openDepth = 0, $currentDepth = 0) { - $className ="neat-array depth-$currentDepth"; - if ($openDepth > $currentDepth) { - $className .= ' expanded'; - } - $nextDepth = $currentDepth + 1; - $out = "
    "; - if (!is_array($values)) { - if (is_bool($values)) { - $values = array($values); - } - if (is_null($values)) { - $values = array(null); - } - } - if (empty($values)) { - $values[] = '(empty)'; - } - foreach ($values as $key => $value) { - $out .= '
  • ' . $key . ''; - if ($value === null) { - $value = '(null)'; - } - if ($value === false) { - $value = '(false)'; - } - if ($value === true) { - $value = '(true)'; - } - if (empty($value) && $value != 0) { - $value = '(empty)'; - } - - if (is_object($value)) { - $value = Set::reverse($value, true); - } - - if (is_array($value) && !empty($value)) { - $out .= $this->makeNeatArray($value, $openDepth, $nextDepth); - } else { - $out .= h($value); - } - $out .= '
  • '; - } - $out .= '
'; - return $out; - } -/** - * Create an HTML message - * - * @param string $label label content - * @param string $message message content - * @return string - */ - function message($label, $message) { - return sprintf('

%s %s

', $label, $message); - } -/** - * Start a panel. - * make a link and anchor. - * - * @return void - **/ - function panelStart($title, $anchor) { - $link = $this->Html->link($title, '#' . $anchor); - return $link; - } -/** - * Create a table. - * - * @param array $rows Rows to make. - * @param array $headers Optional header row. - * @return string - */ - function table($rows, $headers = array()) { - $out = ''; - if (!empty($headers)) { - $out .= $this->Html->tableHeaders($headers); - } - $out .= $this->Html->tableCells($rows, array('class' => 'odd'), array('class' => 'even'), false, false); - $out .= '
'; - return $out; - } -/** - * send method - * - * @return void - * @access public - */ - function send() { - if (!$this->settings['forceEnable'] && Configure::read('debug') == 0) { - return; - } - $view =& ClassRegistry::getObject('view'); - $head = $this->Html->css('/debug_kit/css/debug_toolbar'); - if (isset($view->viewVars['debugToolbarJavascript'])) { - foreach ($view->viewVars['debugToolbarJavascript'] as $script) { - if ($script) { - $head .= $this->Javascript->link($script); - } - } - } - if (preg_match('##', $view->output)) { - $view->output = preg_replace('##', $head . "\n", $view->output, 1); - } - $toolbar = $view->element('debug_toolbar', array('plugin' => 'debug_kit', 'disableTimer' => true)); - if (preg_match('##', $view->output)) { - $view->output = preg_replace('##', $toolbar . "\n", $view->output, 1); - } - } -/** - * Generates a SQL explain link for a given query - * - * @param string $sql SQL query string you want an explain link for. - * @return string Rendered Html link or '' if the query is not a select/describe - */ - function explainLink($sql, $connection) { - if (!preg_match('/^(SELECT)/i', $sql)) { - return ''; - } - App::import('Core', 'Security'); - $hash = Security::hash($sql . $connection, null, true); - $url = array( - 'plugin' => 'debug_kit', - 'controller' => 'toolbar_access', - 'action' => 'sql_explain', - 'ds' => $connection, - 'sql' => $sql, - 'hash' => $hash - ); - return $this->Html->link(__d('debug_kit', 'Explain', true), $url, array('class' => 'sql-explain-link')); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/helpers/simple_graph.php b/app/plugins/debug_kit2/views/helpers/simple_graph.php deleted file mode 100644 index 2b8bddabe..000000000 --- a/app/plugins/debug_kit2/views/helpers/simple_graph.php +++ /dev/null @@ -1,85 +0,0 @@ - (int) Maximum value in the graphs - * - width => (int) - * - valueType => string (value, percentage) - * - style => array - * - * @var array - */ - var $__defaultSettings = array( - 'max' => 100, - 'width' => 350, - 'valueType' => 'value', - ); -/** - * bar method - * - * @param $value Value to be graphed - * @param $offset how much indentation - * @param $options Graph options - * @return string Html graph - * @access public - */ - function bar($value, $offset, $options = array()) { - $settings = array_merge($this->__defaultSettings, $options); - extract($settings); - - $graphValue = ($value / $max) * $width; - $graphValue = max(round($graphValue), 1); - - if ($valueType == 'percentage') { - $graphOffset = 0; - } else { - $graphOffset = ($offset / $max) * $width; - $graphOffset = round($graphOffset); - } - return $this->Html->div( - 'debug-kit-graph-bar', - $this->Html->div( - 'debug-kit-graph-bar-value', - ' ', - array( - 'style' => "margin-left: {$graphOffset}px; width: {$graphValue}px", - 'title' => sprintf(__("Starting %sms into the request, taking %sms", true), $offset, $value), - ) - ), - array('style' => "width: {$width}px;"), - false - ); - } -} -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/helpers/toolbar.php b/app/plugins/debug_kit2/views/helpers/toolbar.php deleted file mode 100644 index 1fa4f402e..000000000 --- a/app/plugins/debug_kit2/views/helpers/toolbar.php +++ /dev/null @@ -1,178 +0,0 @@ -_myName = strtolower(get_class($this)); - $this->settings = am($this->settings, $options); - - if ($this->_myName !== 'toolbarhelper') { - return; - } - - if (!isset($options['output'])) { - $options['output'] = 'DebugKit.HtmlToolbar'; - } - App::import('Helper', $options['output']); - $className = $options['output']; - if (strpos($options['output'], '.') !== false) { - list($plugin, $className) = explode('.', $options['output']); - } - $this->_backEndClassName = $className; - $this->helpers[$options['output']] = $options; - if (isset($options['cacheKey']) && isset($options['cacheConfig'])) { - $this->_cacheKey = $options['cacheKey']; - $this->_cacheConfig = $options['cacheConfig']; - $this->_cacheEnabled = true; - } - } -/** - * Get the name of the backend Helper - * used to conditionally trigger toolbar output - * - * @return string - **/ - function getName() { - return $this->_backEndClassName; - } -/** - * call__ - * - * Allows method calls on backend helper - * - * @param string $method - * @param mixed $params - * @access public - * @return void - */ - function call__($method, $params) { - if (method_exists($this->{$this->_backEndClassName}, $method)) { - return $this->{$this->_backEndClassName}->dispatchMethod($method, $params); - } - } -/** - * Allows for writing to panel cache from view. - * Some panels generate all variables in the view by - * necessity ie. Timer. Using this method, will allow you to replace in full - * the content for a panel. - * - * @param string $name Name of the panel you are replacing. - * @param string $content Content to write to the panel. - * @return boolean Sucess of write. - **/ - function writeCache($name, $content) { - if (!$this->_cacheEnabled) { - return false; - } - $existing = (array)Cache::read($this->_cacheKey, $this->_cacheConfig); - $existing[0][$name]['content'] = $content; - return Cache::write($this->_cacheKey, $existing, $this->_cacheConfig); - } -/** - * Read the toolbar - * - * @param string $name Name of the panel you want cached data for - * @return mixed Boolean false on failure, array of data otherwise. - **/ - function readCache($name, $index = 0) { - if (!$this->_cacheEnabled) { - return false; - } - $existing = (array)Cache::read($this->_cacheKey, $this->_cacheConfig); - if (!isset($existing[$index][$name]['content'])) { - return false; - } - return $existing[$index][$name]['content']; - } -/** - * Gets the query logs for the given connection names. - * - * ### Options - * - * - explain - Whether explain links should be generated for this connection. - * - cache - Whether the toolbar_state Cache should be updated. - * - threshold - The threshold at which a visual 'maybe slow' flag should be added. - * results with rows/ms lower than $threshold will be marked. - * - * @param string $connection Connection name to get logs for. - * @param array $options Options for the query log retrieval. - * @return array Array of data to be converted into a table. - */ - function getQueryLogs($connection, $options = array()) { - $options += array('explain' => false, 'cache' => true, 'threshold' => 20); - App::import('Model', 'ConnectionManager'); - $db =& ConnectionManager::getDataSource($connection); - - $out = array(); - $log = $db->getLog(); - foreach ($log as $i => $query) { - $isSlow = ( - $query['took'] > 0 && - $query['numRows'] / $query['took'] != 1 && - $query['numRows'] / $query['took'] <= $options['threshold'] - ); - $query['actions'] = ''; - $isHtml = ($this->getName() == 'HtmlToolbar'); - if ($isSlow && $isHtml) { - $query['actions'] = sprintf( - '%s', - __d('debug_kit', 'maybe slow', true) - ); - } elseif ($isSlow) { - $query['actions'] = '*'; - } - if ($options['explain'] && $isHtml) { - $query['actions'] .= $this->explainLink($query['query'], $connection); - } - if ($isHtml) { - $query['query'] = h($query['query']); - } - $out[] = $query; - } - if ($options['cache']) { - $existing = $this->readCache('sql_log'); - $existing[$connection] = $out; - $this->writeCache('sql_log', $existing); - } - return $out; - } -} \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/toolbar_access/history_state.ctp b/app/plugins/debug_kit2/views/toolbar_access/history_state.ctp deleted file mode 100644 index c7ad685a4..000000000 --- a/app/plugins/debug_kit2/views/toolbar_access/history_state.ctp +++ /dev/null @@ -1,29 +0,0 @@ - $panel) { - $panels[$panelName] = $this->element($panel['elementName'], array( - 'content' => $panel['content'], - 'plugin' => $panel['plugin'] - )); -} -echo $javascript->object($panels); -Configure::write('debug', 0); -?> \ No newline at end of file diff --git a/app/plugins/debug_kit2/views/toolbar_access/sql_explain.ctp b/app/plugins/debug_kit2/views/toolbar_access/sql_explain.ctp deleted file mode 100644 index 36e59a323..000000000 --- a/app/plugins/debug_kit2/views/toolbar_access/sql_explain.ctp +++ /dev/null @@ -1,9 +0,0 @@ - -tableHeaders($headers); -echo $html->tableCells($result); -?> -
- \ No newline at end of file diff --git a/app/plugins/debug_kit2/webroot/css/debug_toolbar.css b/app/plugins/debug_kit2/webroot/css/debug_toolbar.css deleted file mode 100644 index 13ade5352..000000000 --- a/app/plugins/debug_kit2/webroot/css/debug_toolbar.css +++ /dev/null @@ -1,312 +0,0 @@ -/* @override http://localhost/mark_story/site/debug_kit/css/debug_toolbar.css */ -#debug-kit-toolbar { - position: fixed; - top: 0px; - right:0px; - width: 100%; - height: 1%; - overflow: visible; - z-index:10000; - font-family: helvetica, arial, sans-serif; - font-size: 12px; - direction: ltr; -} -#debug-kit-toolbar img { - border:0; - outline:0; -} - -/* panel tabs */ -#debug-kit-toolbar #panel-tabs { - float: right; - list-style: none; - margin: 0; -} -#debug-kit-toolbar .panel-tab { - clear: none; - float: left; - margin: 0; - padding: 0; - list-style: none; -} -#debug-kit-toolbar .panel-tab a { - float: left; - clear: none; - background: #efefef; - background: -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#cacaca)); - background: -moz-linear-gradient(left top, left bottom, from(#efefef), to(#cacaca)); - color: #222; - padding: 6px; - border-right: 1px solid #ccc; - border-bottom: 1px solid #aaa; - font-size: 12px; - line-height: 16px; - margin: 0; - display: block; - text-decoration:none; - text-shadow:1px 1px #eee; - -moz-text-shadow:1px 1px #eee; - -webkit-text-shadow:1px 1px #eee; -} -#debug-kit-toolbar .panel-tab .active { - background: #fff; - background: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#fff)); -} -#debug-kit-toolbar .panel-tab a:hover { - background: #fff; - background: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#fff)); - text-decoration:underline; -} -#debug-kit-toolbar .panel-tab.icon a { - padding: 4px; -} -#debug-kit-toolbar .panel-tab a.edit-value { - float: none; - display: inline; -} - -/* Hovering over link shows tab, useful for no js */ -#debug-kit-toolbar .panel-tab a:hover + .panel-content, -#debug-kit-toolbar .panel-tab a + .panel-content:hover { - display: block; -} -#debug-kit-toolbar .panel-tab.icon a { - -webkit-border-top-left-radius: 8px 8px; - -webkit-border-bottom-left-radius: 8px 8px; - -moz-border-radius-topleft: 8px; - -moz-border-radius-bottomleft: 8px -} -#debug-kit-toolbar .panel-tab.icon img { - display:block; -} - -/* panel content */ -#debug-kit-toolbar .panel-content { - position: absolute; - text-align: left; - width: auto; - top:28px; - right:0px; - background: #fff; - color: #000; - width:100%; - box-shadow:0px 5px 6px #ccc; -} - -#debug-kit-toolbar .panel-resize-region { - overflow:auto; - height:99%; - max-height: 550px; - padding:15px; -} - -#debug-kit-toolbar .panel-resize-handle { - width:100%; - background:#ccc; - background: -webkit-gradient(linear, left top, left bottom, from(#d6d6d6), to(#c2c2c2)); - text-align:center; - cursor:move; - border-top:1px solid #afafaf; - border-bottom:1px solid #7c7c7c; - color:#666; - text-shadow:1px 1px #eee; - -webkit-text-shadow:1px 1px #eee; - -moz-text-shadow:1px 1px #eee; - height:14px; -} - -/* Hide panel content by default */ -#debug-kit-toolbar .panel-content { - display: none; -} -.panel-content p { - margin: 1em 0; -} -.panel-content h2 { - padding: 0; - margin-top:0; -} -.panel-content h3 { - padding: 0; - margin-top: 1em; -} -.panel-content .info { - padding: 4px; - border-top: 1px dashed #6c6cff; - border-bottom: 1px dashed #6c6cff; -} -#debug-kit-toolbar h1, -#debug-kit-toolbar h2, -#debug-kit-toolbar h3, -#debug-kit-toolbar h4, -#debug-kit-toolbar h5, -#debug-kit-toolbar th { - color: #5d1717; - font-family: "Trebuchet MS", trebuchet, helvetica, arial, sans-serif; - margin-bottom:0.6em; - background:none; -} -#debug-kit-toolbar h1 { - font-size: 18px; -} -#debug-kit-toolbar h2 { - font-size: 16px; -} -#debug-kit-toolbar h4 { - font-size: 14px; -} - - -/* panel tables */ -#debug-kit-toolbar table.debug-table { - width: 100%; - border: 0; - clear:both; -} -#debug-kit-toolbar table.debug-table td, -#debug-kit-toolbar table.debug-table th { - text-align: left; - border: 0; - padding: 3px; -} -#debug-kit-toolbar table.debug-table th { - border-bottom: 1px solid #222; - background: 0; - color: #252525; -} -#debug-kit-toolbar table.debug-table tr:nth-child(2n+1) td { - background:#f6f6f6; -} -#debug-kit-toolbar table.debug-table tr.even td { - background:#f7f7f7; -} -#debug-kit-toolbar .debug-timers .debug-table td:nth-child(2), -#debug-kit-toolbar .debug-timers .debug-table th:nth-child(2) { - text-align:right; -} - -/** code tables **/ -#debug-kit-toolbar .code-table td { - white-space: pre; - font-family: monaco, corsiva, "courier new", courier, monospaced; -} -#debug-kit-toolbar .code-table td:first-child { - width: 15%; -} -#debug-kit-toolbar .code-table td:last-child { - width: 80%; -} - -#debug-kit-toolbar .panel-content.request { - display: block; -} - -/** Neat Array styles **/ -#debug-kit-toolbar .neat-array, -#debug-kit-toolbar .neat-array li { - list-style:none; - list-style-image:none; -} -.neat-array { - padding: 1px 2px 1px 20px; - background: #CE9E23; - list-style: none; - margin: 0 0 1em 0; -} -.neat-array .neat-array { - padding: 0 0 0 20px; - margin:0; - border-top:1px solid #CE9E23; -} -.neat-array li { - background: #FEF6E5; - border-top: 1px solid #CE9E23; - border-bottom: 1px solid #CE9E23; - margin: 0; - line-height: 1.5em; -} -.neat-array li:hover { - background: #fff; -} -.neat-array li strong { - padding: 0 8px; - font-weight: bold; -} - - -/* expandable sections */ -.neat-array li.expandable { - cursor: pointer; -} -.neat-array .expanded { - border-bottom:0; -} -.neat-array li.expandable.expanded > strong:before { - content: 'v '; -} -.neat-array li.expandable.collapsed > strong:before, -.neat-array li.expandable.expanded .expandable.collapsed > strong:before { - content: '> '; -} -.neat-array li { - cursor: default; -} - -#debug-kit-toolbar .debug-kit-graph-bar, -#debug-kit-toolbar .debug-kit-graph-bar-value { - margin: 0; - padding: 0px; - border: none; - overflow: hidden; - height: 10px; -} -#debug-kit-toolbar .debug-kit-graph-bar { - background-color: #ddd; - padding:2px; -} -#debug-kit-toolbar .debug-kit-graph-bar-value { - background-color: #CE9E23; -} - -/* Sql Log */ -#sql_log-tab td, -#sql_log-tab .slow-query-container p { - font-family: Monaco, 'Corsiva', "Courier New", Courier, monospaced; -} -#debug-kit-toolbar #sql_log-tab a.show-slow { - display:block; - margin: 3px; - float:none; -} -#sql_log-tab .slow-query-container p { - display:block; - clear:both; - margin: 20px 0 5px; -} -#debug-kit-toolbar #sql_log-tab a { - background: none; - border:none; -} -#sql_log-tab .slow-query { - background:#e79302; - font-size:9px; - color:#fff; - padding: 2px; - white-space:nowrap; -} - -/* previous panels */ -#debug-kit-toolbar .panel-history { - display: none; - background:#eeffff; -} -#debug-kit-toolbar #history-tab a { - float: none; -} -#debug-kit-toolbar #history-tab a.active { - background: #FEF6E5; -} -#debug-kit-toolbar #history-tab a.loading:after { - content : ' Loading...'; - font-style:italic; -} diff --git a/app/plugins/debug_kit2/webroot/img/cake.icon.png b/app/plugins/debug_kit2/webroot/img/cake.icon.png deleted file mode 100644 index 394fa42d5..000000000 Binary files a/app/plugins/debug_kit2/webroot/img/cake.icon.png and /dev/null differ diff --git a/app/plugins/debug_kit2/webroot/js/js_debug_toolbar.js b/app/plugins/debug_kit2/webroot/js/js_debug_toolbar.js deleted file mode 100644 index 5deb9184d..000000000 --- a/app/plugins/debug_kit2/webroot/js/js_debug_toolbar.js +++ /dev/null @@ -1,700 +0,0 @@ -/** - * Debug Toolbar Javascript. - * - * Creates the DEBUGKIT namespace and provides methods for extending - * and enhancing the Html toolbar. Includes library agnostic Event, Element, - * Cookie and Request wrappers. - * - * - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) - * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org) - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://cakephp.org - * @package debug_kit - * @subpackage debug_kit.views.helpers - * @since DebugKit 0.1 - * @license MIT License (http://www.opensource.org/licenses/mit-license.php) - */ -var DEBUGKIT = function () { - var undef; - return { - module: function (newmodule) { - if (this[newmodule] === undef) { - this[newmodule] = {}; - return this[newmodule]; - } - return this[newmodule]; - } - }; -}() ; - -DEBUGKIT.loader = function () { - return { - //list of methods to run on startup. - _startup: [], - - //register a new method to be run on dom ready. - register: function (method) { - this._startup.push(method); - }, - - init: function () { - for (var i = 0, callback; callback = this._startup[i]; i++) { - callback.init(); - } - } - }; -}(); - -//Util module and Element utility class. -DEBUGKIT.module('Util'); -DEBUGKIT.Util.Element = { - - //test if an element is a name node. - nodeName: function (element, name) { - return element.nodeName && element.nodeName.toLowerCase() == name.toLowerCase(); - }, - - //return a boolean if the element has the classname - hasClass: function (element, className) { - if (!element.className) { - return false; - } - return element.className.indexOf(className) > -1; - }, - - addClass: function (element, className) { - if (!element.className) { - element.className = className; - return; - } - element.className = element.className.replace(/^(.*)$/, '$1 ' + className); - }, - - removeClass: function (element, className) { - if (DEBUGKIT.Util.isArray(element)) { - DEBUGKIT.Util.Collection.apply(element, function (element) { - Element.removeClass(element, className); - }); - } - if (!element.className) { - return false; - } - element.className = element.className.replace(new RegExp(' ?(' + className +') ?'), ''); - }, - - swapClass: function (element, removeClass, addClass) { - if (!element.className) { - return false; - } - element.className = element.className.replace(removeClass, addClass); - }, - - show: function (element) { - element.style.display = 'block'; - }, - - hide: function (element) { - element.style.display = 'none'; - }, - - //go between hide() and show() depending on element.style.display - toggle: function (element) { - if (element.style.display == 'none') { - this.show(element); - return; - } - this.hide(element); - }, - - _walk: function (element, walk) { - var sibling = element[walk]; - while (true) { - if (sibling.nodeType == 1) { - break; - } - sibling = sibling[walk]; - } - return sibling; - }, - - getNext: function (element) { - return this._walk(element, 'nextSibling'); - }, - - getPrevious: function (element) { - return this._walk(element, 'previousSibling'); - }, - - //get or set an element's height, omit value to get, add value (integer) to set. - height: function (element, value) { - //get value - if (value === undefined) { - return parseInt(this.getStyle(element, 'height')); - } - element.style.height = value + 'px'; - }, - - //gets the style in css format for property - getStyle: function (element, property) { - if (element.currentStyle) { - property = property.replace(/-[a-z]/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - return element.currentStyle[property]; - } - if (window.getComputedStyle) { - return document.defaultView.getComputedStyle(element, null).getPropertyValue(property); - } - } -}; - -DEBUGKIT.Util.Collection = { - /* - Apply the passed function to each item in the collection. - The current element in the collection will be `this` in the callback - The callback is also passed the element and the index as arguments. - Optionally you can supply a binding parameter to change `this` in the callback. - */ - apply: function (collection, callback, binding) { - //for (var i = 0, len = collection.length; i < len; i++) { - for (var i in collection) { - if (!collection.hasOwnProperty(i)) { - continue; - } - var thisVar = collection[i]; - if (binding !== undefined) { - thisVar = binding; - } - callback.apply(thisVar, [collection[i], i]); - } - } -} - - -//Event binding -DEBUGKIT.Util.Event = function () { - var _listeners = {}, - _eventId = 0; - - var preventDefault = function () { - this.returnValue = false; - } - - var stopPropagation = function () { - this.cancelBubble = true; - } - - // Fixes IE's broken event object, adds in common methods + properties. - var fixEvent = function (event) { - event.preventDefault = event.preventDefault || preventDefault; - event.stopPropagation = event.stopPropagation || stopPropagation; - return event; - } - - return { - // bind an event listener of type to element, handler is your method. - addEvent: function(element, type, handler, capture) { - capture = (capture === undefined) ? false : capture; - - var callback = function (event) { - event = fixEvent(event || window.event); - handler.apply(this, [event]); - }; - - if (element.addEventListener) { - element.addEventListener(type, callback, capture); - } else if (element.attachEvent) { - type = 'on' + type; - element.attachEvent(type, callback); - } else { - type = 'on' + type; - element[type] = callback; - } - _listeners[++_eventId] = {element: element, type: type, handler: callback}; - }, - - // destroy an event listener. requires the exact same function as was used for attaching - // the event. - removeEvent: function (element, type, handler) { - if (element.removeEventListener) { - element.removeEventListener(type, handler, false); - } else if (element.detachEvent) { - type = 'on' + type; - element.detachEvent(type, handler); - } else { - type = 'on' + type; - element[type] = null; - } - }, - - // bind an event to the DOMContentLoaded or other similar event. - domready: function(callback) { - if (document.addEventListener) { - return document.addEventListener("DOMContentLoaded", callback, false); - } - - if (document.all && !window.opera) { - //Define a "blank" external JavaScript tag - document.write('