File tree 2 files changed +6
-23
lines changed
2 files changed +6
-23
lines changed Original file line number Diff line number Diff line change 19
19
use Wilr \Silverstripe \Algolia \Jobs \AlgoliaIndexItemJob ;
20
20
use Wilr \SilverStripe \Algolia \Service \AlgoliaIndexer ;
21
21
use Wilr \SilverStripe \Algolia \Service \AlgoliaService ;
22
+ use Wilr \SilverStripe \Algolia \Tasks \AlgoliaConfigure ;
22
23
23
24
class AlgoliaObjectExtension extends DataExtension
24
25
{
@@ -87,29 +88,6 @@ public function updateSettingsFields(FieldList $fields)
87
88
}
88
89
}
89
90
90
- /**
91
- * On dev/build ensure that the indexer settings are up to date.
92
- */
93
- public function requireDefaultRecords ()
94
- {
95
- if ($ this ->ranSync ) {
96
- return false ;
97
- }
98
-
99
- $ this ->ranSync = true ;
100
- $ algolia = Injector::inst ()->create (AlgoliaService::class);
101
-
102
- if (!$ this ->indexEnabled ()) {
103
- return ;
104
- }
105
-
106
- try {
107
- $ algolia ->syncSettings ();
108
- } catch (Throwable $ e ) {
109
- DB ::alteration_message ($ e ->getMessage (), 'error ' );
110
- }
111
- }
112
-
113
91
/**
114
92
* Returns whether this object should be indexed into Algolia.
115
93
*/
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ public function run($request)
24
24
{
25
25
$ service = Injector::inst ()->get (AlgoliaService::class);
26
26
27
+ if (!$ this ->isEnabled ()) {
28
+ echo 'This task is disabled. ' . PHP_EOL ;
29
+ return ;
30
+ }
31
+
27
32
try {
28
33
if ($ service ->syncSettings ()) {
29
34
echo 'Success. ' . PHP_EOL ;
You can’t perform that action at this time.
0 commit comments