aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-10 12:40:02 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-10 12:40:02 +0000
commite1c54733c388ef0f75d6288c7add7d381e583ac5 (patch)
treede0161810fe6458ceca78f9849aa95193c21e94c
parent60973c259b643f92f96fadf2effc1f37dd930898 (diff)
downloadelgg-e1c54733c388ef0f75d6288c7add7d381e583ac5.tar.gz
elgg-e1c54733c388ef0f75d6288c7add7d381e583ac5.tar.bz2
handling the database being down/busy or an incomplete install. Also cleaned up failsafe views
git-svn-id: http://code.elgg.org/elgg/trunk@7044 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/elgglib.php3
-rw-r--r--engine/lib/install.php3
-rw-r--r--languages/en.php3
-rw-r--r--views/failsafe/messages/exceptions/exception.php16
-rw-r--r--views/failsafe/page_shells/default.php114
5 files changed, 25 insertions, 114 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 16e20ef7c..4376ca53f 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1401,9 +1401,10 @@ function __elgg_php_exception_handler($exception) {
// make sure the error isn't cached
header("Cache-Control: no-cache, must-revalidate", true);
header('Expires: Fri, 05 Feb 1982 00:00:00 -0500', true);
- // @todo Why don't we send a 500 header?
+ // @note Do not send a 500 header because it is not a server error
//header("Internal Server Error", true, 500);
+ elgg_set_viewtype('failsafe');
$body = elgg_view("messages/exceptions/exception", array('object' => $exception));
page_draw(elgg_echo('exception:title'), $body);
}
diff --git a/engine/lib/install.php b/engine/lib/install.php
index 9deec9e26..f36b528da 100644
--- a/engine/lib/install.php
+++ b/engine/lib/install.php
@@ -53,7 +53,6 @@ function verify_installation() {
$installed = is_installed();
} catch (DatabaseException $e) {}
if (!$installed) {
- header("Location: install.php");
- exit;
+ throw new InstallationException(elgg_echo('InstallationException:SiteNotInstalled'));
}
}
diff --git a/languages/en.php b/languages/en.php
index 5dd1874d7..2806168c6 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -36,12 +36,13 @@ $english = array(
/**
* Errors
*/
- 'exception:title' => "Welcome to Elgg.",
+ 'exception:title' => "Fatal Error.",
'actionundefined' => "The requested action (%s) was not defined in the system.",
'actionloggedout' => "Sorry, you cannot perform this action while logged out.",
'actionunauthorized' => 'You are unauthorized to perform this action',
+ 'InstallationException:SiteNotInstalled' => 'Unable to handle this request. This site is not configured or the database is down.',
'InstallationException:MissingLibrary' => 'Could not load %s',
'InstallationException:CannotLoadSettings' => 'Elgg could not load the settings file. It does not exist or there is a file permissions issue.',
diff --git a/views/failsafe/messages/exceptions/exception.php b/views/failsafe/messages/exceptions/exception.php
index d3877f0c8..d8c4a5f92 100644
--- a/views/failsafe/messages/exceptions/exception.php
+++ b/views/failsafe/messages/exceptions/exception.php
@@ -1,6 +1,6 @@
<?php
/**
- * Elgg exception (fallback mode)
+ * Elgg exception (failsafe mode)
* Displays a single exception
*
* @package Elgg
@@ -11,10 +11,9 @@
* @uses $vars['object'] An exception
*/
-global $CONFIG;
?>
-<p class="messages-exception" style="background:#FDFFC3;display:block;padding:10px;">
+<p class="messages_exception">
<span title="<?php echo get_class($vars['object']); ?>">
<?php
@@ -24,13 +23,18 @@ global $CONFIG;
</span>
</p>
-<?php if (isset($CONFIG->debug)) { ?>
+<?php
+global $CONFIG;
+if (isset($CONFIG->debug)) {
+?>
-<p class="messages-exception-detail" style="background:#FDFFC3;display:block;padding:10px;">
+<p class="messages_exception">
<?php
echo nl2br(htmlentities(print_r($vars['object'], true), ENT_QUOTES, 'UTF-8'));
?>
</p>
-<?php } ?> \ No newline at end of file
+<?php
+
+}
diff --git a/views/failsafe/page_shells/default.php b/views/failsafe/page_shells/default.php
index 6cbefcdaf..50ccc74d6 100644
--- a/views/failsafe/page_shells/default.php
+++ b/views/failsafe/page_shells/default.php
@@ -1,18 +1,16 @@
<?php
/**
- * Elgg fallback pageshell
- * Render a few things (like the installation process) in a fallback mode, text only with minimal use
- * of functions.
+ * Elgg failsafe pageshell
+ * Special viewtype for rendering exceptions. Includes minimal code so as not to
+ * create a "Exception thrown without a stack frame in Unknown on line 0" error
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*
- * @uses $vars['config'] The site configuration settings, imported
* @uses $vars['title'] The page title
* @uses $vars['body'] The main content of the page
- * @uses $vars['messages'] A 2d array of various message registers, passed from system_messages()
*/
// we won't trust server configuration but specify utf-8
@@ -34,26 +32,10 @@ header('Content-type: text/html; charset=utf-8');
font: 80%/1.5 "Lucida Grande", Verdana, sans-serif;
color: #333333;
}
- a {
- color: #4690d6;
- text-decoration: none;
- -moz-outline-style: none;
- outline: none;
- }
- a:visited {
- color: #0054a7;
- }
- a:hover {
- color: #0054a7;
- text-decoration: underline;
- }
p {
margin: 0px 0px 15px 0;
}
- img {
- border: none;
- }
- #startpage_wrapper {
+ #wrapper {
background:white;
width:570px;
margin:auto;
@@ -63,94 +45,18 @@ header('Content-type: text/html; charset=utf-8');
border-right: 1px solid #666666;
border-bottom: 1px solid #666666;
}
-
- label {
- font-weight: bold;
- color:#333333;
- font-size: 140%;
- }
- input[type="text"],
- input[type="password"] {
- font: 120% Arial, Helvetica, sans-serif;
- padding: 5px;
- border: 1px solid #cccccc;
- color:#666666;
- width:566px;
- }
- .database_settings input[type="text"],
- .database_settings input[type="password"] {
- width:220px;
- }
- textarea {
- width: 100%;
- height: 100%;
- font: 120% Arial, Helvetica, sans-serif;
- border: solid 1px #cccccc;
- padding: 5px;
- color:#666666;
- }
- textarea:focus, input[type="password"]:focus, input[type="text"]:focus {
- border: solid 1px #4690d6;
- background: #e4ecf5;
- color:#333333;
- }
-
- input[type="submit"]:hover {
- background: #0054a7;
- border: 4px solid #0054a7;
- }
-
- input[type="submit"] {
- font: 16px/100% Arial, Helvetica, sans-serif;
- font-weight: bold;
- color: #ffffff;
- background:#4690d6;
- border: 4px solid #4690d6;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- width: auto;
- height: 35px;
- padding: 2px 6px 2px 6px;
- margin:10px 0 10px 0;
- cursor: pointer;
- }
- #startpage_wrapper hr {
- border:0;
- border-bottom:1px solid #333333;
- }
- #startpage_wrapper td {
- text-align: left;
- vertical-align: middle;
- }
-
- .messages {
- border:1px solid #00cc00;
- background:#ccffcc;
- color:#000000;
- padding:3px 10px 3px 10px;
- }
- .messages_error {
- border:1px solid #D3322A;
- background:#F7DAD8;
- color:#000000;
- padding:3px 10px 3px 10px;
-
+ .messages_exception {
+ background:#FDFFC3;
+ display:block;
+ padding:10px;
}
</style>
-
-
</head>
<body>
- <div id="startpage_wrapper">
+ <div id="wrapper">
<h1><?php echo $vars['title']; ?></h1>
-
- <!-- display any system messages -->
- <?php echo elgg_view('messages/list', array('object' => $vars['sysmessages'])); ?>
-
- <p>
- <?php echo $vars['body']; ?>
- </p>
+ <?php echo $vars['body']; ?>
</div>
</body>
</html>