Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CarnetApp/CarnetNextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhie <phie@phie.ovh>2020-03-29 19:39:26 +0300
committerPhie <phie@phie.ovh>2020-03-29 19:39:26 +0300
commitae581b9425c1df1f754e800f408f1e09f970067f (patch)
tree37a89b8bb9719dbc3d97a20285cfa85141474ed2
parent0f9f3677445767d95fdab62602af8153227ae407 (diff)
moving Search out of commands
-rwxr-xr-xlib/Controller/NoteController.php2
-rw-r--r--lib/Misc/Search.php (renamed from lib/Command/Search.php)47
2 files changed, 3 insertions, 46 deletions
diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php
index 6c131f9..7a6ed5e 100755
--- a/lib/Controller/NoteController.php
+++ b/lib/Controller/NoteController.php
@@ -11,7 +11,7 @@
use OCA\Carnet\Misc\NoteUtils;
use OCA\Carnet\Misc\CacheManager;
use OCP\IDBConnection;
- use OCA\Carnet\Command\Search;
+ use OCA\Carnet\Misc\Search;
//require_once 'vendor/autoload.php';
class MyZipFile extends \PhpZip\ZipFile {
diff --git a/lib/Command/Search.php b/lib/Misc/Search.php
index 245ca49..e6d272d 100644
--- a/lib/Command/Search.php
+++ b/lib/Misc/Search.php
@@ -1,11 +1,6 @@
<?php
-namespace OCA\Carnet\Command;
-
-use Symfony\Component\Console\Command\Command;
-use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Output\OutputInterface;
+namespace OCA\Carnet\Misc;
use OCP\Files\File;
use OCP\Files\IRootFolder;
@@ -13,7 +8,7 @@ use OCP\Files\NotFoundException;
use OCA\Carnet\Misc\CacheManager;
use OCP\IDBConnection;
-class Search extends Command {
+class Search {
private $output;
private $appName;
private $CarnetFolder;
@@ -28,7 +23,6 @@ class Search extends Command {
* @param IRootFolder $rootFolder
*/
public function __construct($AppName, $RootFolder, $Config, IDBConnection $IDBConnection, $userId){
- parent::__construct();
$this->appName = $AppName;
$this->Config = $Config;
$this->db = $IDBConnection;
@@ -74,43 +68,6 @@ public function startSearch($query, $from) {
return $result;
}
-/**
-* @param InputInterface $input
-* @param OutputInterface $output
-* @return int
-*/
-protected function execute(InputInterface $input, OutputInterface $output) {
- $this->output = $output;
- $this->userId = $input->getArgument('user_id');
- try {
- $this->getCacheFolder()->get("carnet_search")->delete();
- } catch(\OCP\Files\NotFoundException $e) {
-
- }
- $this->searchCache = $this->getCacheFolder()->newFile("carnet_search");
- $this->searchCache->putContent("[]");
-
- $output->writeln('starting '.$this->appName.' user '.$input->getArgument('user_id'));
-
- $output->writeln('searching '.$input->getArgument('query')." in ".$this->CarnetFolder->getFullPath($input->getArgument('root')));
- $path = $input->getArgument('root');
- if (!empty($path) && substr($path, -1) !== '/' || $path !== ".")
- $path = substr($path, -1);
-
- $query = $input->getArgument('query');
- $query = $this->removeAccents($query);
- $query = strtolower($query);
-
- echo "searching ".$query;
- $this->data = array();
- $this->pathArray = array();
- $this->searchInCache($query);
- $this->search($path, $this->CarnetFolder->get($path), $query,0);
- //$data = json_decode( $this->searchCache->getContent());
- array_push($this->data, "end_of_search");
- $this->searchCache->putContent(json_encode($this->data));
-}
-
private function searchInCache($query){
$cache = new CacheManager($this->db, $this->CarnetFolder);
$metadataFromCache = $cache->search($query);