Commit 913a990d authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge changes I6f8f5c52,I001850f4

* changes:
  Item limit control on "shared with me" (bug 1409369)
  patch for forcing search plugin check (bug 1298553)
parents 00a04978 8d56c77c
...@@ -828,7 +828,6 @@ function siteoptions_submit(Pieform $form, $values) { ...@@ -828,7 +828,6 @@ function siteoptions_submit(Pieform $form, $values) {
save_notification_settings($values, null, true); save_notification_settings($values, null, true);
// If they've changed the search plugin, give the new plugin a chance to initialize.
if ($oldsearchplugin != $values['searchplugin']) { if ($oldsearchplugin != $values['searchplugin']) {
// Call the old search plugin's sitewide cleanup method // Call the old search plugin's sitewide cleanup method
safe_require('search', $oldsearchplugin); safe_require('search', $oldsearchplugin);
...@@ -843,6 +842,15 @@ function siteoptions_submit(Pieform $form, $values) { ...@@ -843,6 +842,15 @@ function siteoptions_submit(Pieform $form, $values) {
)); ));
} }
} }
// Call the new search plugin's can connect
safe_require('search', $values['searchplugin']);
$connect = call_static_method(generate_class_name('search', $values['searchplugin']), 'can_connect');
if (!$connect) {
$form->reply(PIEFORM_ERR, array(
'message' => get_string('searchconfigerror1', 'admin', $values['searchplugin']),
'goto' => '/admin/site/options.php',
));
}
// submitted sessionlifetime is in minutes; db entry session_timeout is in seconds // submitted sessionlifetime is in minutes; db entry session_timeout is in seconds
if (!set_config('session_timeout', $values['sessionlifetime'] * 60)) { if (!set_config('session_timeout', $values['sessionlifetime'] * 60)) {
......
...@@ -72,6 +72,7 @@ $pagination = build_pagination(array( ...@@ -72,6 +72,7 @@ $pagination = build_pagination(array(
'count' => $data->count, 'count' => $data->count,
'limit' => $limit, 'limit' => $limit,
'offset' => $offset, 'offset' => $offset,
'setlimit' => true,
)); ));
$smarty = smarty_core(); $smarty = smarty_core();
......
...@@ -147,6 +147,15 @@ abstract class PluginSearch extends Plugin implements IPluginSearch { ...@@ -147,6 +147,15 @@ abstract class PluginSearch extends Plugin implements IPluginSearch {
return true; return true;
} }
/**
* This function gets called everytime the site options are saved. It is used to
* detect whether the search plugin can connect to any servers it requires.
* Defaults to true.
*/
public static function can_connect() {
return true;
}
/** /**
* This function determines whether the plugin is currently available to be chosen * This function determines whether the plugin is currently available to be chosen
* as the sitewide search plugin (i.e. get_config('searchplugin')) * as the sitewide search plugin (i.e. get_config('searchplugin'))
......
...@@ -134,6 +134,7 @@ $pagination = build_pagination(array( ...@@ -134,6 +134,7 @@ $pagination = build_pagination(array(
'count' => $data->count, 'count' => $data->count,
'limit' => $limit, 'limit' => $limit,
'offset' => $offset, 'offset' => $offset,
'setlimit' => true,
)); ));
$smarty = smarty(array('paginator')); $smarty = smarty(array('paginator'));
......
Supports Markdown
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