Skip to content
Snippets Groups Projects
Commit de021f4d authored by Antonín Slejška's avatar Antonín Slejška
Browse files

Issue #3360452: Move the configuration entity to a separate module.

parent dbfaf618
No related branches found
No related tags found
1 merge request!1Issue #3360452: Move the configuration entity to a separate module.
Showing
with 91 additions and 43 deletions
...@@ -14,16 +14,10 @@ INTRODUCTION ...@@ -14,16 +14,10 @@ INTRODUCTION
------------ ------------
The module enables to delete specified temporary storages. The temporary The module enables to delete specified temporary storages. The temporary
storages can be specified in the Drupal administration storages can be specified in the Drupal administration (if the module tsk_all is
(admin/config/development/performance/tsk). The temporary storages can be on the enabled: admin/config/development/performance/tsk).
same path deleted. There is also a command, which can be used to delete the
temporary storages:
drush temp-store-killer:all You can also kill a specified temporary storage with the command:
drush tska
But you can also specify the temporary storage to be deleted directly in the
command:
# Delete all private temporary storages of the collection email_tfa: # Delete all private temporary storages of the collection email_tfa:
drush temp-store-killer private email_tfa drush temp-store-killer private email_tfa
...@@ -31,6 +25,13 @@ command: ...@@ -31,6 +25,13 @@ command:
# "layout_builder.section_storage.overrides" with key "my_page.11.full.en": # "layout_builder.section_storage.overrides" with key "my_page.11.full.en":
drush tsk shared layout_builder.section_storage.overrides my_page.11.full.en drush tsk shared layout_builder.section_storage.overrides my_page.11.full.en
If the module tsk_all is enabled, the temporary storages specified in the
configuration can be killed with the following command:
drush temp-store-killer:all
drush tska
More info: More info:
* For a full description of the module, visit * For a full description of the module, visit
...@@ -59,6 +60,9 @@ INSTALLATION ...@@ -59,6 +60,9 @@ INSTALLATION
CONFIGURATION CONFIGURATION
------------- -------------
The module tsk has no configuration. The module tsk_all brings the possibility
to configure the temporary storages, which should be killed.
You can create a configuration entity for every temporary storage (collection) You can create a configuration entity for every temporary storage (collection)
in the administration (admin/config/development/performance/tsk). There are the in the administration (admin/config/development/performance/tsk). There are the
following fields in the configuration entity form: following fields in the configuration entity form:
...@@ -70,8 +74,9 @@ following fields in the configuration entity form: ...@@ -70,8 +74,9 @@ following fields in the configuration entity form:
deleted.) deleted.)
* Key (The key of the stored data) * Key (The key of the stored data)
If you then klick the button 'Kill all', or run the 'drush kill-temp-store' If you then klick the button 'Kill all', or run the
command, all the specified temporary storages will be deleted. 'drush temp-store-killer:all' command, all the specified temporary storages will
be deleted.
TROUBLESHOOTING TROUBLESHOOTING
--------------- ---------------
......
services:
tsk_all.commands:
class: \Drupal\tsk_all\Commands\TskAllCommands
arguments: ['@tsk.service']
tags:
- { name: drush.command }
<?php
namespace Drupal\tsk_all\Commands;
use Drush\Commands\DrushCommands;
use Drupal\tsk\Services\TskService;
/**
* Drush integration for the module Temporary Storages Killer.
*/
class TskAllCommands extends DrushCommands {
/**
* TskService.
*
* @var \Drupal\tsk\Services\TskService
*/
protected $tskService;
/**
* TskCommands constructor.
*
* @param \Drupal\tsk\Services\TskService $tsk_service
* Temporary Storage Killer service.
*/
public function __construct(TskService $tsk_service) {
$this->tskService = $tsk_service;
}
/**
* Kills the specified temporary storages.
*
* @command temp-store-killer:all
* @aliases tska
* @usage drush temp-store-killer:all
* Kills the specified temporary storages.
*/
public function killAll() {
$this->tskService->killAll();
}
}
<?php <?php
namespace Drupal\tsk\Controller; namespace Drupal\tsk_all\Controller;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Drupal\tsk\Entity\TskEntity; use Drupal\tsk\Entity\TskEntity;
...@@ -10,12 +10,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -10,12 +10,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Defines TskController class. * Defines TskController class.
*/ */
class TskController extends ControllerBase { class TskAllController extends ControllerBase {
/** /**
* Defines TskService. * Defines TskService.
* *
* @var \Drupal\simple_sitemap\Simplesitemap * @var \Drupal\tsk\Services\TskService
*/ */
protected $tskService; protected $tskService;
......
<?php <?php
namespace Drupal\tsk\Entity; namespace Drupal\tsk_all\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Config\Entity\ConfigEntityBase;
...@@ -10,14 +10,14 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; ...@@ -10,14 +10,14 @@ use Drupal\Core\Config\Entity\ConfigEntityBase;
* @ConfigEntityType( * @ConfigEntityType(
* id = "tsk_entity", * id = "tsk_entity",
* label = @Translation("Temporary Storage Killer Entity"), * label = @Translation("Temporary Storage Killer Entity"),
* module = "tsk", * module = "tsk_all",
* config_prefix = "tsk", * config_prefix = "tsk",
* handlers = { * handlers = {
* "list_builder" = "Drupal\tsk\TskEntityListBuilder", * "list_builder" = "Drupal\tsk_all\TskEntityListBuilder",
* "form" = { * "form" = {
* "add" = "Drupal\tsk\Form\TskEntityForm", * "add" = "Drupal\tsk_all\Form\TskEntityForm",
* "edit" = "Drupal\tsk\Form\TskEntityForm", * "edit" = "Drupal\tsk_all\Form\TskEntityForm",
* "delete" = "Drupal\tsk\Form\TskEntityDeleteForm", * "delete" = "Drupal\tsk_all\Form\TskEntityDeleteForm",
* } * }
* }, * },
* admin_permission = "administer temporary storage killer", * admin_permission = "administer temporary storage killer",
......
<?php <?php
namespace Drupal\tsk\Entity; namespace Drupal\tsk_all\Entity;
use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Config\Entity\ConfigEntityInterface;
......
<?php <?php
namespace Drupal\tsk\Form; namespace Drupal\tsk_all\Form;
use Drupal\Core\Entity\EntityConfirmFormBase; use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityStorageException;
......
<?php <?php
namespace Drupal\tsk\Form; namespace Drupal\tsk_all\Form;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityForm;
...@@ -51,7 +51,7 @@ class TskEntityForm extends EntityForm { ...@@ -51,7 +51,7 @@ class TskEntityForm extends EntityForm {
$form = parent::form($form, $form_state); $form = parent::form($form, $form_state);
// Attach the custom library. // Attach the custom library.
$form['#attached']['library'][] = 'tsk/entityForm'; $form['#attached']['library'][] = 'tsk_all/entityForm';
$form['private'] = [ $form['private'] = [
'#type' => 'checkbox', '#type' => 'checkbox',
......
<?php <?php
namespace Drupal\tsk; namespace Drupal\tsk_all;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
......
name: 'Temporary Storages Killer config entity'
type: module
description: 'Provides a config entity and user interface for Temporary Storage Killer.'
core_version_requirement: ^9.2 || ^10
package: Other
configure: entity.tsk_entity
dependencies:
- tsk:tsk
entityForm: entityForm:
css: css:
base: base:
assets/css/tsk-entity-form.css: {} assets/css/tsk-all-entity-form.css: {}
js: js:
assets/js/tsk-entity-form.js: {} assets/js/tsk-all-entity-form.js: {}
dependencies: dependencies:
- core/jquery - core/jquery
- core/drupal - core/drupal
File moved
File moved
File moved
...@@ -29,12 +29,12 @@ entity.tsk_entity.delete: ...@@ -29,12 +29,12 @@ entity.tsk_entity.delete:
entity.tsk_entity.kill: entity.tsk_entity.kill:
path: '/admin/config/development/performance/tsk/{tsk_entity}/kill' path: '/admin/config/development/performance/tsk/{tsk_entity}/kill'
defaults: defaults:
_controller: '\Drupal\tsk\Controller\TskController::kill' _controller: '\Drupal\tsk_all\Controller\TskAllController::kill'
requirements: requirements:
_permission: 'administer tsk' _permission: 'administer tsk'
entity.tsk_entity.kill_all: entity.tsk_entity.kill_all:
path: '/admin/config/development/performance/tsk/kill-all' path: '/admin/config/development/performance/tsk/kill-all'
defaults: defaults:
_controller: '\Drupal\tsk\Controller\TskController::killAll' _controller: '\Drupal\tsk_all\Controller\TskAllController::killAll'
requirements: requirements:
_permission: 'administer tsk' _permission: 'administer tsk'
...@@ -27,18 +27,6 @@ class TskCommands extends DrushCommands { ...@@ -27,18 +27,6 @@ class TskCommands extends DrushCommands {
$this->tskService = $tsk_service; $this->tskService = $tsk_service;
} }
/**
* Kills the specified temporary storages.
*
* @command temp-store-killer:all
* @aliases tska
* @usage drush temp-store-killer:all
* Kills the specified temporary storages.
*/
public function killAll() {
$this->tskService->killAll();
}
/** /**
* Kills a temporary storage. * Kills a temporary storage.
* *
......
name: 'Temporary Storages Killer' name: 'Temporary Storages Killer'
type: module type: module
description: 'Provides a Drush command, which can kill specified temporary storages.' description: 'Provides a Drush command, which can kill a specified temporary storage.'
core_version_requirement: ^9.2 || ^10 core_version_requirement: ^9.2 || ^10
package: Other package: Other
configure: entity.tsk_entity
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment