Change names for rotating logs to make easier to use when gzunzip, tweak group search menu ui, a=chris

Chris Pollett [2020-06-24 18:Jun:th]
Change names for rotating logs to make easier to use when gzunzip, tweak group search menu ui, a=chris
Filename
src/executables/QueueServer.php
src/library/Utility.php
src/views/elements/GroupmenuElement.php
src/views/elements/SearchmenuElement.php
diff --git a/src/executables/QueueServer.php b/src/executables/QueueServer.php
index a4cc1387f..4f92d1b3f 100755
--- a/src/executables/QueueServer.php
+++ b/src/executables/QueueServer.php
@@ -449,6 +449,9 @@ class QueueServer implements CrawlConstants, Join
         $info[self::STATUS] = self::WAITING_START_MESSAGE_STATE;
         L\crawlLog("In queue loop!! {$this->server_name}", $this->process_name);
         if ($this->isAIndexer()) {
+            if ($this->isOnlyIndexer()) {
+                $_SERVER["NO_ROTATE_LOGS"] = true;
+            }
             $this->deleteOrphanedBundles();
         }
         L\crawlLog("PHP Version in use: " . phpversion());
diff --git a/src/library/Utility.php b/src/library/Utility.php
index 517e46381..4e80d00cf 100755
--- a/src/library/Utility.php
+++ b/src/library/Utility.php
@@ -1008,18 +1008,22 @@ function crawlLog($msg, $lname = null, $check_process_handler = false)
     $out_msg = "[$count $time_string] $msg";
     $count = ($count + 1) % 1000000000;
     if (!empty($_SERVER["LOG_TO_FILES"])) {
-        $logfile = C\LOG_DIR . "/$logname.log";
+        $pre_logfile = C\LOG_DIR . "/$logname";
+        $logfile = "$pre_logfile.log";
         clearstatcache(); //hopefully, this doesn't slow things too much
-        if (file_exists($logfile) && filesize($logfile) > C\MAX_LOG_FILE_SIZE) {
-            if (file_exists("$logfile." . C\NUMBER_OF_LOG_FILES . ".gz")) {
-                unlink("$logfile." . C\NUMBER_OF_LOG_FILES . ".gz");
+        if (empty($_SERVER["NO_ROTATE_LOGS"]) &&
+            file_exists($logfile) && filesize($logfile) > C\MAX_LOG_FILE_SIZE) {
+            $last_logfile = "$pre_logfile." . C\NUMBER_OF_LOG_FILES . ".log.gz";
+            if (file_exists($last_logfile)) {
+                unlink($last_logfile);
             }
             for ($i = C\NUMBER_OF_LOG_FILES; $i > 0; $i--) {
-                if (file_exists("$logfile.".($i-1).".gz")) {
-                    rename("$logfile.".($i-1).".gz", "$logfile.$i.gz");
+                $previous_logfile  = "$pre_logfile.".($i-1).".log.gz";
+                if (file_exists($previous_logfile)) {
+                    rename($previous_logfile, "$pre_logfile.$i.log.gz");
                 }
             }
-            file_put_contents("$logfile.0.gz",
+            file_put_contents("$pre_logfile.0.log.gz",
                 gzencode(file_get_contents($logfile)));
             unlink($logfile);
         }
diff --git a/src/views/elements/GroupmenuElement.php b/src/views/elements/GroupmenuElement.php
index 220599487..9353dddb2 100644
--- a/src/views/elements/GroupmenuElement.php
+++ b/src/views/elements/GroupmenuElement.php
@@ -87,38 +87,6 @@ class GroupmenuElement extends Element implements CrawlConstants
                     setDisplay('menu-options', false);">&Lt;<?=
                     tl('groupmenu_element_admin_menu'); ?></a></div><?php
             } ?>
-        <h2 class="option-heading"><?php
-            if ($logged_in) {
-                e(tl('groupmenu_element_welcome_user',
-                    $_SESSION['USER_NAME']));
-            } else {
-                e(tl('groupmenu_element_welcome'));
-            }
-            ?></h2>
-            <ul class='square-list'>
-            <?php
-            if (!$logged_in) {
-                ?><li><a href="<?= B\controllerUrl('admin') ?>"><?=
-                tl('groupmenu_element_signin') ?></a></li><?php
-            } else {
-                ?><li><a href="<?=$admin_url . $token_string ?>"><?=
-                tl('groupmenu_element_manage_account') ?></a></li>
-                <li><a href="<?=$admin_url . $token_string .
-                    '&a=manageGroups' ?>"><?=
-                tl('groupmenu_element_manage_groups') ?></a></li>
-                <li><a href="<?=C\BASE_URL ?>?a=signout"><?=
-                    tl('groupmenu_element_signout') ?></a></li><?php
-            }
-            if ((!$logged_in) &&
-                in_array(C\REGISTRATION_TYPE, ['no_activation',
-                'email_registration', 'admin_activation'])) { ?>
-                <li><a href="<?=rtrim($register_url . "a=createAccount&amp;" .
-                    $token_string, "?&amp;") ?>"><?=
-                    tl('groupmenu_element_create_account')
-                    ?></a></li>
-                <?php
-            }?>
-            </ul>
             <?php
             if (isset($data['ELEMENT']) && $data['ELEMENT'] == 'wiki') {
                 $human_page_name = str_replace("_", " ", $data['PAGE_NAME']);
diff --git a/src/views/elements/SearchmenuElement.php b/src/views/elements/SearchmenuElement.php
index 34426887b..752672d04 100644
--- a/src/views/elements/SearchmenuElement.php
+++ b/src/views/elements/SearchmenuElement.php
@@ -81,10 +81,7 @@ class SearchmenuElement extends Element
                     tl('searchmenu_element_admin_menu'); ?></a></div><?php
             } ?>
         <h2 class="option-heading"><?php
-            if ($logged_in) {
-                e(tl('searchmenu_element_welcome_user',
-                    $_SESSION['USER_NAME']));
-            } else {
+            if (!$logged_in) {
                 e(tl('searchmenu_element_welcome'));
             }
             ?></h2>
@@ -93,20 +90,14 @@ class SearchmenuElement extends Element
             if (!$logged_in) {
                 ?><li><a href="<?= B\controllerUrl('admin') ?>"><?=
                 tl('searchmenu_element_signin') ?></a></li><?php
-            } else {
-                ?><li><a href="<?=$admin_url . $token_string ?>"><?=
-                tl('searchmenu_element_admin') ?></a></li>
-                <li><a href="<?=C\SHORT_BASE_URL ?>?a=signout"><?=
-                    tl('searchmenu_element_signout') ?></a></li><?php
-            }
-            if ((!$logged_in) &&
-                in_array(C\REGISTRATION_TYPE, ['no_activation',
-                'email_registration', 'admin_activation'])) { ?>
-                <li><a href="<?=rtrim($register_url . "a=createAccount&amp;" .
-                    $token_string, "?&amp;") ?>"><?=
-                    tl('searchmenu_element_create_account')
-                    ?></a></li>
-                <?php
+                if (in_array(C\REGISTRATION_TYPE, ['no_activation',
+                    'email_registration', 'admin_activation'])) { ?>
+                    <li><a href="<?=rtrim($register_url . "a=createAccount&amp;" .
+                        $token_string, "?&amp;") ?>"><?=
+                        tl('searchmenu_element_create_account')
+                        ?></a></li>
+                    <?php
+                }
             }?>
             </ul>
         <?php if (C\SUBSEARCH_LINK) { ?>
ViewGit