Deprecate \OCP\ISearch

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2020-06-22 10:57:40 +02:00
parent f8e08a74ba
commit 27b8637e3e
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
10 changed files with 44 additions and 2 deletions

View File

@ -32,6 +32,7 @@ use OC\Files\Filesystem;
/** /**
* Provide search results from the 'files' app * Provide search results from the 'files' app
* @deprecated 20.0.0
*/ */
class File extends \OCP\Search\Provider { class File extends \OCP\Search\Provider {
@ -39,6 +40,7 @@ class File extends \OCP\Search\Provider {
* Search for files and folders matching the given query * Search for files and folders matching the given query
* @param string $query * @param string $query
* @return \OCP\Search\Result * @return \OCP\Search\Result
* @deprecated 20.0.0
*/ */
public function search($query) { public function search($query) {
$files = Filesystem::search($query); $files = Filesystem::search($query);

View File

@ -27,15 +27,17 @@ namespace OC\Search\Result;
/** /**
* A found audio file * A found audio file
* @deprecated 20.0.0
*/ */
class Audio extends File { class Audio extends File {
/** /**
* Type name; translated in templates * Type name; translated in templates
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $type = 'audio'; public $type = 'audio';
/** /**
* @TODO add ID3 information * @TODO add ID3 information
*/ */

View File

@ -31,36 +31,42 @@ use OCP\Files\Folder;
/** /**
* A found file * A found file
* @deprecated 20.0.0
*/ */
class File extends \OCP\Search\Result { class File extends \OCP\Search\Result {
/** /**
* Type name; translated in templates * Type name; translated in templates
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $type = 'file'; public $type = 'file';
/** /**
* Path to file * Path to file
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $path; public $path;
/** /**
* Size, in bytes * Size, in bytes
* @var int * @var int
* @deprecated 20.0.0
*/ */
public $size; public $size;
/** /**
* Date modified, in human readable form * Date modified, in human readable form
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $modified; public $modified;
/** /**
* File mime type * File mime type
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $mime_type; public $mime_type;
@ -68,12 +74,14 @@ class File extends \OCP\Search\Result {
* File permissions: * File permissions:
* *
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $permissions; public $permissions;
/** /**
* Create a new file search result * Create a new file search result
* @param FileInfo $data file data given by provider * @param FileInfo $data file data given by provider
* @deprecated 20.0.0
*/ */
public function __construct(FileInfo $data) { public function __construct(FileInfo $data) {
$path = $this->getRelativePath($data->getPath()); $path = $this->getRelativePath($data->getPath());
@ -97,6 +105,7 @@ class File extends \OCP\Search\Result {
/** /**
* @var Folder $userFolderCache * @var Folder $userFolderCache
* @deprecated 20.0.0
*/ */
protected static $userFolderCache = null; protected static $userFolderCache = null;
@ -105,6 +114,7 @@ class File extends \OCP\Search\Result {
* eg /user/files/foo.txt -> /foo.txt * eg /user/files/foo.txt -> /foo.txt
* @param string $path * @param string $path
* @return string relative path * @return string relative path
* @deprecated 20.0.0
*/ */
protected function getRelativePath($path) { protected function getRelativePath($path) {
if (!isset(self::$userFolderCache)) { if (!isset(self::$userFolderCache)) {

View File

@ -27,12 +27,14 @@ namespace OC\Search\Result;
/** /**
* A found folder * A found folder
* @deprecated 20.0.0
*/ */
class Folder extends File { class Folder extends File {
/** /**
* Type name; translated in templates * Type name; translated in templates
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $type = 'folder'; public $type = 'folder';
} }

View File

@ -27,15 +27,17 @@ namespace OC\Search\Result;
/** /**
* A found image file * A found image file
* @deprecated 20.0.0
*/ */
class Image extends File { class Image extends File {
/** /**
* Type name; translated in templates * Type name; translated in templates
* @var string * @var string
* @deprecated 20.0.0
*/ */
public $type = 'image'; public $type = 'image';
/** /**
* @TODO add EXIF information * @TODO add EXIF information
*/ */

View File

@ -29,6 +29,7 @@ namespace OCP;
/** /**
* Small Interface for Search * Small Interface for Search
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
interface ISearch { interface ISearch {
@ -40,6 +41,7 @@ interface ISearch {
* @param int $size * @param int $size
* @return array An array of OCP\Search\Result's * @return array An array of OCP\Search\Result's
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
public function searchPaged($query, array $inApps = [], $page = 1, $size = 30); public function searchPaged($query, array $inApps = [], $page = 1, $size = 30);
@ -48,6 +50,7 @@ interface ISearch {
* @param string $class class name of a OCP\Search\Provider * @param string $class class name of a OCP\Search\Provider
* @param array $options optional * @param array $options optional
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public function registerProvider($class, array $options = []); public function registerProvider($class, array $options = []);
@ -55,12 +58,14 @@ interface ISearch {
* Remove one existing search provider * Remove one existing search provider
* @param string $provider class name of a OCP\Search\Provider * @param string $provider class name of a OCP\Search\Provider
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public function removeProvider($provider); public function removeProvider($provider);
/** /**
* Remove all registered search providers * Remove all registered search providers
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public function clearProviders(); public function clearProviders();
} }

View File

@ -359,6 +359,7 @@ interface IServerContainer extends IContainer {
* *
* @return \OCP\ISearch * @return \OCP\ISearch
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public function getSearch(); public function getSearch();

View File

@ -30,12 +30,14 @@ namespace OCP\Search;
/** /**
* Provides a template for search functionality throughout ownCloud; * Provides a template for search functionality throughout ownCloud;
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
abstract class PagedProvider extends Provider { abstract class PagedProvider extends Provider {
/** /**
* show all results * show all results
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
public const SIZE_ALL = 0; public const SIZE_ALL = 0;
@ -43,6 +45,7 @@ abstract class PagedProvider extends Provider {
* Constructor * Constructor
* @param array $options * @param array $options
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
public function __construct($options) { public function __construct($options) {
parent::__construct($options); parent::__construct($options);
@ -53,6 +56,7 @@ abstract class PagedProvider extends Provider {
* @param string $query * @param string $query
* @return array An array of OCP\Search\Result's * @return array An array of OCP\Search\Result's
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
public function search($query) { public function search($query) {
// old apps might assume they get all results, so we use SIZE_ALL // old apps might assume they get all results, so we use SIZE_ALL
@ -66,6 +70,7 @@ abstract class PagedProvider extends Provider {
* @param int $size 0 = SIZE_ALL * @param int $size 0 = SIZE_ALL
* @return array An array of OCP\Search\Result's * @return array An array of OCP\Search\Result's
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
abstract public function searchPaged($query, $page, $size); abstract public function searchPaged($query, $page, $size);
} }

View File

@ -30,11 +30,13 @@ namespace OCP\Search;
/** /**
* Provides a template for search functionality throughout ownCloud; * Provides a template for search functionality throughout ownCloud;
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
abstract class Provider { abstract class Provider {
/** /**
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
public const OPTION_APPS = 'apps'; public const OPTION_APPS = 'apps';
@ -42,6 +44,7 @@ abstract class Provider {
* List of options * List of options
* @var array * @var array
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
protected $options; protected $options;
@ -49,6 +52,7 @@ abstract class Provider {
* Constructor * Constructor
* @param array $options as key => value * @param array $options as key => value
* @since 7.0.0 - default value for $options was added in 8.0.0 * @since 7.0.0 - default value for $options was added in 8.0.0
* @deprecated 20.0.0
*/ */
public function __construct($options = []) { public function __construct($options = []) {
$this->options = $options; $this->options = $options;
@ -59,6 +63,7 @@ abstract class Provider {
* @param string $key * @param string $key
* @return mixed * @return mixed
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
public function getOption($key) { public function getOption($key) {
if (is_array($this->options) && isset($this->options[$key])) { if (is_array($this->options) && isset($this->options[$key])) {
@ -76,6 +81,7 @@ abstract class Provider {
* @param string[] $apps * @param string[] $apps
* @return bool * @return bool
* @since 8.0.0 * @since 8.0.0
* @deprecated 20.0.0
*/ */
public function providesResultsFor(array $apps = []) { public function providesResultsFor(array $apps = []) {
$forApps = $this->getOption(self::OPTION_APPS); $forApps = $this->getOption(self::OPTION_APPS);
@ -87,6 +93,7 @@ abstract class Provider {
* @param string $query * @param string $query
* @return array An array of OCP\Search\Result's * @return array An array of OCP\Search\Result's
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
abstract public function search($query); abstract public function search($query);
} }

View File

@ -29,6 +29,7 @@ namespace OCP\Search;
/** /**
* The generic result of a search * The generic result of a search
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
class Result { class Result {
@ -37,6 +38,7 @@ class Result {
* corresponding application. * corresponding application.
* @var string * @var string
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public $id; public $id;
@ -45,6 +47,7 @@ class Result {
* results. * results.
* @var string * @var string
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public $name; public $name;
@ -52,6 +55,7 @@ class Result {
* URL to the application item. * URL to the application item.
* @var string * @var string
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public $link; public $link;
@ -60,6 +64,7 @@ class Result {
* as the class name (e.g. \OC\Search\File -> 'file') in lowercase. * as the class name (e.g. \OC\Search\File -> 'file') in lowercase.
* @var string * @var string
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public $type = 'generic'; public $type = 'generic';
@ -69,6 +74,7 @@ class Result {
* @param string $name displayed text of result * @param string $name displayed text of result
* @param string $link URL to the result within its app * @param string $link URL to the result within its app
* @since 7.0.0 * @since 7.0.0
* @deprecated 20.0.0
*/ */
public function __construct($id = null, $name = null, $link = null) { public function __construct($id = null, $name = null, $link = null) {
$this->id = $id; $this->id = $id;