]> source.dussan.org Git - nextcloud-server.git/commitdiff
throw exception if setup is incomplete
authorMorris Jobke <hey@morrisjobke.de>
Wed, 1 Apr 2015 15:12:28 +0000 (17:12 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 22 Apr 2015 09:34:14 +0000 (11:34 +0200)
apps/user_ldap/lib/connection.php
lib/private/hook.php
lib/private/servernotavailableexception.php [new file with mode: 0644]

index bbc710f5192b7d7227147f7d99606b746968c9dc..d017fe8029cf65c723c02fc2bd933d0a2c0202b8 100644 (file)
@@ -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
  *
@@ -159,7 +161,7 @@ class Connection extends LDAPUtility {
                }
                if(is_null($this->ldapConnectionRes)) {
                        \OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server ' . $this->configuration->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;
        }
index c9ca58f779e7084ebab1af781d7a3bb6f772d9a0..7c7128646a9d3e6f60bcca02c2c229a1612d3752 100644 (file)
@@ -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 (file)
index 0000000..5a57917
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * @author Morris Jobke <hey@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 {
+
+}