Skip to content

Commit

Permalink
Remove the ResponseBuilder flag and instead use the existing PIWIK_PR…
Browse files Browse the repository at this point in the history
…INT_ERROR_BACKTRACE
  • Loading branch information
mattab committed Apr 3, 2014
1 parent f2e5c90 commit e485781
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 23 deletions.
8 changes: 2 additions & 6 deletions core/API/ResponseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
class ResponseBuilder
{
const DISPLAY_BACKTRACE_DEBUG = false;

private $request = null;
private $outputFormat = null;

Expand Down Expand Up @@ -162,12 +160,10 @@ protected function decorateExceptionWithDebugTrace(Exception $e)
{
// If we are in tests, show full backtrace
if (defined('PIWIK_PATH_TEST_TO_ROOT')) {
if (self::DISPLAY_BACKTRACE_DEBUG
|| \Piwik_ShouldPrintBackTraceWithMessage()
) {
if (\Piwik_ShouldPrintBackTraceWithMessage()) {
$message = $e->getMessage() . " in \n " . $e->getFile() . ":" . $e->getLine() . " \n " . $e->getTraceAsString();
} else {
$message = $e->getMessage() . "\n \n --> To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in " . basename(__FILE__);
$message = $e->getMessage() . "\n \n --> To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php";
}
return new Exception($message);
}
Expand Down
3 changes: 1 addition & 2 deletions core/testMinimumPhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@
function Piwik_ShouldPrintBackTraceWithMessage()
{
$bool = (defined('PIWIK_PRINT_ERROR_BACKTRACE') && PIWIK_PRINT_ERROR_BACKTRACE)
|| (defined('PIWIK_TRACKER_DEBUG') && PIWIK_TRACKER_DEBUG)
|| \Piwik\API\ResponseBuilder::DISPLAY_BACKTRACE_DEBUG;
|| (defined('PIWIK_TRACKER_DEBUG') && PIWIK_TRACKER_DEBUG);
return $bool;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/CustomAlerts
3 changes: 1 addition & 2 deletions tests/PHPUnit/Core/ReleaseCheckListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public function testCheckThatConfigurationValuesAreProductionValues()
require_once PIWIK_INCLUDE_PATH . "/core/TaskScheduler.php";
$this->assertFalse(DEBUG_FORCE_SCHEDULED_TASKS);

require_once PIWIK_INCLUDE_PATH . "/core/API/ResponseBuilder.php";
$this->assertFalse(\Piwik\API\ResponseBuilder::DISPLAY_BACKTRACE_DEBUG);
$this->assertFalse(PIWIK_PRINT_ERROR_BACKTRACE);
}

private function _checkEqual($key, $valueExpected)
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Integration/Core/LogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Core_LogTest extends DatabaseTestCase
public static $expectedExceptionOutput = array(
'screen' => 'dummy error message<br />
<br />
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php',
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php',
'file' => '[Core_LogTest] LogTest.php(161): dummy error message
dummy backtrace',
'database' => '[Core_LogTest] LogTest.php(161): dummy error message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="Please specify a value for 'label'.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="Row evolutions can not be processed with this combination of \'date\' and \'period\' parameters.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<error message="Requested report Goals.get for Website id=1 not found in the list of available reports.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="Referrers.getAll with multiple sites or dates is not supported (yet).
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="Referrers.getAll with multiple sites or dates is not supported (yet).
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="VisitTime.getByDayOfWeek does not support multiple dates.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<result>
<error message="VisitTime.getByDayOfWeek does not support multiple dates.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>

0 comments on commit e485781

Please sign in to comment.