Browse Source

Change o_maintenance

Visman 3 years ago
parent
commit
8f3ee74868

+ 1 - 1
app/Controllers/Primary.php

@@ -34,7 +34,7 @@ class Primary
     public function check(): ?Page
     {
         if (
-            $this->c->config->o_maintenance
+            1 == $this->c->config->b_maintenance
             && ! $this->c->MAINTENANCE_OFF
         ) {
             if (

+ 1 - 1
app/Models/Page.php

@@ -281,7 +281,7 @@ abstract class Page extends Model
     protected function iswevMessages(): void
     {
         if (
-            '1' == $this->c->config->o_maintenance
+            1 == $this->c->config->b_maintenance
             && $this->user->isAdmin
         ) {
             $this->fIswev = ['w', ['Maintenance mode enabled', $this->c->Router->link('AdminMaintenance')]];

+ 1 - 1
app/Models/Pages/Admin/Install.php

@@ -1249,7 +1249,7 @@ class Install extends Admin
             'o_announcement_message'  => __('Announcement '),
             'b_rules'                 => 0,
             'o_rules_message'         => __('Rules '),
-            'o_maintenance'           => 0,
+            'b_maintenance'           => 0,
             'o_maintenance_message'   => __('Maintenance message '),
             'o_default_dst'           => 0,
             'i_feed_type'             => 2,

+ 5 - 5
app/Models/Pages/Admin/Maintenance.php

@@ -34,7 +34,7 @@ class Maintenance extends Admin
                     'check_message' => [$this, 'vCheckMessage'],
                 ])->addRules([
                     'token'                 => 'token:AdminMaintenance',
-                    'o_maintenance'         => 'required|integer|in:0,1',
+                    'b_maintenance'         => 'required|integer|in:0,1',
                     'o_maintenance_message' => 'string:trim|max:65000 bytes|check_message|html',
                 ])->addAliases([
                 ])->addArguments([
@@ -42,7 +42,7 @@ class Maintenance extends Admin
                 ]);
 
             if ($v->validation($_POST)) {
-                $this->c->config->o_maintenance         = $v->o_maintenance;
+                $this->c->config->b_maintenance         = $v->b_maintenance;
                 $this->c->config->o_maintenance_message = $v->o_maintenance_message;
                 $this->c->config->save();
 
@@ -74,9 +74,9 @@ class Maintenance extends Admin
                 'maint' => [
                     'legend' => 'Maintenance head',
                     'fields' => [
-                        'o_maintenance' => [
+                        'b_maintenance' => [
                             'type'    => 'radio',
-                            'value'   => $config->o_maintenance,
+                            'value'   => $config->b_maintenance,
                             'values'  => [1 => __('Yes'), 0 => __('No')],
                             'caption' => 'Maintenance mode label',
                             'help'    => 'Maintenance mode help',
@@ -170,7 +170,7 @@ class Maintenance extends Admin
     public function vCheckMessage(Validator $v, $value)
     {
         if (
-            1 === $v->o_maintenance
+            1 === $v->b_maintenance
             && 0 === \strlen($value)
         ) {
             $value = __('Default maintenance message');

+ 2 - 0
app/Models/Pages/Admin/Update.php

@@ -521,7 +521,9 @@ class Update extends Admin
         $config->b_regs_allow          = '1' == $config->o_regs_allow ? 1 : 0;
         $config->b_announcement        = '1' == $config->o_announcement ? 1 : 0;
         $config->b_rules               = '1' == $config->o_rules ? 1 : 0;
+        $config->b_maintenance         = '1' == $config->o_maintenance ? 1 : 0;
 
+        unset($config->o_maintenance);
         unset($config->o_rules);
         unset($config->o_announcement);
         unset($config->o_regs_allow);

+ 1 - 1
app/config/install.php

@@ -44,7 +44,7 @@ return [
         'o_default_lang'   => 'en',
         'o_default_style'  => 'ForkBB',
         'i_redirect_delay' => 0,
-        'o_maintenance'    => 0,
+        'b_maintenance'    => 0,
         'o_smtp_host'      => '',
         'o_smtp_user'      => '',
         'o_smtp_pass'      => '',