From 1dab0767502013b5e86e8e24e3b12a2a8939f7a8 Mon Sep 17 00:00:00 2001
From: Georg Ehrke <developer@georgehrke.com>
Date: Fri, 23 Aug 2013 23:05:44 +0200
Subject: [PATCH] make it possible to disable previews

---
 config/config.sample.php |  1 +
 lib/preview.php          | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/config/config.sample.php b/config/config.sample.php
index 5c40078c7d7..76de97818d5 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -191,6 +191,7 @@ $CONFIG = array(
 'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8
 
 // PREVIEW
+'disable_previews' => false,
 /* the max width of a generated preview, if value is null, there is no limit */
 'preview_max_x' => null,
 /* the max height of a generated preview, if value is null, there is no limit */
diff --git a/lib/preview.php b/lib/preview.php
index 9fed7f1b58f..0497ec95bc5 100755
--- a/lib/preview.php
+++ b/lib/preview.php
@@ -568,6 +568,12 @@ class Preview {
 	 * @return void
 	 */
 	private static function initProviders() {
+		if(\OC_Config::getValue('disable_previews', false)) {
+			$provider = new Preview\Unknown();
+			self::$providers = array($provider);
+			return;
+		}
+
 		if(count(self::$providers)>0) {
 			return;
 		}
@@ -599,6 +605,10 @@ class Preview {
 	}
 
 	public static function isMimeSupported($mimetype) {
+		if(\OC_Config::getValue('disable_previews', false)) {
+			return false;
+		}
+
 		//check if there are preview backends
 		if(empty(self::$providers)) {
 			self::initProviders();
-- 
GitLab