Skip to content

Commit

Permalink
fixes and remove used code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflogan303 committed Mar 19, 2023
1 parent 47dbd93 commit a2f4519
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 46 deletions.
10 changes: 0 additions & 10 deletions lite_speed_cache.module
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
8 changes: 4 additions & 4 deletions src/EventSubscriber/LiteSpeedCacheSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
Expand All @@ -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!');
Expand All @@ -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');
Expand All @@ -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');
Expand Down
34 changes: 2 additions & 32 deletions src/Form/LSCacheForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -49,7 +46,6 @@ protected function getEditableConfigNames() {
];
}


/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -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',
Expand All @@ -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;
}

Expand All @@ -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');
Expand Down

0 comments on commit a2f4519

Please sign in to comment.