]> source.dussan.org Git - nextcloud-server.git/commitdiff
add function to remove a search provider
authorJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 1 Feb 2013 18:21:54 +0000 (19:21 +0100)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 1 Feb 2013 18:21:54 +0000 (19:21 +0100)
lib/search.php

index 3c3378ad13cbb12c31f8db4e25e51f574a330e6b..e5a65f7157df6ec68ddea29bff6308cd8455f573 100644 (file)
@@ -57,6 +57,22 @@ class OC_Search{
                }
                return $results;
        }
+       
+       /**
+        * remove an existing search provider
+        * @param string $provider class name of a OC_Search_Provider
+        */
+       public static function removeProvider($provider) {
+               self::$registeredProviders = array_filter(
+                               self::$registeredProviders, 
+                               function ($element) use ($provider) {
+                                       return ($element['class'] != $provider);
+                               }
+               );
+               // force regeneration of providers on next search
+               self::$providers=array();
+       }
+
 
        /**
         * create instances of all the registered search providers