From a2f451984effa5e08f96a49f0c17c7df1596c2d7 Mon Sep 17 00:00:00 2001 From: Jeff Logan Date: Sun, 19 Mar 2023 14:36:30 +0000 Subject: [PATCH] fixes and remove used code. --- lite_speed_cache.module | 10 ------ .../LiteSpeedCacheSubscriber.php | 8 ++--- src/Form/LSCacheForm.php | 34 ++----------------- 3 files changed, 6 insertions(+), 46 deletions(-) diff --git a/lite_speed_cache.module b/lite_speed_cache.module index c8fdfe0..4de19cc 100644 --- a/lite_speed_cache.module +++ b/lite_speed_cache.module @@ -30,13 +30,3 @@ function lite_speed_cache_help($route_name, RouteMatchInterface $route_match) { return $output; } } - - -/** - * Implements hook_user_login($account). - */ - - -function lite_speed_cache_user_login($account) { - $reqTemp = \Drupal::request(); -} \ No newline at end of file diff --git a/src/EventSubscriber/LiteSpeedCacheSubscriber.php b/src/EventSubscriber/LiteSpeedCacheSubscriber.php index 24d9e6e..ebc2bed 100644 --- a/src/EventSubscriber/LiteSpeedCacheSubscriber.php +++ b/src/EventSubscriber/LiteSpeedCacheSubscriber.php @@ -193,7 +193,7 @@ public function onResponse(ResponseEvent $event){ if($lsCacheDebug=='0' or $lsCacheDebug == 'On') { $response->headers->set(self::STATUSHEADER, 'LS Cache Purged!'); } - $response->headers->set(LiteSpeedCacheSubscriber::PURGEHEADER, $commonTag); + $response->headers->set(self::PURGEHEADER, $commonTag); } else { if($lsCacheDebug=='0' or $lsCacheDebug == 'On') { $response->headers->set(self::STATUSHEADER, 'No Purge!'); @@ -207,7 +207,7 @@ public function onResponse(ResponseEvent $event){ $response->headers->set(self::STATUSHEADER, 'LS Cache Purged!'); } $tags = implode(",", LSCacheTagsInvalidator::$tags); - $response->headers->set(LiteSpeedCacheSubscriber::PURGEHEADER, $tags); + $response->headers->set(self::PURGEHEADER, $tags); } else { if($lsCacheDebug=='0' or $lsCacheDebug == 'On') { $response->headers->set(self::STATUSHEADER, 'No Purge!'); @@ -220,7 +220,7 @@ public function onResponse(ResponseEvent $event){ if($lsCacheDebug=='0' or $lsCacheDebug == 'On') { $response->headers->set(self::STATUSHEADER, 'LS Cache Purged!'); } - $response->headers->set(LiteSpeedCacheSubscriber::PURGEHEADER, "*"); + $response->headers->set(self::PURGEHEADER, "*"); } else { if($lsCacheDebug=='0' or $lsCacheDebug == 'On') { $response->headers->set(self::STATUSHEADER, 'No Purge'); @@ -233,7 +233,7 @@ public function onResponse(ResponseEvent $event){ if($lsCacheDebug=='0' or $lsCacheDebug == 'On') { $response->headers->set(self::STATUSHEADER, 'LS Cache Purged!'); } - $response->headers->set(LiteSpeedCacheSubscriber::PURGEHEADER, $commonTag); + $response->headers->set(self::PURGEHEADER, $commonTag); } else { if($lsCacheDebug=='0' or $lsCacheDebug == 'On') { $response->headers->set(self::STATUSHEADER, 'No Purge'); diff --git a/src/Form/LSCacheForm.php b/src/Form/LSCacheForm.php index f49baba..aebb67d 100644 --- a/src/Form/LSCacheForm.php +++ b/src/Form/LSCacheForm.php @@ -18,19 +18,16 @@ class LSCacheForm extends ConfigFormBase /** * Purge all status variable */ - public static $purgeALL; /** * Purge this site status variable */ - public static $purgeThisSite; - + /** * crawlear this site variable */ - public static $crawlerTheSite; /** @@ -49,7 +46,6 @@ protected function getEditableConfigNames() { ]; } - /** * {@inheritdoc} */ @@ -105,22 +101,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('Weather to send or not the debug headers!'), ); - $options = ['On','Off']; - /* - - $form['cache_settings']['esi_on'] = array( - '#type' => 'select', - '#title' => $this->t('ESI'), - '#options' => $options, - '#default_value' => $config->get('lite_speed_cache.esi_on'), - '#description' => $this->t('Turn ESI On or Off for Hole Punching! Keep it disabled if you are on OpenLiteSpeed.'), - ); - - */ - - // max_age field. $form['cache_settings']['max_age'] = array( '#type' => 'textfield', @@ -129,18 +111,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('Amount of time for which page should be cached by LiteSpeed Webserver public cache (Seconds).'), ); - /* - - // max_age field. - $form['cache_settings']['max_age_private'] = array( - '#type' => 'textfield', - '#title' => $this->t('Max age private'), - '#default_value' => $config->get('lite_speed_cache.max_age_private'), - '#description' => $this->t('Amount of time for which page should be cached by LiteSpeed Webserver private cache.'), - ); - - */ - return $form; } @@ -165,7 +135,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $config->set('lite_speed_cache.cache_status', $form_state->getValue('cache_status')); $config->set('lite_speed_cache.debug', $form_state->getValue('debug')); $config->save(); - + // Prevent gzip cause broken website layout $config = $this->config('system.performance'); $config->set('css.preprocess', '0');