[Pkg-owncloud-commits] [owncloud] 18/103: throw exception if setup is incomplete

David Prévot taffit at moszumanska.debian.org
Sun May 31 12:32:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.4RC1
in repository owncloud.

commit 2eced9ea99413388129b3417ac2b9e0161734b9b
Author: Morris Jobke <hey at morrisjobke.de>
Date:   Wed Apr 1 17:12:28 2015 +0200

    throw exception if setup is incomplete
---
 apps/user_ldap/lib/connection.php           |  4 +++-
 lib/private/hook.php                        |  3 +++
 lib/private/servernotavailableexception.php | 27 +++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 8cf954b..22267f3 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -24,6 +24,8 @@
 namespace OCA\user_ldap\lib;
 
 //magic properties (incomplete)
+use OC\ServerNotAvailableException;
+
 /**
  * responsible for LDAP connections in context with the provided configuration
  *
@@ -160,7 +162,7 @@ class Connection extends LDAPUtility {
 		}
 		if(is_null($this->ldapConnectionRes)) {
 			\OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server ' . $this->connection->ldapHost, \OCP\Util::ERROR);
-			throw new \Exception('Connection to LDAP server could not be established');
+			throw new ServerNotAvailableException('Connection to LDAP server could not be established');
 		}
 		return $this->ldapConnectionRes;
 	}
diff --git a/lib/private/hook.php b/lib/private/hook.php
index c9ca58f..7c71286 100644
--- a/lib/private/hook.php
+++ b/lib/private/hook.php
@@ -80,6 +80,9 @@ class OC_Hook{
 				OC_Log::write('hook',
 					'error while running hook (' . $i["class"] . '::' . $i["name"] . '): '.$e->getMessage(),
 					OC_Log::ERROR);
+				if($e instanceof \OC\ServerNotAvailableException && $signalclass === 'OC_Filesystem' && $signalname === 'setup') {
+					throw $e;
+				}
 			}
 		}
 
diff --git a/lib/private/servernotavailableexception.php b/lib/private/servernotavailableexception.php
new file mode 100644
index 0000000..5a57917
--- /dev/null
+++ b/lib/private/servernotavailableexception.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * @author Morris Jobke <hey at morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC;
+
+
+class ServerNotAvailableException extends \Exception {
+
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list