$_ENV['FE_DATABASE']->pages; if($dataType == "search") $collection = $client->$_ENV['FE_DATABASE']->searches; if($dataType == "topthemen") $collection = $client->$_ENV['FE_DATABASE']->topthemens; if($dataType == "themaderwoche") $collection = $client->$_ENV['FE_DATABASE']->themaderwoches; if($dataType == "security") $collection = $client->$_ENV['FE_DATABASE']->pagesecurities; if($dataType == "abialtcache") $collection = $client->$_ENV['FE_DATABASE']->abialtcaches; if($dataType == "menues") $collection = $client->$_ENV['FE_DATABASE']->menues; if($dataType == "maintenance") $collection = $client->$_ENV['FE_DATABASE']->maintenance; if($dataType == "redirects") $collection = $client->$_ENV['FE_DATABASE']->redirects; if($dataType == "forwardings") $collection = $client->$_ENV['FE_DATABASE']->forwardings; if($dataType == "pdfgenjobs") $collection = $client->$_ENV['FE_DATABASE']->pdfgenjobs; if($dataType == "chatbot") $collection = $client->$_ENV['FE_DATABASE']->chatbot; if(!$collection) return self::log("no collection for senddata: ".$dataType); self::log("sendRequest ".$action." ".$dataType); if($action == "save"){ $updateResult = $collection->updateOne( ['pageuid' => $data['pageuid']], ['$set' => $data], ['upsert' => true], ); } if($action == "delete"){ $collection->deleteOne(['pageuid' => $data['pageuid']]); } if($action == "deleteAll") { $collection->deleteMany([]); } } /* PRIVATES */ private static function log($msg, $isString = true){ 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); } /* Private function to drop a collection */ public static function deleteAll($collection) { return $collection->deleteMany(); } }