Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maintenance] refactor maintenance (#3895)
* [Maintenance] deprecate old maintenance job and introduce new tagged services for identifiers. also extract all current core maintenance tasks into seperate maintenance files and remove Business Logic from models * deprecate the SystemEvents::MAINTENANCE Event implement EcommerceFramework Tasks with the new tag add docs for maintenance tasks * fix link to maintenance_tasks docs * [Maintenance] fix Version Cleanup Task * add missing CheckErrorLogDb Maintenance Task
- Loading branch information
1 parent
862f0b0
commit 2f3315f
Showing
50 changed files
with
1,861 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
bundles/CoreBundle/DependencyInjection/Compiler/RegisterMaintenanceTaskPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Enterprise License (PEL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PEL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler; | ||
|
||
use Pimcore\Maintenance\Executor; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
class RegisterMaintenanceTaskPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition(Executor::class)) { | ||
return; | ||
} | ||
|
||
$definition = $container->getDefinition(Executor::class); | ||
|
||
foreach ($container->findTaggedServiceIds('pimcore.maintenance.task') as $id => $tags) { | ||
if (!isset($tags[0]['type'])) { | ||
throw new \InvalidArgumentException('Tagged Maintenance Task `'.$id.'` needs to a `type` attribute.'); | ||
} | ||
|
||
$definition->addMethodCall('registerTask', [$tags[0]['type'], new Reference($id)]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
Pimcore\Maintenance\Executor: | ||
arguments: | ||
- 'maintenance.pid' | ||
- '@logger' | ||
|
||
Pimcore\Maintenance\Tasks\ScheduledTasksTask: | ||
arguments: | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: scheduledtasks } | ||
|
||
Pimcore\Maintenance\Tasks\LogMailMaintenanceTask: | ||
arguments: | ||
- '@doctrine.dbal.default_connection' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: logmaintenance } | ||
|
||
Pimcore\Maintenance\Tasks\LogCleanupTask: | ||
tags: | ||
- { name: pimcore.maintenance.task, type: cleanuplogfiles } | ||
|
||
Pimcore\Maintenance\Tasks\LogErrorCleanupTask: | ||
arguments: | ||
- '@doctrine.dbal.default_connection' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: httperrorlog } | ||
|
||
Pimcore\Maintenance\Tasks\LogArchiveTask: | ||
arguments: | ||
- '@doctrine.dbal.default_connection' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: archiveLogEntries } | ||
|
||
Pimcore\Maintenance\Tasks\SanitizeElementsTask: | ||
arguments: | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: runSanityCheck } | ||
|
||
Pimcore\Maintenance\Tasks\VersionsCleanupTask: | ||
arguments: | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: versioncleanup } | ||
|
||
Pimcore\Maintenance\Tasks\VersionsCompressTask: | ||
arguments: | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: versioncompress } | ||
|
||
Pimcore\Maintenance\Tasks\RedirectCleanupTask: | ||
arguments: | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: redirectcleanup } | ||
|
||
Pimcore\Maintenance\Tasks\DbCleanupBrokenViewsTask: | ||
arguments: | ||
- '@doctrine.dbal.default_connection' | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: cleanupbrokenviews } | ||
|
||
Pimcore\Maintenance\Tasks\DownloadMaxMinDbTask: | ||
arguments: | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: downloadmaxminddb } | ||
|
||
Pimcore\Maintenance\Tasks\CacheCleanupTask: | ||
arguments: | ||
- '@Pimcore\Cache\Core\CoreHandlerInterface' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: cleanupcache } | ||
|
||
Pimcore\Maintenance\Tasks\TmpStoreCleanupTask: | ||
arguments: | ||
- '@doctrine.dbal.default_connection' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: tmpstorecleanup } | ||
|
||
Pimcore\Maintenance\Tasks\ImageOptimizeTask: | ||
arguments: | ||
- '@Pimcore\Image\Optimizer' | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: imageoptimize } | ||
|
||
Pimcore\Maintenance\Tasks\HousekeepingTask: | ||
tags: | ||
- { name: pimcore.maintenance.task, type: housekeeping } | ||
|
||
Pimcore\Maintenance\Tasks\TagsExpireTask: | ||
arguments: | ||
- '@logger' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: markexpiredtagsdisabled } | ||
|
||
Pimcore\Maintenance\Tasks\CheckErrorLogsDbTask: | ||
arguments: | ||
- '@doctrine.dbal.default_connection' | ||
tags: | ||
- { name: pimcore.maintenance.task, type: checkerrorlogsdb } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
public: false | ||
|
||
Pimcore\Targeting\Maintenance\TargetingStorageTask: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.