Skip to content

Commit

Permalink
Merge pull request #6 from a2hosting/a2opt-358
Browse files Browse the repository at this point in the history
Refactor how we are setting and checking for file editor lock
  • Loading branch information
supersoju authored Aug 3, 2021
2 parents 08a5cae + d749c75 commit 9ee869a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
12 changes: 4 additions & 8 deletions A2_Optimized_Optimizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,9 @@ protected function get_public_optimizations() {
//make sure the basic a2-optimized rules are present
$thisclass->set_install_status('htaccess-deny-direct-access', false);
} else {
if ($thisclass->get_deny_direct() == false) {
$thisclass->set_deny_direct(true);
if ($thisclass->get_deny_direct() == true) {
$item['configured'] = true;
}
$item['configured'] = true;
$thisclass->set_install_status('htaccess-deny-direct-access', true);
}
},
'enable' => function () use (&$thisclass) {
Expand All @@ -547,11 +545,9 @@ protected function get_public_optimizations() {
}
$thisclass->set_install_status('lock-editing', false);
} else {
if ($thisclass->get_lockdown() == false) {
$thisclass->set_lockdown(true);
if ($thisclass->get_lockdown() == true) {
$item['configured'] = true;
}
$item['configured'] = true;
$thisclass->set_install_status('lock-editing', true);
}
},
'enable' => function () use (&$thisclass) {
Expand Down
18 changes: 15 additions & 3 deletions A2_Optimized_OptionsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2495,11 +2495,19 @@ public function get_advanced_optimizations() {
*
*/
public function set_lockdown($lockdown = true) {
update_option('a2_optimized_lockdown', $lockdown);
if ($lockdown == false) {
delete_option('a2_optimized_lockdown');
} else {
update_option('a2_optimized_lockdown', $lockdown);
}
}

public function set_nomods($lockdown = true) {
update_option('a2_optimized_nomods', $lockdown);
if ($lockdown == false) {
delete_option('a2_optimized_nomods');
} else {
update_option('a2_optimized_nomods', $lockdown);
}
}

/**
Expand All @@ -2508,7 +2516,11 @@ public function set_nomods($lockdown = true) {
*
*/
public function set_deny_direct($deny = true) {
update_option('a2_optimized_deny_direct', $deny);
if ($deny == false) {
delete_option('a2_optimized_deny_direct');
} else {
update_option('a2_optimized_deny_direct', $deny);
}
}

/**
Expand Down

0 comments on commit 9ee869a

Please sign in to comment.