|
@@ -1,59 +1,49 @@
|
|
|
<?php
|
|
<?php
|
|
|
namespace Meramo\mrm_be;
|
|
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
|
|
class Mongoer
|
|
|
{
|
|
{
|
|
|
function __construct(){}
|
|
function __construct(){}
|
|
|
|
|
|
|
|
public static function sendRequest($dataType, $action, $data){
|
|
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;
|
|
$collection = null;
|
|
|
if($dataType == "pages")
|
|
if($dataType == "pages")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->pages;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->pages;
|
|
|
|
|
|
|
|
if($dataType == "search")
|
|
if($dataType == "search")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->searches;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->searches;
|
|
|
|
|
|
|
|
if($dataType == "topthemen")
|
|
if($dataType == "topthemen")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->topthemens;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->topthemens;
|
|
|
|
|
|
|
|
if($dataType == "themaderwoche")
|
|
if($dataType == "themaderwoche")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->themaderwoches;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->themaderwoches;
|
|
|
|
|
|
|
|
if($dataType == "security")
|
|
if($dataType == "security")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->pagesecurities;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->pagesecurities;
|
|
|
|
|
|
|
|
if($dataType == "abialtcache")
|
|
if($dataType == "abialtcache")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->abialtcaches;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->abialtcaches;
|
|
|
|
|
|
|
|
if($dataType == "menues")
|
|
if($dataType == "menues")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->menues;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->menues;
|
|
|
|
|
|
|
|
if($dataType == "maintenance")
|
|
if($dataType == "maintenance")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->maintenance;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->maintenance;
|
|
|
|
|
|
|
|
if($dataType == "redirects")
|
|
if($dataType == "redirects")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->redirects;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->redirects;
|
|
|
|
|
|
|
|
if($dataType == "forwardings")
|
|
if($dataType == "forwardings")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->forwardings;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->forwardings;
|
|
|
|
|
|
|
|
if($dataType == "pdfgenjobs")
|
|
if($dataType == "pdfgenjobs")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->pdfgenjobs;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->pdfgenjobs;
|
|
|
if($dataType == "chatbot")
|
|
if($dataType == "chatbot")
|
|
|
- $collection = $client->$_ENV['FE_DATABASE']->chatbot;
|
|
|
|
|
|
|
+ $collection = $client->$mongodbdb->chatbot;
|
|
|
|
|
|
|
|
if(!$collection) return self::log("no collection for senddata: ".$dataType);
|
|
if(!$collection) return self::log("no collection for senddata: ".$dataType);
|
|
|
|
|
|
|
@@ -78,7 +68,7 @@ class Mongoer
|
|
|
if(!$isString){
|
|
if(!$isString){
|
|
|
$msg = json_encode($msg, JSON_PRETTY_PRINT);
|
|
$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 */
|
|
/* Private function to drop a collection */
|