Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Function for updating existing rapports, adding languange constants and updating pm to rapports
- */
- public function updateExistingReports()
- {
- try{
- $guid = '2345mttsv-k65g-p03u-jlchw34bphphiiuu';
- $reports = json_decode($this->getAllReports($guid),true);
- $pmReports = array();
- $regularReports = array();
- $mongoDB = WServices::getDbo($guid, true);
- $mongoDB->collection = $mongoDB->getMongoDBCollection('fs.files');
- foreach($reports as $rep)
- {
- if($rep['model']=='pm')
- {
- $pmReports[]=$rep;
- $mongoDB->collection->update(
- array( '_id' => new \MongoId($rep['_id']['$id']) ),
- array('$set' => array(
- "model" => "rapports",
- "report_type_en-GB" => "Changelog",
- "report_type_sv-SE" => utf8_encode("Ändringslogg")
- )
- ));
- }
- else
- {
- $mongoDB->collection->update(
- array( '_id' => new \MongoId($rep['_id']['$id']) ),
- array('$set' => array(
- "report_type_en-GB" => "Report",
- "report_type_sv-SE" => "Rapport"
- )
- ));
- }
- }
- print_r($pmReports);
- }
- catch (\Exception $e)
- {
- return json_encode(array(self::ERROR => json_encode($e->getMessage())));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement