public function replicate($src, $target, $continuous = false, $createTarget = null, $filter = null, $filterQueryParams = null) {
    if(empty($src) || !is_string($src)) {
      throw new SagException('replicate() is missing a source to replicate from.');
    }

    if(empty($target) || !is_string($target)) {
      throw new SagException('replicate() is missing a target to replicate to.');
    }

    if(!is_bool($continuous)) {
      throw new SagException('replicate() expected a boolean for its third argument.');
    }

    if(isset($createTarget) && !is_bool($createTarget)) {
      throw new SagException('createTarget needs to be a boolean.');
    }

    if(isset($filter)) {
      if(!is_string($filter)) {
        throw new SagException('filter must be the name of a design doc\'s filter function: ddoc/filter');
      }

      if(isset($filterQueryParams) && !is_object($filterQueryParams) && !is_array($filterQueryParams)) {
        throw new SagException('filterQueryParams needs to be an object or an array');
      }
    }

    $data = new stdClass();
    $data->source = $src;
    $data->target = $target;

    /*
     * These guys are optional, so only include them if non-default to save on
     * packet size.
     */
    if($continuous) {
      $data->continuous = true;
    }

    if($createTarget) {
      $data->create_target = true;
    }

    if($filter) {
      $data->filter = $filter;

      if($filterQueryParams) {
        $data->query_params = $filterQueryParams;
      }
    }

    return $this->procPacket('POST', '/_replicate', json_encode($data));
  }
public function replicate($src, $target, $continuous = false, $createTarget = null, $filter = null, $filterQueryParams = null) {
    if(empty($src) || !is_string($src)) {
      throw new SagException('replicate() is missing a source to replicate from.');
    }

    if(empty($target) || !is_string($target)) {
      throw new SagException('replicate() is missing a target to replicate to.');
    }

    if(!is_bool($continuous)) {
      throw new SagException('replicate() expected a boolean for its third argument.');
    }

    if(isset($createTarget) && !is_bool($createTarget)) {
      throw new SagException('createTarget needs to be a boolean.');
    }

    if(isset($filter)) {
      if(!is_string($filter)) {
        throw new SagException('filter must be the name of a design doc\'s filter function: ddoc/filter');
      }

      if(isset($filterQueryParams) && !is_object($filterQueryParams) && !is_array($filterQueryParams)) {
        throw new SagException('filterQueryParams needs to be an object or an array');
      }
    }

    $data = new stdClass();
    $data->source = $src;
    $data->target = $target;

    /*
     * These guys are optional, so only include them if non-default to save on
     * packet size.
     */
    if($continuous) {
      $data->continuous = true;
    }

    if($createTarget) {
      $data->create_target = true;
    }

    if($filter) {
      $data->filter = $filter;

      if($filterQueryParams) {
        $data->query_params = $filterQueryParams;
      }
    }

    return $this->procPacket('POST', '/_replicate', json_encode($data));
  }
public function replicate ( $ src , $ target , $ continuous = false , $ createTarget = null , $ filter = null , $ filterQueryParams = null ) { if ( empty ( $ src ) || ! is_string ( $ src ) ) { throw new SagException ( 'replicate() is missing a source to replicate from.' ) ; } if ( empty ( $ target ) || ! is_string ( $ target ) ) { throw new SagException ( 'replicate() is missing a target to replicate to.' ) ; } if ( ! is_bool ( $ continuous ) ) { throw new SagException ( 'replicate() expected a boolean for its third argument.' ) ; } if ( isset ( $ createTarget ) && ! is_bool ( $ createTarget ) ) { throw new SagException ( 'createTarget needs to be a boolean.' ) ; } if ( isset ( $ filter ) ) { if ( ! is_string ( $ filter ) ) { throw new SagException ( 'filter must be the name of a design doc\'s filter function: ddoc/filter' ) ; } if ( isset ( $ filterQueryParams ) && ! is_object ( $ filterQueryParams ) && ! is_array ( $ filterQueryParams ) ) { throw new SagException ( 'filterQueryParams needs to be an object or an array' ) ; } } $ data = new stdClass ( ) ; $ data -> source = $ src ; $ data -> target = $ target ; /*
     * These guys are optional, so only include them if non-default to save on
     * packet size.
     */ if ( $ continuous ) { $ data -> continuous = true ; } if ( $ createTarget ) { $ data -> create_target = true ; } if ( $ filter ) { $ data -> filter = $ filter ; if ( $ filterQueryParams ) { $ data -> query_params = $ filterQueryParams ; } } return $ this -> procPacket ( 'POST' , '/_replicate' , json_encode ( $ data ) ) ; }
Starts a replication job between two databases, independently of which
database you set with Sag.

@param string $src The name of the database that you are replicating from.
@param string $target The name of the database that you are replicating
to.
@param bool $continuous Whether to make this a continuous replication job
or not. Defaults to false.
@param bool $createTarget Specifies create_target, which will create the
target database if it does not already exist. (optional)
@param string $filter The name of the filter function to use. (optional)
@param mixed $filterQueryParams An object or associative array of
parameters to be passed to the filter function via query_params. Only used
if $filter is set.

@return mixed
Starts a replication job between two databases independently of which database you set with Sag .