Page MenuHomePhabricator

API: Add titlematch
Closed, DuplicatePublic

Description

Add a titlematch option to the API.

In ApiQueryAllPages.php I added

		if ( isset( $params['titlematch'] ) ) {
			$titleMatchString = $params['titlematch'];
			$titleMatchStrings = explode("%", $titleMatchString);
			$titleMatchString1 = $titleMatchStrings[0];
			$titleMatchString2 = $titleMatchStrings[1];
			$titleMatchString3 = $titleMatchStrings[2];
			$this->addWhere( 'page_title' . $db->buildLike( $db->anyString(), $titleMatchString1, $db->anyString() ) );
			if($titleMatchString2) $this->addWhere( 'page_title' . $db->buildLike( $db->anyString(), $titleMatchString2, $db->anyString() ) );
			if($titleMatchString3) $this->addWhere( 'page_title' . $db->buildLike( $db->anyString(), $titleMatchString3, $db->anyString() ) );
		}

Usage: &aptitlematch=Foo / &aptitlematch=Foo%Bar / &aptitlematch=Foo%Bar%Baz

Event Timeline

Subfader raised the priority of this task from to Needs Triage.
Subfader updated the task description. (Show Details)
Subfader added a project: MediaWiki-Action-API.
Subfader subscribed.