To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit cc3798b3 authored by vermeul's avatar vermeul
Browse files

syntax sugar: wikitext -> wiki_text, errors are thrown if category does not exist

parent 157b21ce
...@@ -52,8 +52,13 @@ class YATA { ...@@ -52,8 +52,13 @@ class YATA {
$where = array(); $where = array();
$dbr = wfGetDB( DB_REPLICA ); $dbr = wfGetDB( DB_REPLICA );
$seen = array(); $seen = array();
$errors = array();
foreach($query_params["query"] as $query) { foreach($query_params["query"] as $query) {
list($field, $values) = preg_split('/\s*\:\s*/', $query[0]); list($field, $values) = preg_split('/\s*\:\s*/', $query[0]);
# syntax-sugar
if ($field === 'wikitext') {
$field = 'wiki_text';
}
if( $field === 'category') { if( $field === 'category') {
$categories = preg_split('/\s*\,\s*/', $values); $categories = preg_split('/\s*\,\s*/', $values);
$cat_ids = array(); $cat_ids = array();
...@@ -67,7 +72,7 @@ class YATA { ...@@ -67,7 +72,7 @@ class YATA {
} }
} }
else { else {
//throw new Exception("no such category found: $category"); array_push($errors, "no such category found: $category");
} }
} }
$where[] = $where[] =
...@@ -93,6 +98,13 @@ class YATA { ...@@ -93,6 +98,13 @@ class YATA {
} }
} }
if ( $errors) {
foreach( $errors as $error) {
$errstr .= $error . "<br/>";
}
return $errstr;
}
# fetch the annotation details # fetch the annotation details
$annotations = $dbr->select( $annotations = $dbr->select(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment