Loading core/modules/system/src/Controller/PerformanceController.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php namespace Drupal\system\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\system\Form\ClearCacheForm; use Drupal\system\Form\PerformanceForm; /** * Controller for performance admin. */ class PerformanceController extends ControllerBase { /** * Displays the system performance page. * * @return array * A render array containing the cache-clear form and performance * configuration form. */ public function build(): array { return [ 'cache_clear' => $this->formBuilder()->getForm(ClearCacheForm::class), 'performance' => $this->formBuilder()->getForm(PerformanceForm::class), ]; } } core/modules/system/src/Form/ClearCacheForm.php 0 → 100644 +49 −0 Original line number Diff line number Diff line <?php namespace Drupal\system\Form; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; /** * Clear caches for this site. * * @internal */ class ClearCacheForm extends FormBase { /** * {@inheritdoc} */ public function getFormId() { return 'system_clear_cache'; } /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { $form['clear_cache'] = [ '#type' => 'details', '#title' => $this->t('Clear cache'), '#open' => TRUE, ]; $form['clear_cache']['clear'] = [ '#type' => 'submit', '#value' => $this->t('Clear all caches'), ]; return $form; } /** * Clears the caches. */ public function submitForm(array &$form, FormStateInterface $form_state) { drupal_flush_all_caches(); $this->messenger()->addStatus($this->t('Caches cleared.')); } } core/modules/system/src/Form/PerformanceForm.php +0 −20 Original line number Diff line number Diff line Loading @@ -104,18 +104,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('system.performance'); $form['clear_cache'] = [ '#type' => 'details', '#title' => $this->t('Clear cache'), '#open' => TRUE, ]; $form['clear_cache']['clear'] = [ '#type' => 'submit', '#value' => $this->t('Clear all caches'), '#submit' => ['::submitCacheClear'], ]; $form['caching'] = [ '#type' => 'details', '#title' => $this->t('Caching'), Loading Loading @@ -185,12 +173,4 @@ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); } /** * Clears the caches. */ public function submitCacheClear(array &$form, FormStateInterface $form_state) { drupal_flush_all_caches(); $this->messenger()->addStatus($this->t('Caches cleared.')); } } core/modules/system/system.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ system.logging_settings: system.performance_settings: path: '/admin/config/development/performance' defaults: _form: '\Drupal\system\Form\PerformanceForm' _controller: '\Drupal\system\Controller\PerformanceController::build' _title: 'Performance' requirements: _permission: 'administer site configuration' Loading Loading
core/modules/system/src/Controller/PerformanceController.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php namespace Drupal\system\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\system\Form\ClearCacheForm; use Drupal\system\Form\PerformanceForm; /** * Controller for performance admin. */ class PerformanceController extends ControllerBase { /** * Displays the system performance page. * * @return array * A render array containing the cache-clear form and performance * configuration form. */ public function build(): array { return [ 'cache_clear' => $this->formBuilder()->getForm(ClearCacheForm::class), 'performance' => $this->formBuilder()->getForm(PerformanceForm::class), ]; } }
core/modules/system/src/Form/ClearCacheForm.php 0 → 100644 +49 −0 Original line number Diff line number Diff line <?php namespace Drupal\system\Form; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; /** * Clear caches for this site. * * @internal */ class ClearCacheForm extends FormBase { /** * {@inheritdoc} */ public function getFormId() { return 'system_clear_cache'; } /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { $form['clear_cache'] = [ '#type' => 'details', '#title' => $this->t('Clear cache'), '#open' => TRUE, ]; $form['clear_cache']['clear'] = [ '#type' => 'submit', '#value' => $this->t('Clear all caches'), ]; return $form; } /** * Clears the caches. */ public function submitForm(array &$form, FormStateInterface $form_state) { drupal_flush_all_caches(); $this->messenger()->addStatus($this->t('Caches cleared.')); } }
core/modules/system/src/Form/PerformanceForm.php +0 −20 Original line number Diff line number Diff line Loading @@ -104,18 +104,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('system.performance'); $form['clear_cache'] = [ '#type' => 'details', '#title' => $this->t('Clear cache'), '#open' => TRUE, ]; $form['clear_cache']['clear'] = [ '#type' => 'submit', '#value' => $this->t('Clear all caches'), '#submit' => ['::submitCacheClear'], ]; $form['caching'] = [ '#type' => 'details', '#title' => $this->t('Caching'), Loading Loading @@ -185,12 +173,4 @@ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); } /** * Clears the caches. */ public function submitCacheClear(array &$form, FormStateInterface $form_state) { drupal_flush_all_caches(); $this->messenger()->addStatus($this->t('Caches cleared.')); } }
core/modules/system/system.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ system.logging_settings: system.performance_settings: path: '/admin/config/development/performance' defaults: _form: '\Drupal\system\Form\PerformanceForm' _controller: '\Drupal\system\Controller\PerformanceController::build' _title: 'Performance' requirements: _permission: 'administer site configuration' Loading