[Pkg-owncloud-commits] [owncloud] 144/273: Handle StorageNotAvailableException in ajax/list.php

David Prévot taffit at moszumanska.debian.org
Fri Jul 4 03:13:10 UTC 2014


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

taffit pushed a commit to branch master
in repository owncloud.

commit 4526bc0ba6f23a2fae5f7372d9b7702736eb46f6
Author: Robin Appelman <icewind at owncloud.com>
Date:   Mon Jun 30 16:12:12 2014 +0200

    Handle StorageNotAvailableException in ajax/list.php
---
 apps/files/ajax/list.php | 64 ++++++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 27 deletions(-)

diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index bae3628..b94d00e 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -1,30 +1,40 @@
 <?php
 
-OCP\JSON::checkLoggedIn();
-\OC::$session->close();
-
-// Load the files
-$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
-$dir = \OC\Files\Filesystem::normalizePath($dir);
-$dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
-if (!$dirInfo || !$dirInfo->getType() === 'dir') {
-	header("HTTP/1.0 404 Not Found");
-	exit();
+try {
+	OCP\JSON::checkLoggedIn();
+	\OC::$session->close();
+
+	// Load the files
+	$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
+	$dir = \OC\Files\Filesystem::normalizePath($dir);
+	$dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
+	if (!$dirInfo || !$dirInfo->getType() === 'dir') {
+		header("HTTP/1.0 404 Not Found");
+		exit();
+	}
+
+	$data = array();
+	$baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir=';
+
+	$permissions = $dirInfo->getPermissions();
+
+	$sortAttribute = isset($_GET['sort']) ? $_GET['sort'] : 'name';
+	$sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
+
+	// make filelist
+
+	$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
+	$data['directory'] = $dir;
+	$data['files'] = \OCA\Files\Helper::formatFileInfos($files);
+	$data['permissions'] = $permissions;
+
+	OCP\JSON::success(array('data' => $data));
+} catch (\OCP\Files\StorageNotAvailableException $e) {
+	$l = OC_L10N::get('files');
+	OCP\JSON::error(array(
+		'data' => array(
+			'exception' => '\OCP\Files\StorageNotAvailableException',
+			'message' => $l->t('Storage not available')
+		)
+	));
 }
-
-$data = array();
-$baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir=';
-
-$permissions = $dirInfo->getPermissions();
-
-$sortAttribute = isset( $_GET['sort'] ) ? $_GET['sort'] : 'name';
-$sortDirection = isset( $_GET['sortdirection'] ) ? ($_GET['sortdirection'] === 'desc') : false;
-
-// make filelist
-$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
-
-$data['directory'] = $dir;
-$data['files'] = \OCA\Files\Helper::formatFileInfos($files);
-$data['permissions'] = $permissions;
-
-OCP\JSON::success(array('data' => $data));

-- 
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