芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/cache/stores/mongodb/MongoDB/Operation/Explain.php
databaseName = $databaseName; $this->explainable = $explainable; $this->options = $options; } public function execute(Server $server) { if ($this->explainable instanceof Distinct && ! \MongoDB\server_supports_feature($server, self::$wireVersionForDistinct)) { throw UnsupportedException::explainNotSupported(); } if ($this->isFindAndModify($this->explainable) && ! \MongoDB\server_supports_feature($server, self::$wireVersionForFindAndModify)) { throw UnsupportedException::explainNotSupported(); } $cmd = ['explain' => $this->explainable->getCommandDocument($server)]; if (isset($this->options['verbosity'])) { $cmd['verbosity'] = $this->options['verbosity']; } $cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions()); if (isset($this->options['typeMap'])) { $cursor->setTypeMap($this->options['typeMap']); } return current($cursor->toArray()); } /** * Create options for executing the command. * * @see http://php.net/manual/en/mongodb-driver-server.executecommand.php * @return array */ private function createOptions() { $options = []; if (isset($this->options['readPreference'])) { $options['readPreference'] = $this->options['readPreference']; } if (isset($this->options['session'])) { $options['session'] = $this->options['session']; } return $options; } private function isFindAndModify($explainable) { if ($explainable instanceof FindAndModify || $explainable instanceof FindOneAndDelete || $explainable instanceof FindOneAndReplace || $explainable instanceof FindOneAndUpdate) { return true; } return false; } }