ksieren 3 rokov pred
rodič
commit
610e2e5047

+ 16 - 26
extensions/mrm_be/Classes/Mongoer.php

@@ -1,59 +1,49 @@
 <?php
 namespace Meramo\mrm_be;
 
-//require '/var/phpmongodb/vendor/autoload.php';
-
-
-// TODO: scheduler task alle 15 min welcher
-// select x.deleted, x.disabled, x.source_path as source, x.target, x.target_statuscode as statusCode from sys_redirect as x where x.deleted = 0 and x.disabled = 0 order by x.updatedon DESC
-// abfrägt und aber ohne deleted, disabled und mit timestamp nicht älter als 16 min ;)
-// in key value array spielt und immer nur das aktuellste sourcepath-teil (updatedon) behält
-// danach durchrequesten (deleted und disabled abfrage nicht vergessen ;) )
-// target T3LINK überprüfen
-// ganz zum schluss ein delete mongo query über deleted = 1 || disabled = 1 und dann passts
-
 class Mongoer
 {
   function __construct(){}
 
   public static function sendRequest($dataType, $action, $data){
-//    $client = new \MongoDB\Client("mongodb://db:db@mongo:27017/");
-    $client = new \MongoDB\Client($_ENV['FE_DATABASE_DSN']);
+      $mongodburl = $_ENV['FE_DATABASE_DSN'];
+      $mongodbdb = $_ENV['FE_DATABASE'];
+    $client = new \MongoDB\Client($mongodburl);
     $collection = null;
     if($dataType == "pages")
-      $collection = $client->$_ENV['FE_DATABASE']->pages;
+      $collection = $client->$mongodbdb->pages;
 
     if($dataType == "search")
-      $collection = $client->$_ENV['FE_DATABASE']->searches;
+      $collection = $client->$mongodbdb->searches;
 
     if($dataType == "topthemen")
-      $collection = $client->$_ENV['FE_DATABASE']->topthemens;
+      $collection = $client->$mongodbdb->topthemens;
 
     if($dataType == "themaderwoche")
-      $collection = $client->$_ENV['FE_DATABASE']->themaderwoches;
+      $collection = $client->$mongodbdb->themaderwoches;
 
     if($dataType == "security")
-      $collection = $client->$_ENV['FE_DATABASE']->pagesecurities;
+      $collection = $client->$mongodbdb->pagesecurities;
 
     if($dataType == "abialtcache")
-      $collection = $client->$_ENV['FE_DATABASE']->abialtcaches;
+      $collection = $client->$mongodbdb->abialtcaches;
 
     if($dataType == "menues")
-      $collection = $client->$_ENV['FE_DATABASE']->menues;
+      $collection = $client->$mongodbdb->menues;
 
     if($dataType == "maintenance")
-      $collection = $client->$_ENV['FE_DATABASE']->maintenance;
+      $collection = $client->$mongodbdb->maintenance;
 
     if($dataType == "redirects")
-      $collection = $client->$_ENV['FE_DATABASE']->redirects;
+      $collection = $client->$mongodbdb->redirects;
 
     if($dataType == "forwardings") 
-      $collection = $client->$_ENV['FE_DATABASE']->forwardings;
+      $collection = $client->$mongodbdb->forwardings;
     
     if($dataType == "pdfgenjobs") 
-      $collection = $client->$_ENV['FE_DATABASE']->pdfgenjobs;
+      $collection = $client->$mongodbdb->pdfgenjobs;
     if($dataType == "chatbot") 
-      $collection = $client->$_ENV['FE_DATABASE']->chatbot;
+      $collection = $client->$mongodbdb->chatbot;
 
     if(!$collection) return self::log("no collection for senddata: ".$dataType);
 
@@ -78,7 +68,7 @@ class Mongoer
     if(!$isString){
       $msg = json_encode($msg, JSON_PRETTY_PRINT);
     }
-    file_put_contents('/var/www/html/tuepotest/public/typo3temp/debug.log', $msg.PHP_EOL, FILE_APPEND);
+    file_put_contents('/tmp/t3mongoerdebug.log', $msg.PHP_EOL, FILE_APPEND);
   }
 
   /* Private function to drop a collection */

+ 4 - 0
public/typo3conf/LocalConfiguration.php

@@ -51,6 +51,10 @@ return [
             'automaticInstallation' => '1',
             'offlineMode' => '0',
         ],
+        'scheduler' => [
+            'maxLifetime' => '1440',
+            'showSampleTasks' => '1',
+        ],
     ],
     'FE' => [
         'debug' => false,

+ 1 - 1
public/typo3conf/env-file-template

@@ -1,7 +1,7 @@
 ## Copy this file to .env and fill in credentials there NOT HERE because this file will be versioned and the .env not. ;)
 ## MongoDB Credentials ##
 FE_DATABASE_DSN="mongodb://db:db@mongo:27017/"
-FE_DATABASE="abi_local"
+FE_DATABASE="db"
 
 ## MysqlDB Credentials ##
 BE_DATABASE="db"