public function MongoDbProfilerStorage::write

Saves a Profile.

Parameters

Profile $profile A Profile instance:

Return value

Boolean Write operation successful

Overrides ProfilerStorageInterface::write

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php, line 91

Class

MongoDbProfilerStorage

Namespace

Symfony\Component\HttpKernel\Profiler

Code

public function write(Profile $profile) {
  $this
    ->cleanup();
  $record = array(
    '_id' => $profile
      ->getToken(),
    'parent' => $profile
      ->getParentToken(),
    'data' => serialize($profile
      ->getCollectors()),
    'ip' => $profile
      ->getIp(),
    'method' => $profile
      ->getMethod(),
    'url' => $profile
      ->getUrl(),
    'time' => $profile
      ->getTime(),
  );
  return $this
    ->getMongo()
    ->update(array(
    '_id' => $profile
      ->getToken(),
  ), array_filter($record, function ($v) {
    return !empty($v);
  }), array(
    'upsert' => true,
  ));
}