yawik / SimpleImport

Simple Job Import Module. Imports job openings into YAWIK
MIT License
0 stars 1 forks source link

Missing Commands like delete, deactivate, activate #14

Open mbo-s opened 5 years ago

mbo-s commented 5 years ago

It is not possible to delete an existing crawler. There are more commands that might be helpful:

cbleek commented 5 years ago

let's start with a delete command

TiSiE commented 5 years ago

Delete action is implemented.

Usage

bin/console simpleimport delete-crawler [--id] <name>

Examples delete by name

bin/console simpleimport delete-crawler unwantedCrawler

Delete by MongoID

bin/console simpleimport delete-crawler --id MongoObjectId
cbleek commented 5 years ago

bin/console simpleimport delete-crawler unwantedCrawler results into:

Fatal Error

Call to a member function delete() on null search►

Source file

File: .../src/Controller/DeleteCrawlerConsoleController.php:49

39:            $crawler     = $isCrawlerId ? $this->crawlerRepository->find($crawlerName) : $this->crawlerRepository->findOneByName($crawlerName);
40:
41:            if (!$crawler) {
42:                $model = new ViewModel();
43:                $model->setErrorLevel(2);
44:                $model->setResult(sprintf('Crawler with %s "%s" does not exist.', $isCrawlerId ? 'id' : 'name', $crawlerName));
45:                return $model;
46:            }
47:
48:            foreach ($crawler->getItems() as $item) {
49:                $this->jobRepository->find($item->getDocumentId())->delete();
50:            }
51:
52:            $this->crawlerRepository->remove($crawler);
53:
cbleek commented 5 years ago

means, it's possible, that jobs known by the crawler are already deleted in the job repository.

cbleek commented 5 years ago

I cannot see the new update-crawler option

root@php7:/var/www/YAWIK# bin/console simpleimport 
==----------------------------------------------------------------------------------------------------------------------------------------------------------------------------==
                                                                           YAWIK v0.31.1-38-g34449603                                                                           
**----------------------------------------------------------------------------------------------------------------------------------------------------------------------------**

....

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SimpleImport
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Simple import operations
  console simpleimport import [--limit] [--name=] [--id=]                                                         Executes a data import for all         
                                                                                                                                        registered crawlers                    
  console simpleimport add-crawler --name --organization= --feed-uri [--runDelay] [--type] [--jobInitialState]    Adds a new import crawler              

  --limit=INT                 Number of crawlers to check per run. Default 3. 0 means no limit                                                                                 
  --name=STRING               The name of a crawler                                                                                                                            
  --id=STRING                 The Mongo object id of a crawler                                                                                                                 
  --organization==STRING      The ID of an organization                                                                                                                        
  --feed-uri=STRING           The URI pointing to a data to import                                                                                                             
  --runDelay=INT              The number of minutes the next import run will be proceeded again                                                                                
  --type=STRING               The type of an import (e.g. job)                                                                                                                 
  --jobInitialState=STRING    The initial state of an imported job                                                                                                             

  console simpleimport delete-crawler [--id] <name>    Deletes an import crawler                                                                         

  <name>    The name of the crawler to delete.                                                                                                                                 
  --id      When given, treats <name> as the MongoID of the crawler                                                                                                            

Reason for failure: Invalid arguments or no arguments provided
root@php7:/var/www/YAWIK# git log -1
commit 344496035e381da48526db89fe86a0e77f7103e7 (HEAD -> develop, origin/develop, origin/HEAD)
Author: Carsten Bleek <bleek@cross-solution.de>
Date:   Sat Oct 13 20:00:33 2018 +0200

    removes comment for JobsByMail
root@php7:/var/www/YAWIK# cd module/SimpleImport/
root@php7:/var/www/YAWIK/module/SimpleImport# git log -1
commit 0f23a5c14a1467db2aa61c6bc1a97750260b5393 (HEAD -> master, origin/master, origin/HEAD, composer/master)
Merge: 2a02de0 fe52632
Author: Mathias Gelhausen <gelhausen@cross-solution.de>
Date:   Wed Oct 17 12:51:06 2018 +0200

    Merge feature: Console action 'update-crawler' (#14)
TiSiE commented 5 years ago
rm cache/module-c*