Skip to content

Commit

Permalink
do not output DB information, and do not set header
Browse files Browse the repository at this point in the history
  • Loading branch information
blizzz committed Nov 14, 2014
1 parent 08205c6 commit 74ffda8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
8 changes: 7 additions & 1 deletion lib/private/db/adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ public function insertIfNotExist($table, $input) {
$entry = 'DB Error: "'.$e->getMessage() . '"<br />';
$entry .= 'Offending command was: ' . $query.'<br />';
\OC_Log::write('core', $entry, \OC_Log::FATAL);
throw new \OC\HintException($entry);
$l = \OC::$server->getL10N('lib');
throw new \OC\HintException(
$l->t('Database Error'),
$l->t('Please contact your system administrator.'),
0,
$e
);
}
}
}
16 changes: 14 additions & 2 deletions lib/private/db/adaptersqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ public function insertIfNotExist($table, $input) {
$entry = 'DB Error: "'.$e->getMessage() . '"<br />';
$entry .= 'Offending command was: ' . $query . '<br />';
\OC_Log::write('core', $entry, \OC_Log::FATAL);
throw new \OC\HintException($entry);
$l = \OC::$server->getL10N('lib');
throw new \OC\HintException(
$l->t('Database Error'),
$l->t('Please contact your system administrator.'),
0,
$e
);
}

if ($stmt->fetchColumn() === '0') {
Expand All @@ -59,7 +65,13 @@ public function insertIfNotExist($table, $input) {
$entry = 'DB Error: "'.$e->getMessage() . '"<br />';
$entry .= 'Offending command was: ' . $query.'<br />';
\OC_Log::write('core', $entry, \OC_Log::FATAL);
throw new \OC\HintException($entry);
$l = \OC::$server->getL10N('lib');
throw new \OC\HintException(
$l->t('Database Error'),
$l->t('Please contact your system administrator.'),
0,
$e
);
}

return $result;
Expand Down
11 changes: 7 additions & 4 deletions lib/private/db/statementwrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,13 @@ private function tryFixSubstringLastArgumentDataForMSSQL($input) {
OC_Log::write('core', $entry, OC_Log::FATAL);
OC_User::setUserId(null);

// send http status 503
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
throw new \OC\HintException($entry);
$l = \OC::$server->getL10N('lib');
throw new \OC\HintException(
$l->t('Database Error'),
$l->t('Please contact your system administrator.'),
0,
$e
);
}
}

Expand Down

0 comments on commit 74ffda8

Please sign in to comment.