Преглед на файлове

Merge branch 'develop'

* develop:
  get more generic
  use environment variable
  add scheduler extension
  add a line
  update readme
ksieren преди 2 години
родител
ревизия
c6a60bd027
променени са 5 файла, в които са добавени 25 реда и са изтрити 27 реда
  1. 3 0
      README.md
  2. 1 0
      composer.json
  3. 16 26
      extensions/mrm_be/Classes/Mongoer.php
  4. 4 0
      public/typo3conf/LocalConfiguration.php
  5. 1 1
      public/typo3conf/env-file-template

+ 3 - 0
README.md

@@ -52,8 +52,11 @@ External DB management access:
 6. cd into project's root folder
 7. composer install
 
+---------
+
 
 ### DDEV Setup (local development)
+
 1. Create a local project directory change to it. (cd projectdir)
 2. clone this git repo into your projectdir (git clone .....)
 3. Copy <projectdir>/public/typo3conf/env-file-template to <projectdir>/public/typo3conf/.env and set DB credentials and other

+ 1 - 0
composer.json

@@ -48,6 +48,7 @@
 		"typo3/cms-install": "^10.4.0",
 		"typo3/cms-recordlist": "^10.4.0",
 		"typo3/cms-rte-ckeditor": "^10.4.0",
+		"typo3/cms-scheduler": "^10.4",
 		"typo3/cms-seo": "^10.4.0",
 		"typo3/cms-setup": "^10.4.0",
 		"typo3/cms-sys-note": "^10.4.0",

+ 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->abi_local->pages;
+      $collection = $client->$mongodbdb->pages;
 
     if($dataType == "search")
-      $collection = $client->abi_local->searches;
+      $collection = $client->$mongodbdb->searches;
 
     if($dataType == "topthemen")
-      $collection = $client->abi_local->topthemens;
+      $collection = $client->$mongodbdb->topthemens;
 
     if($dataType == "themaderwoche")
-      $collection = $client->abi_local->themaderwoches;
+      $collection = $client->$mongodbdb->themaderwoches;
 
     if($dataType == "security")
-      $collection = $client->abi_local->pagesecurities;
+      $collection = $client->$mongodbdb->pagesecurities;
 
     if($dataType == "abialtcache")
-      $collection = $client->abi_local->abialtcaches;
+      $collection = $client->$mongodbdb->abialtcaches;
 
     if($dataType == "menues")
-      $collection = $client->abi_local->menues;
+      $collection = $client->$mongodbdb->menues;
 
     if($dataType == "maintenance")
-      $collection = $client->abi_local->maintenance;
+      $collection = $client->$mongodbdb->maintenance;
 
     if($dataType == "redirects")
-      $collection = $client->abi_local->redirects;
+      $collection = $client->$mongodbdb->redirects;
 
     if($dataType == "forwardings") 
-      $collection = $client->abi_local->forwardings;
+      $collection = $client->$mongodbdb->forwardings;
     
     if($dataType == "pdfgenjobs") 
-      $collection = $client->abi_local->pdfgenjobs;
+      $collection = $client->$mongodbdb->pdfgenjobs;
     if($dataType == "chatbot") 
-      $collection = $client->abi_local->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"