diff options
Diffstat (limited to 'modules/gallery/libraries')
-rw-r--r-- | modules/gallery/libraries/IdentityProvider.php | 22 | ||||
-rw-r--r-- | modules/gallery/libraries/MY_View.php | 4 | ||||
-rw-r--r-- | modules/gallery/libraries/ORM_MPTT.php | 3 | ||||
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 8 |
4 files changed, 25 insertions, 12 deletions
diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index 067a9929..5f341c90 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -99,18 +99,24 @@ class IdentityProvider_Core { $restore_already_running = true; // Make sure new provider is not in the database - module::uninstall($new_provider); - - // Lets reset to the current provider so that the gallery installation is still - // working. - module::set_var("gallery", "identity_provider", null); - IdentityProvider::change_provider($current_provider); - module::activate($current_provider); + try { + module::uninstall($new_provider); + + // Lets reset to the current provider so that the gallery installation is still + // working. + module::set_var("gallery", "identity_provider", null); + IdentityProvider::change_provider($current_provider); + module::activate($current_provider); + } catch (Exception $e2) { + Kohana_Log::add("error", "Error restoring original identity provider\n" . + $e2->getMessage() . "\n" . $e2->getTraceAsString()); + } + message::error( t("Error attempting to enable \"%new_provider\" identity provider, " . "reverted to \"%old_provider\" identity provider", array("new_provider" => $new_provider, "old_provider" => $current_provider))); - + $restore_already_running = false; } throw $e; diff --git a/modules/gallery/libraries/MY_View.php b/modules/gallery/libraries/MY_View.php index d76e25ff..ded77792 100644 --- a/modules/gallery/libraries/MY_View.php +++ b/modules/gallery/libraries/MY_View.php @@ -67,6 +67,10 @@ class View extends View_Core { try { $this->kohana_local_data = array_merge(View::$global_data, $this->kohana_local_data); return parent::render($print, $renderer, $modifier); + } catch (ORM_Validation_Exception $e) { + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "Validation errors: " . print_r($e->validation->errors(), 1)); + return ""; } catch (Exception $e) { Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); return ""; diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php index e5b8ecd4..d8d88e4e 100644 --- a/modules/gallery/libraries/ORM_MPTT.php +++ b/modules/gallery/libraries/ORM_MPTT.php @@ -92,6 +92,7 @@ class ORM_MPTT_Core extends ORM { // Deleting children affects the MPTT tree, so we have to reload each child before we // delete it so that we have current left_ptr/right_ptr pointers. This is inefficient. // @todo load each child once, not twice. + set_time_limit(30); $item->reload()->delete(); } @@ -175,7 +176,7 @@ class ORM_MPTT_Core extends ORM { } /** - * Return all of the children of this node, ordered by id. + * Return the number of children of this node. * * @chainable * @param array additional where clauses diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 6246c6f1..46291005 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -46,9 +46,11 @@ class Theme_View_Core extends Gallery_View { $this->set_global("thumb_proportion", $this->thumb_proportion()); } - $maintenance_mode = Kohana::config("core.maintenance_mode", false, false); - if ($maintenance_mode) { - message::warning(t("This site is currently in maintenance mode")); + if (module::get_var("gallery", "maintenance_mode", 0)) { + if (identity::active_user()->admin) { + message::warning(t("This site is currently in maintenance mode. Visit the <a href=\"%maintenance_url\">maintenance page</a>", array("maintenance_url" => url::site("admin/maintenance")))); + } else + message::warning(t("This site is currently in maintenance mode.")); } } |