Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Commit 8c90bbe

Browse files
authored
Merge pull request perftools#339 from perftools/id-override
2 parents b077dc0 + 94d0e02 commit 8c90bbe

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/Xhgui/Saver/MongoSaver.php

+1-14
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,11 @@ public function save(array $data)
4242
];
4343

4444
$a = [
45-
'_id' => $data['_id'] ?? self::getLastProfilingId(),
45+
'_id' => $data['_id'] ?? new MongoId(),
4646
'meta' => $meta,
4747
'profile' => $data['profile'],
4848
];
4949

5050
return $this->_collection->insert($a, ['w' => 0]);
5151
}
52-
53-
/**
54-
* Return profiling ID
55-
* @return MongoId lastProfilingId
56-
*/
57-
public static function getLastProfilingId()
58-
{
59-
if (!self::$lastProfilingId) {
60-
self::$lastProfilingId = new MongoId();
61-
}
62-
63-
return self::$lastProfilingId;
64-
}
6552
}

src/Xhgui/Saver/PdoSaver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function save(array $data)
9494
$usec = $ts['usec'];
9595

9696
$this->stmt->execute([
97-
'id' => Util::generateId(),
97+
'id' => $data['_id'] ?? Util::generateId(),
9898
'profile' => json_encode($data['profile']),
9999
'url' => $data['meta']['url'],
100100
'SERVER' => json_encode($data['meta']['SERVER']),

0 commit comments

Comments
 (0)