apps/federation/lib/DbHandler.php
/**
	 * add server to the list of trusted servers
	 *
	 * @param string $url
	 * @return int
	 * @throws HintException
	 */
add server to the list of trusted servers
@param string $url
@return int
@throws HintException
add server to the list of trusted servers @param string $url @return int @throws HintException
public function addServer($url) {
		$hash = $this->hash($url);
		$url = rtrim($url, '/');
		$query = $this->connection->getQueryBuilder();
		$query->insert($this->dbTable)
			->values(
				[
					'url' =>  $query->createParameter('url'),
					'url_hash' => $query->createParameter('url_hash'),
				]
			)
			->setParameter('url', $url)
			->setParameter('url_hash', $hash);
		$result = $query->execute();
		if ($result) {
			return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable);
		} else {
			$message = 'Internal failure, Could not add trusted server: ' . $url;
			$message_t = $this->IL10N->t('Could not add server');
			throw new HintException($message, $message_t);
		}
	}
public function addServer ( $ url ) { $ hash = $ this -> hash ( $ url ) ; $ url = rtrim ( $ url , '/' ) ; $ query = $ this -> connection -> getQueryBuilder ( ) ; $ query -> insert ( $ this -> dbTable ) -> values ( [ 'url' => $ query -> createParameter ( 'url' ) , 'url_hash' => $ query -> createParameter ( 'url_hash' ) , ] ) -> setParameter ( 'url' , $ url ) -> setParameter ( 'url_hash' , $ hash ) ; $ result = $ query -> execute ( ) ; if ( $ result ) { return ( int ) $ this -> connection -> lastInsertId ( '*PREFIX*' . $ this -> dbTable ) ; } else { $ message = 'Internal failure, Could not add trusted server: ' . $ url ; $ message_t = $ this -> IL10N -> t ( 'Could not add server' ) ; throw new HintException ( $ message , $ message_t ) ; } }
add server to the list of trusted servers
 @param string $url
 @return int
 @throws HintException
add server to the list of trusted servers @param string $url @return int @throws HintException