Skip to content

New function "exists_by_name" for class "SourceRepo" in file "Source.API.php"

Kirill requested to merge master into master-1.3.x

Created by: CamilleDesmots

I have created this function for my own needs :

	/**
	 * Check to see if a repository exists with the given name.
	 * @param string $p_name
	 * @return boolean True if repository exists
	 * @author moda@ac.rennes.fr
	 */
	static function exists_by_name( $p_name ) {
	    $t_repo_table = plugin_table( 'repository', 'Source' );
	    
	    $t_query = "SELECT * FROM $t_repo_table WHERE name LIKE " . db_param();
	    $t_result = db_query_bound( $t_query, array( trim($p_name) ) );
	    
	    return db_num_rows( $t_result ) > 0;
	}

This function permit to look for a source by it name.

Merge request reports

Loading