Skip to content

Commit

Permalink
Deprecate \OCP\ISearch
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Jun 24, 2020
1 parent f8e08a7 commit 27b8637
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/private/Search/Provider/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@

/**
* Provide search results from the 'files' app
* @deprecated 20.0.0
*/
class File extends \OCP\Search\Provider {

/**
* Search for files and folders matching the given query
* @param string $query
* @return \OCP\Search\Result
* @deprecated 20.0.0
*/
public function search($query) {
$files = Filesystem::search($query);
Expand Down
4 changes: 3 additions & 1 deletion lib/private/Search/Result/Audio.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@

/**
* A found audio file
* @deprecated 20.0.0
*/
class Audio extends File {

/**
* Type name; translated in templates
* @var string
* @deprecated 20.0.0
*/
public $type = 'audio';

/**
* @TODO add ID3 information
*/
Expand Down
10 changes: 10 additions & 0 deletions lib/private/Search/Result/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,57 @@

/**
* A found file
* @deprecated 20.0.0
*/
class File extends \OCP\Search\Result {

/**
* Type name; translated in templates
* @var string
* @deprecated 20.0.0
*/
public $type = 'file';

/**
* Path to file
* @var string
* @deprecated 20.0.0
*/
public $path;

/**
* Size, in bytes
* @var int
* @deprecated 20.0.0
*/
public $size;

/**
* Date modified, in human readable form
* @var string
* @deprecated 20.0.0
*/
public $modified;

/**
* File mime type
* @var string
* @deprecated 20.0.0
*/
public $mime_type;

/**
* File permissions:
*
* @var string
* @deprecated 20.0.0
*/
public $permissions;

/**
* Create a new file search result
* @param FileInfo $data file data given by provider
* @deprecated 20.0.0
*/
public function __construct(FileInfo $data) {
$path = $this->getRelativePath($data->getPath());
Expand All @@ -97,6 +105,7 @@ public function __construct(FileInfo $data) {

/**
* @var Folder $userFolderCache
* @deprecated 20.0.0
*/
protected static $userFolderCache = null;

Expand All @@ -105,6 +114,7 @@ public function __construct(FileInfo $data) {
* eg /user/files/foo.txt -> /foo.txt
* @param string $path
* @return string relative path
* @deprecated 20.0.0
*/
protected function getRelativePath($path) {
if (!isset(self::$userFolderCache)) {
Expand Down
2 changes: 2 additions & 0 deletions lib/private/Search/Result/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@

/**
* A found folder
* @deprecated 20.0.0
*/
class Folder extends File {

/**
* Type name; translated in templates
* @var string
* @deprecated 20.0.0
*/
public $type = 'folder';
}
4 changes: 3 additions & 1 deletion lib/private/Search/Result/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@

/**
* A found image file
* @deprecated 20.0.0
*/
class Image extends File {

/**
* Type name; translated in templates
* @var string
* @deprecated 20.0.0
*/
public $type = 'image';

/**
* @TODO add EXIF information
*/
Expand Down
5 changes: 5 additions & 0 deletions lib/public/ISearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**
* Small Interface for Search
* @since 7.0.0
* @deprecated 20.0.0
*/
interface ISearch {

Expand All @@ -40,6 +41,7 @@ interface ISearch {
* @param int $size
* @return array An array of OCP\Search\Result's
* @since 8.0.0
* @deprecated 20.0.0
*/
public function searchPaged($query, array $inApps = [], $page = 1, $size = 30);

Expand All @@ -48,19 +50,22 @@ public function searchPaged($query, array $inApps = [], $page = 1, $size = 30);
* @param string $class class name of a OCP\Search\Provider
* @param array $options optional
* @since 7.0.0
* @deprecated 20.0.0
*/
public function registerProvider($class, array $options = []);

/**
* Remove one existing search provider
* @param string $provider class name of a OCP\Search\Provider
* @since 7.0.0
* @deprecated 20.0.0
*/
public function removeProvider($provider);

/**
* Remove all registered search providers
* @since 7.0.0
* @deprecated 20.0.0
*/
public function clearProviders();
}
1 change: 1 addition & 0 deletions lib/public/IServerContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ public function getRouter();
*
* @return \OCP\ISearch
* @since 7.0.0
* @deprecated 20.0.0
*/
public function getSearch();

Expand Down
5 changes: 5 additions & 0 deletions lib/public/Search/PagedProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@
/**
* Provides a template for search functionality throughout ownCloud;
* @since 8.0.0
* @deprecated 20.0.0
*/
abstract class PagedProvider extends Provider {

/**
* show all results
* @since 8.0.0
* @deprecated 20.0.0
*/
public const SIZE_ALL = 0;

/**
* Constructor
* @param array $options
* @since 8.0.0
* @deprecated 20.0.0
*/
public function __construct($options) {
parent::__construct($options);
Expand All @@ -53,6 +56,7 @@ public function __construct($options) {
* @param string $query
* @return array An array of OCP\Search\Result's
* @since 8.0.0
* @deprecated 20.0.0
*/
public function search($query) {
// old apps might assume they get all results, so we use SIZE_ALL
Expand All @@ -66,6 +70,7 @@ public function search($query) {
* @param int $size 0 = SIZE_ALL
* @return array An array of OCP\Search\Result's
* @since 8.0.0
* @deprecated 20.0.0
*/
abstract public function searchPaged($query, $page, $size);
}
7 changes: 7 additions & 0 deletions lib/public/Search/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,29 @@
/**
* Provides a template for search functionality throughout ownCloud;
* @since 7.0.0
* @deprecated 20.0.0
*/
abstract class Provider {

/**
* @since 8.0.0
* @deprecated 20.0.0
*/
public const OPTION_APPS = 'apps';

/**
* List of options
* @var array
* @since 7.0.0
* @deprecated 20.0.0
*/
protected $options;

/**
* Constructor
* @param array $options as key => value
* @since 7.0.0 - default value for $options was added in 8.0.0
* @deprecated 20.0.0
*/
public function __construct($options = []) {
$this->options = $options;
Expand All @@ -59,6 +63,7 @@ public function __construct($options = []) {
* @param string $key
* @return mixed
* @since 8.0.0
* @deprecated 20.0.0
*/
public function getOption($key) {
if (is_array($this->options) && isset($this->options[$key])) {
Expand All @@ -76,6 +81,7 @@ public function getOption($key) {
* @param string[] $apps
* @return bool
* @since 8.0.0
* @deprecated 20.0.0
*/
public function providesResultsFor(array $apps = []) {
$forApps = $this->getOption(self::OPTION_APPS);
Expand All @@ -87,6 +93,7 @@ public function providesResultsFor(array $apps = []) {
* @param string $query
* @return array An array of OCP\Search\Result's
* @since 7.0.0
* @deprecated 20.0.0
*/
abstract public function search($query);
}
6 changes: 6 additions & 0 deletions lib/public/Search/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**
* The generic result of a search
* @since 7.0.0
* @deprecated 20.0.0
*/
class Result {

Expand All @@ -37,6 +38,7 @@ class Result {
* corresponding application.
* @var string
* @since 7.0.0
* @deprecated 20.0.0
*/
public $id;

Expand All @@ -45,13 +47,15 @@ class Result {
* results.
* @var string
* @since 7.0.0
* @deprecated 20.0.0
*/
public $name;

/**
* URL to the application item.
* @var string
* @since 7.0.0
* @deprecated 20.0.0
*/
public $link;

Expand All @@ -60,6 +64,7 @@ class Result {
* as the class name (e.g. \OC\Search\File -> 'file') in lowercase.
* @var string
* @since 7.0.0
* @deprecated 20.0.0
*/
public $type = 'generic';

Expand All @@ -69,6 +74,7 @@ class Result {
* @param string $name displayed text of result
* @param string $link URL to the result within its app
* @since 7.0.0
* @deprecated 20.0.0
*/
public function __construct($id = null, $name = null, $link = null) {
$this->id = $id;
Expand Down

0 comments on commit 27b8637

Please sign in to comment.