From dbb4a053d36dcce83139347952bf3791bb89b644 Mon Sep 17 00:00:00 2001 From: Aparup Banerjee Date: Wed, 27 Oct 2010 03:50:59 +0000 Subject: [PATCH] global search MDL-24625 - maintenance fixes to (regressions in) search documents. - some table references to old modname_comments tables changed to {comments} table. --- search/add.php | 6 +++--- search/documents/assignment_document.php | 2 +- search/documents/chat_document.php | 2 +- search/documents/data_document.php | 4 ++-- search/documents/forum_document.php | 2 +- search/documents/glossary_document.php | 2 +- search/documents/resource_document.php | 2 +- search/documents/wiki_document.php | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/search/add.php b/search/add.php index 2de112f7f97..f15a3492059 100644 --- a/search/add.php +++ b/search/add.php @@ -90,7 +90,7 @@ $valuesArray = $db_names_function(); if ($valuesArray){ foreach($valuesArray as $values){ - $where = (isset($values[5])) ? 'AND ('.$values[5].')' : ''; + $where = (isset($values[5]) and $values[5]!='') ? 'AND ('.$values[5].')' : ''; $itemtypes = ($values[4] != '*' && $values[4] != 'any') ? " AND itemtype = '{$values[4]}' " : '' ; //select records in MODULE table, but not in SEARCH_DATABASE_TABLE @@ -108,14 +108,14 @@ $docIds = $DB->get_records_sql_menu($query, array($mod->name)); if (!empty($docIds)){ - list($usql, $params) = $DB->get_in_or_equal(array_keys('$docIds'), SQL_PARAMS_QM, 'param0000', false); // negative IN + list($usql, $params) = $DB->get_in_or_equal(array_keys($docIds), SQL_PARAMS_QM, 'param0000', false); // negative IN $query = " SELECT id, $values[0] as docid FROM {{$values[1]}} WHERE - id $uslq AND + id $usql AND $values[2] > $indexdate $where "; diff --git a/search/documents/assignment_document.php b/search/documents/assignment_document.php index e2ca1abf579..b278ad41a4d 100644 --- a/search/documents/assignment_document.php +++ b/search/documents/assignment_document.php @@ -284,7 +284,7 @@ function assignment_delete($info, $itemtype) { * // TODO chat indexable records are virtual. Should proceed in a special way */ function assignment_db_names() { - //[primary id], [table name], [time created field name], [time modified field name] + //[primary id], [table name], [time created field name], [time modified field name], [docsubtype], [additional where conditions for sql]] return array( array('id', 'assignment', 'timemodified', 'timemodified', 'description'), array('id', 'assignment_submissions', 'timecreated', 'timemodified', 'submitted') diff --git a/search/documents/chat_document.php b/search/documents/chat_document.php index fa1e0035926..e4cf354e8d0 100644 --- a/search/documents/chat_document.php +++ b/search/documents/chat_document.php @@ -246,7 +246,7 @@ function chat_delete($info, $itemtype) { * // TODO chat indexable records are virtual. Should proceed in a special way */ function chat_db_names() { - //[primary id], [table name], [time created field name], [time modified field name] + //[primary id], [table name], [time created field name], [time modified field name], [docsubtype], [additional where conditions for sql] return null; } diff --git a/search/documents/data_document.php b/search/documents/data_document.php index 09dad4f4d8e..514fc0b8c45 100644 --- a/search/documents/data_document.php +++ b/search/documents/data_document.php @@ -318,10 +318,10 @@ function data_delete($info, $itemtype) { * */ function data_db_names() { - //[primary id], [table name], [time created field name], [time modified field name] + //[primary id], [table name], [time created field name], [time modified field name], [docsubtype], [additional where conditions for sql] return array( array('id', 'data_records', 'timecreated', 'timemodified', 'record'), - array('id', 'data_comments', 'created', 'modified', 'comment') + array('id', 'comments', 'timecreated', 'timecreated', 'comment') ); } diff --git a/search/documents/forum_document.php b/search/documents/forum_document.php index b3403f91903..e494e988499 100644 --- a/search/documents/forum_document.php +++ b/search/documents/forum_document.php @@ -165,7 +165,7 @@ function forum_delete($info, $itemtype) { * */ function forum_db_names() { - //[primary id], [table name], [time created field name], [time modified field name] + //[primary id], [table name], [time created field name], [time modified field name], [docsubtype], [additional where conditions for sql] return array( array('id', 'forum_posts', 'created', 'modified', 'head', 'parent = 0'), array('id', 'forum_posts', 'created', 'modified', 'post', 'parent != 0') diff --git a/search/documents/glossary_document.php b/search/documents/glossary_document.php index e874b7fb064..ac04e9b8d83 100644 --- a/search/documents/glossary_document.php +++ b/search/documents/glossary_document.php @@ -227,7 +227,7 @@ function glossary_db_names() { //[primary id], [table name], [time created field name], [time modified field name] return array( array('id', 'glossary_entries', 'timecreated', 'timemodified', 'standard'), - array('id', 'glossary_comments', 'timemodified', 'timemodified', 'comment') + array('id', 'comments', 'timecreated', 'timecreated', 'comment') ); } diff --git a/search/documents/resource_document.php b/search/documents/resource_document.php index 1f6d78c8147..529d76243e9 100644 --- a/search/documents/resource_document.php +++ b/search/documents/resource_document.php @@ -299,7 +299,7 @@ function resource_delete($info, $itemtype) { */ function resource_db_names() { //[primary id], [table name], [time created field name], [time modified field name], [additional where conditions for sql] - return array(array('id', 'resource', 'timemodified', 'timemodified', 'any', " (alltext != '' AND alltext != ' ' AND alltext != ' ' AND TYPE != 'file') OR TYPE = 'file' ")); + return array(array('id', 'resource_old', 'timemodified', 'timemodified', 'any', " (alltext != '' AND alltext != ' ' AND alltext != ' ' AND TYPE != 'file') OR TYPE = 'file' ")); } /** diff --git a/search/documents/wiki_document.php b/search/documents/wiki_document.php index e31e463e9ef..96d84e301c8 100644 --- a/search/documents/wiki_document.php +++ b/search/documents/wiki_document.php @@ -240,8 +240,8 @@ function wiki_delete($info, $itemtype) { //returns the var names needed to build a sql query for addition/deletions function wiki_db_names() { - //[primary id], [table name], [time created field name], [time modified field name] - return array(array('id', 'wiki_pages', 'created', 'lastmodified', 'standard')); + //[primary id], [table name], [time created field name], [time modified field name], [docsubtype], [additional where conditions for sql] + return array(array('id', 'wiki_pages', 'timecreated', 'lastmodified', 'standard')); } /**