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