1 | <?php |
||
38 | class CrawlerQueueTask extends AbstractTask |
||
39 | { |
||
40 | /** |
||
41 | * Define the current mode to process the crawler |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | const MODE = 'queue'; |
||
46 | |||
47 | /** |
||
48 | * Depth to run the crawler |
||
49 | * |
||
50 | * @var integer |
||
51 | */ |
||
52 | public $depth; |
||
53 | |||
54 | /** |
||
55 | * Startpage for the crawler |
||
56 | * |
||
57 | * @var integer |
||
58 | */ |
||
59 | public $startPage; |
||
60 | |||
61 | /** |
||
62 | * Configuration to run (comma separated list) |
||
63 | * |
||
64 | * @var string |
||
65 | */ |
||
66 | public $configuration; |
||
67 | |||
68 | /** |
||
69 | * Function executed from the Scheduler. |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function execute() |
||
74 | { |
||
75 | $this->setCliArguments(); |
||
76 | |||
77 | /** @var CrawlerController $crawlerObject */ |
||
78 | $crawlerObject = GeneralUtility::makeInstance(CrawlerController::class); |
||
79 | $crawlerObject->CLI_main_im(); |
||
80 | return true; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Simulate cli call with setting the required options to the $_SERVER['argv'] |
||
85 | * |
||
86 | * @return void |
||
87 | */ |
||
88 | protected function setCliArguments() |
||
89 | { |
||
90 | // Make it backwards compatible. |
||
91 | if (is_null($this->startPage)) { |
||
92 | $this->startPage = 0; |
||
93 | } |
||
94 | |||
95 | $_SERVER['argv'] = [$_SERVER['argv'][0], $this->startPage,'-ss', '-d', $this->depth, '-o', self::MODE, '-conf', implode(',', $this->configuration)]; |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * Retrieve some details about current scheduler task |
||
100 | * to make the list view more useful. |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getAdditionalInformation() |
||
113 | } |
||
114 |