芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/atvcmsTRASH.com.br/maisqtv2/vendor/mongodb/mongodb/src/Operation/ListDatabases.php
options = $options; } /** * Execute the operation. * * @see Executable::execute() * @param Server $server * @return DatabaseInfoIterator * @throws UnexpectedValueException if the command response was malformed * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) { $cmd = ['listDatabases' => 1]; if ( ! empty($this->options['filter'])) { $cmd['filter'] = (object) $this->options['filter']; } if (isset($this->options['maxTimeMS'])) { $cmd['maxTimeMS'] = $this->options['maxTimeMS']; } $cursor = $server->executeCommand('admin', new Command($cmd), $this->createOptions()); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); $result = current($cursor->toArray()); if ( ! isset($result['databases']) || ! is_array($result['databases'])) { throw new UnexpectedValueException('listDatabases command did not return a "databases" array'); } /* Return an Iterator instead of an array in case listDatabases is * eventually changed to return a command cursor, like the collection * and index enumeration commands. This makes the "totalSize" command * field inaccessible, but users can manually invoke the command if they * need that value. */ return new DatabaseInfoLegacyIterator($result['databases']); } /** * Create options for executing the command. * * Note: read preference is intentionally omitted, as the spec requires that * the command be executed on the primary. * * @see http://php.net/manual/en/mongodb-driver-server.executecommand.php * @return array */ private function createOptions() { $options = []; if (isset($this->options['session'])) { $options['session'] = $this->options['session']; } return $options; } }