viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Pull fetcher and queue server memory limits out as constants that can be set in a LocalConfig.php file

Chris Pollett [2020-06-25 01:Jun:th]
Pull fetcher and queue server memory limits out as constants that can be set in a LocalConfig.php file
Filename
src/configs/Config.php
src/executables/Fetcher.php
src/executables/QueueServer.php
src/views/elements/GroupmenuElement.php
diff --git a/src/configs/Config.php b/src/configs/Config.php
index e143985b4..d3d492249 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -667,6 +667,10 @@ nsconddefine('VERSION_0_TIMESTAMP', 1369754208);
 nsconddefine('VERSION_1_TIMESTAMP', 1528045371);
 /** What version format to use for default indexing **/
 nsconddefine('DEFAULT_CRAWL_FORMAT', 2);
+/** Max memory a QueueServer can use */
+nsconddefine('QUEUE_SERVER_MEMORY_LIMIT', "3000M");
+/** Max memory a Fetcher can use */
+nsconddefine('FETCHER_MEMORY_LIMIT', "1500M");
 defineMemoryProfile();
 /**
  * Code to determine how much memory current machine has
diff --git a/src/executables/Fetcher.php b/src/executables/Fetcher.php
index f5053ed69..1021c0053 100755
--- a/src/executables/Fetcher.php
+++ b/src/executables/Fetcher.php
@@ -50,8 +50,6 @@ if (php_sapi_name() != 'cli' ||
     defined("seekquarry\\yioop\\configs\\IS_OWN_WEB_SERVER")) {
     echo "BAD REQUEST"; exit();
 }
-ini_set("memory_limit", "1200M"); //so have enough memory to crawl sitemaps
-
 /** for L\crawlHash and L\crawlLog and Yioop constants*/
 require_once __DIR__ . "/../library/Utility.php";
 if (!C\PROFILE) {
@@ -59,6 +57,7 @@ if (!C\PROFILE) {
         "its web interface on localhost.\n";
     exit();
 }
+ini_set("memory_limit", C\FETCHER_MEMORY_LIMIT);
 /** To guess language based on page encoding */
 require_once __DIR__ . "/../library/LocaleFunctions.php";
 /*
diff --git a/src/executables/QueueServer.php b/src/executables/QueueServer.php
index a58aeae3e..05472dddd 100755
--- a/src/executables/QueueServer.php
+++ b/src/executables/QueueServer.php
@@ -48,7 +48,6 @@ if (!defined("seekquarry\\yioop\\configs\\UNIT_TEST_MODE")) {
         echo "BAD REQUEST"; exit();
     }
 }
-ini_set("memory_limit","2500M"); //so have enough memory to crawl big pages
 /**  For crawlHash function and Yioop constants */
 require_once __DIR__ . "/../library/Utility.php";
 if (!C\PROFILE) {
@@ -56,6 +55,7 @@ if (!C\PROFILE) {
         "by visiting its web interface on localhost.\n";
     exit();
 }
+ini_set("memory_limit", C\QUEUE_SERVER_MEMORY_LIMIT);
 /*
  * We'll set up multi-byte string handling to use UTF-8
  */
diff --git a/src/views/elements/GroupmenuElement.php b/src/views/elements/GroupmenuElement.php
index 9353dddb2..c4588f943 100644
--- a/src/views/elements/GroupmenuElement.php
+++ b/src/views/elements/GroupmenuElement.php
@@ -86,8 +86,22 @@ class GroupmenuElement extends Element implements CrawlConstants
                     href="javascript:setDisplay('admin-menu-options', true);
                     setDisplay('menu-options', false);">&Lt;<?=
                     tl('groupmenu_element_admin_menu'); ?></a></div><?php
-            } ?>
-            <?php
+            }
+            if ((!$logged_in) &&
+                in_array(C\REGISTRATION_TYPE, ['no_activation',
+                'email_registration', 'admin_activation'])) { ?>
+                <h2 class="option-heading"><?=tl('groupmenu_element_welcome')
+                    ?></h2>
+                <ul>
+                <li><a href="<?= B\controllerUrl('admin') ?>"><?=
+                tl('groupmenu_element_signin') ?></a></li>
+                <li><a href="<?=rtrim($register_url . "a=createAccount&amp;" .
+                    $token_string, "?&amp;") ?>"><?=
+                    tl('groupmenu_element_create_account')
+                    ?></a></li>
+                </ul>
+                <?php
+            }
             if (isset($data['ELEMENT']) && $data['ELEMENT'] == 'wiki') {
                 $human_page_name = str_replace("_", " ", $data['PAGE_NAME']);
                 if (!empty($data['SUB_PATH'])) {
ViewGit