use \OCP\Files\StorageNotAvailableException;
use \OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
use \OCA\Files_External\Service\BackendService;
+use \OCP\Files\StorageNotAvailableException;
/**
* Base class for storages controllers
);
} catch (InsufficientDataForMeaningfulAnswerException $e) {
$storage->setStatus(
- \OC_Mount_Config::STATUS_INDETERMINATE,
+ StorageNotAvailableException::STATUS_INDETERMINATE,
$this->l10n->t('Insufficient data: %s', [$e->getMessage()])
);
} catch (StorageNotAvailableException $e) {
} catch (\Exception $e) {
// FIXME: convert storage exceptions to StorageNotAvailableException
$storage->setStatus(
- \OC_Mount_Config::STATUS_ERROR,
+ StorageNotAvailableException::STATUS_ERROR,
get_class($e).': '.$e->getMessage()
);
}
use \OCA\Files_External\Lib\Backend\LegacyBackend;
use \OCA\Files_External\Lib\StorageConfig;
use \OCA\Files_External\Lib\Backend\Backend;
+use \OCP\Files\StorageNotAvailableException;
/**
* Class to configure mount.json globally and for users
const MOUNT_TYPE_USER = 'user';
const MOUNT_TYPE_PERSONAL = 'personal';
- // getBackendStatus return types
- const STATUS_SUCCESS = 0;
- const STATUS_ERROR = 1;
- const STATUS_INDETERMINATE = 2;
-
// whether to skip backend test (for unit tests, as this static class is not mockable)
public static $skipTest = false;
*/
public static function getBackendStatus($class, $options, $isPersonal) {
if (self::$skipTest) {
- return self::STATUS_SUCCESS;
+ return StorageNotAvailableException::STATUS_SUCCESS;
}
foreach ($options as &$option) {
$option = self::setUserVars(OCP\User::getUser(), $option);
$result = $storage->test($isPersonal);
$storage->setAvailability($result);
if ($result) {
- return self::STATUS_SUCCESS;
+ return StorageNotAvailableException::STATUS_SUCCESS;
}
} catch (\Exception $e) {
$storage->setAvailability(false);
throw $exception;
}
}
- return self::STATUS_ERROR;
+ return StorageNotAvailableException::STATUS_ERROR;
}
/**
use \OCA\Files_External\Service\BackendService;
use \OCA\Files_External\Lib\Backend\Backend;
use \OCA\Files_External\Lib\Auth\AuthMechanism;
+use \OCP\Files\StorageNotAvailableException;
/**
* Service class to manage external storages
$this->triggerHooks($newStorage, Filesystem::signal_create_mount);
- $newStorage->setStatus(\OC_Mount_Config::STATUS_SUCCESS);
+ $newStorage->setStatus(StorageNotAvailableException::STATUS_SUCCESS);
return $newStorage;
}
*/
class StorageNotAvailableException extends HintException {
+ const STATUS_SUCCESS = 0;
+ const STATUS_ERROR = 1;
+ const STATUS_INDETERMINATE = 2;
const STATUS_INCOMPLETE_CONF = 3;
const STATUS_UNAUTHORIZED = 4;
const STATUS_TIMEOUT = 5;