@@ -281,6 +281,7 @@ public function dispatchConversion(
281
281
public function executeConversion (
282
282
string $ conversion ,
283
283
bool $ force = true ,
284
+ bool $ withChildren = true ,
284
285
): ?MediaConversion {
285
286
286
287
if (
@@ -290,25 +291,28 @@ public function executeConversion(
290
291
return null ;
291
292
}
292
293
293
- dump ('executeConversion: ' .$ conversion );
294
-
295
294
if ($ definition = $ this ->getConversionDefinition ($ conversion )) {
296
295
297
296
$ converter = ($ definition ->converter )($ this );
298
297
299
- return $ converter ->conversion ($ conversion )->handle ();
298
+ return $ converter
299
+ ->conversion ($ conversion )
300
+ ->withChildren ($ withChildren )
301
+ ->handle ();
300
302
}
301
303
302
304
return null ;
303
305
}
304
306
305
- public function getOrExecuteConversion (string $ name ): ?MediaConversion
306
- {
307
+ public function getOrExecuteConversion (
308
+ string $ name ,
309
+ bool $ withChildren = true ,
310
+ ): ?MediaConversion {
307
311
if ($ conversion = $ this ->getConversion ($ name )) {
308
312
return $ conversion ;
309
313
}
310
314
311
- return $ this ->executeConversion ($ name );
315
+ return $ this ->executeConversion ($ name, withChildren: $ withChildren );
312
316
}
313
317
314
318
/**
@@ -362,13 +366,8 @@ public function getChildrenConversions(string $name): EloquentCollection
362
366
->filter (fn ($ conversion ) => str_starts_with ($ conversion ->conversion_name , "{$ name }. " ));
363
367
}
364
368
365
- /**
366
- * Save a conversion and dispatch children conversions
367
- */
368
- public function replaceConversion (
369
- MediaConversion $ conversion ,
370
- bool $ regenerateChildren = true
371
- ): MediaConversion {
369
+ public function replaceConversion (MediaConversion $ conversion ): MediaConversion
370
+ {
372
371
373
372
$ existingConversion = $ this ->getConversion ($ conversion ->conversion_name );
374
373
@@ -390,12 +389,6 @@ public function replaceConversion(
390
389
);
391
390
}
392
391
393
- $ this ->generateConversions (
394
- parent: $ conversion ,
395
- filter: fn ($ definition ) => $ definition ->immediate ,
396
- force: $ regenerateChildren ,
397
- );
398
-
399
392
return $ conversion ;
400
393
}
401
394
@@ -420,8 +413,6 @@ public function addConversion(
420
413
$ conversionName = "{$ parent ->conversion_name }. {$ conversionName }" ;
421
414
}
422
415
423
- dump ('addConversion: ' .$ conversionName );
424
-
425
416
/**
426
417
* If the conversion already exists, we are going to overwrite it
427
418
*/
@@ -470,12 +461,6 @@ public function addConversion(
470
461
$ this ->conversions ->push ($ conversion );
471
462
}
472
463
473
- $ this ->generateConversions (
474
- parent: $ conversion ,
475
- filter: fn ($ definition ) => $ definition ->immediate ,
476
- force: $ regenerateChildren ,
477
- );
478
-
479
464
$ definition = $ this ->getConversionDefinition ($ conversionName );
480
465
481
466
if ($ onCompleted = $ definition ?->onCompleted) {
@@ -500,7 +485,6 @@ public function generateConversions(
500
485
?bool $ queued = null ,
501
486
bool $ force = false ,
502
487
): static {
503
- dump ('generateConversions ' );
504
488
505
489
if ($ parent ) {
506
490
$ definitions = $ this ->getChildrenConversionsDefinitions ($ parent ->conversion_name );
0 commit comments