1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Controllers; |
4
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Commands\GeolocateReviews; |
6
|
|
|
use GeminiLabs\SiteReviews\Database; |
7
|
|
|
use GeminiLabs\SiteReviews\Database\CountManager; |
8
|
|
|
use GeminiLabs\SiteReviews\Modules\Migrate; |
9
|
|
|
use GeminiLabs\SiteReviews\Modules\Notification; |
10
|
|
|
|
11
|
|
|
class QueueController extends AbstractController |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @action site-reviews/queue/export/cleanup |
15
|
|
|
*/ |
16
|
|
|
public function cleanupAfterExport(): void |
17
|
|
|
{ |
18
|
|
|
glsr(Database::class)->deleteMeta(glsr()->export_key); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @action site-reviews/queue/geolocation |
23
|
|
|
*/ |
24
|
|
|
public function geolocateReview(int $reviewId): void |
25
|
|
|
{ |
26
|
|
|
glsr(GeolocateReviews::class)->processReview( |
27
|
|
|
glsr_get_review($reviewId) |
28
|
|
|
); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @action site-reviews/queue/geolocations |
33
|
|
|
*/ |
34
|
|
|
public function geolocateReviews(int $offset): void |
35
|
|
|
{ |
36
|
|
|
glsr(GeolocateReviews::class)->process($offset); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @action site-reviews/queue/recalculate-meta |
41
|
|
|
*/ |
42
|
|
|
public function recalculateAssignmentMeta(): void |
43
|
|
|
{ |
44
|
|
|
glsr(CountManager::class)->recalculate(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @action site-reviews/queue/migration |
49
|
|
|
*/ |
50
|
|
|
public function runMigration(): void |
51
|
|
|
{ |
52
|
|
|
glsr(Migrate::class)->run(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @action site-reviews/queue/notification |
57
|
|
|
*/ |
58
|
|
|
public function sendNotification(int $reviewId): void |
59
|
|
|
{ |
60
|
|
|
$review = glsr_get_review($reviewId); |
61
|
|
|
if ($review->isValid()) { |
62
|
|
|
glsr(Notification::class)->send($review); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|