Browse Source

Recalculation of the number of user messages/topics (in the admin panel - in users) is available only in maintenance mode

Visman 1 year ago
parent
commit
6f97f2c78d

+ 15 - 0
app/Models/Pages/Admin/Users/View.php

@@ -416,6 +416,10 @@ class View extends Users
      */
      */
     public function recalculate(array $args, string $method): Page
     public function recalculate(array $args, string $method): Page
     {
     {
+        if (1 !== $this->c->config->b_maintenance) {
+            return $this->c->Message->message('Maintenance only');
+        }
+
         $v = $this->c->Validator->reset()
         $v = $this->c->Validator->reset()
         ->addValidators([
         ->addValidators([
         ])->addRules([
         ])->addRules([
@@ -471,6 +475,17 @@ class View extends Users
             ],
             ],
         ];
         ];
 
 
+        if (1 !== $this->c->config->b_maintenance) {
+            $form['sets']['maintenance-only'] = [
+                'inform' => [
+                    [
+                        'message' => 'Maintenance only',
+                    ],
+                ],
+            ];
+            $form['btns']['recalculate']['disabled'] = true;
+        }
+
         return $form;
         return $form;
     }
     }
 }
 }

+ 3 - 0
app/lang/en/admin.po

@@ -83,3 +83,6 @@ msgstr "Uploads"
 
 
 msgid "Antispam"
 msgid "Antispam"
 msgstr "Antispam"
 msgstr "Antispam"
+
+msgid "Maintenance only"
+msgstr "Available only in maintenance mode."

+ 3 - 0
app/lang/ru/admin.po

@@ -83,3 +83,6 @@ msgstr "Загрузки"
 
 
 msgid "Antispam"
 msgid "Antispam"
 msgstr "Антиспам"
 msgstr "Антиспам"
+
+msgid "Maintenance only"
+msgstr "Доступно только в режиме обслуживания."

+ 1 - 1
app/templates/layouts/form.forkbb.php

@@ -113,7 +113,7 @@
           <p class="f-btns">
           <p class="f-btns">
     @foreach ($form['btns'] as $key => $cur)
     @foreach ($form['btns'] as $key => $cur)
         @if ('submit' === $cur['type'])
         @if ('submit' === $cur['type'])
-            <button class="f-btn f-fbtn @if($cur['class']) {{ \implode(' ', $cur['class']) }} @endif" name="{{ $key }}" value="{{ $cur['value'] }}" @isset ($cur['accesskey']) accesskey="{{ $cur['accesskey'] }}" @endisset title="{{ $cur['value'] }}"><span>{{ $cur['value'] }}</span></button>
+            <button class="f-btn f-fbtn @if($cur['class']) {{ \implode(' ', $cur['class']) }} @endif" name="{{ $key }}" value="{{ $cur['value'] }}" @isset ($cur['accesskey']) accesskey="{{ $cur['accesskey'] }}" @endisset title="{{ $cur['value'] }}" @if ($cur['disabled']) disabled @endif><span>{{ $cur['value'] }}</span></button>
         @elseif ('btn'=== $cur['type'])
         @elseif ('btn'=== $cur['type'])
             <a class="f-btn f-fbtn @if($cur['class']) {{ \implode(' ', $cur['class']) }} @endif" data-name="{{ $key }}" href="{{ $cur['href'] }}" @isset ($cur['accesskey']) accesskey="{{ $cur['accesskey'] }}" @endisset title="{{ $cur['value'] }}"><span>{{ $cur['value'] }}</span></a>
             <a class="f-btn f-fbtn @if($cur['class']) {{ \implode(' ', $cur['class']) }} @endif" data-name="{{ $key }}" href="{{ $cur['href'] }}" @isset ($cur['accesskey']) accesskey="{{ $cur['accesskey'] }}" @endisset title="{{ $cur['value'] }}"><span>{{ $cur['value'] }}</span></a>
         @endif
         @endif