Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/settings.admin.js30
-rw-r--r--lib/Controller/SettingsController.php10
-rw-r--r--lib/Service/BackgroundService.php4
-rw-r--r--lib/Service/ConfigService.php16
-rw-r--r--lib/Service/IndexService.php4
-rw-r--r--templates/settings.admin.php23
6 files changed, 49 insertions, 38 deletions
diff --git a/js/settings.admin.js b/js/settings.admin.js
index c20ff8a..6470816 100644
--- a/js/settings.admin.js
+++ b/js/settings.admin.js
@@ -180,7 +180,10 @@ $(document)
index_live : $('#solr_index_live').val(),
use_cron : ($('#solr_use_cron').is(':checked')) ? 1
: 0,
- index_delay : $('#solr_index_delay').val(),
+ index_delay_min : $('#solr_index_delay_min')
+ .val(),
+ index_delay_max : $('#solr_index_delay_max')
+ .val(),
force_index : force_index
}
@@ -326,11 +329,14 @@ $(document)
$('#solr_index_live').val(response.index_live);
$('#solr_index_live_queuekey').val(
response.index_live_queuekey);
-
+
$('#solr_use_cron').prop('checked',
(response.use_cron == 1));
-
- $('#solr_index_delay').val(response.index_delay);
+
+ $('#solr_index_delay_min').val(
+ response.index_delay_min);
+ $('#solr_index_delay_max').val(
+ response.index_delay_max);
if (response.index_files_tree == 1) {
$('#solr_index_files_nextant_only').attr(
@@ -728,14 +734,14 @@ $(document)
nextantSettings.savesuboptions_status();
});
- $('#solr_use_cron')
- .mousedown(
- function() {
- nextantSettings
- .savesuboptions_status('use_cron');
- });
-
- $('#solr_index_delay').on('input', function(e) {
+ $('#solr_use_cron').mousedown(function() {
+ nextantSettings.savesuboptions_status('use_cron');
+ });
+
+ $('#solr_index_delay_min').on('input', function(e) {
+ nextantSettings.savesuboptions_status();
+ });
+ $('#solr_index_delay_max').on('input', function(e) {
nextantSettings.savesuboptions_status();
});
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index e19c0e5..792c1c2 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -122,7 +122,8 @@ class SettingsController extends Controller
'index_live' => $this->configService->getAppValue('index_live'),
'index_live_queuekey' => $this->configService->getAppValue('index_live_queuekey'),
'use_cron' => $this->configService->getAppValue('use_cron'),
- 'index_delay' => $this->configService->getAppValue('index_delay'),
+ 'index_delay_min' => $this->configService->getAppValue('index_delay_min'),
+ 'index_delay_max' => $this->configService->getAppValue('index_delay_max'),
'index_locked' => $this->configService->getAppValue('index_locked'),
'index_files_last' => $this->configService->getAppValue('index_files_last'),
'index_files_last_format' => date('r', $this->configService->getAppValue('index_files_last')),
@@ -170,7 +171,7 @@ class SettingsController extends Controller
return $this->updateSubOptions(false, 'bookmarks');
}
- public function setOptionsStatus($resource_level, $index_live, $use_cron, $index_delay, $force_index)
+ public function setOptionsStatus($resource_level, $index_live, $use_cron, $index_delay_min, $index_delay_max, $force_index)
{
$this->configService->setAppValue('resource_level', $resource_level);
@@ -188,8 +189,9 @@ class SettingsController extends Controller
$this->configService->setAppValue('use_cron', $use_cron);
- if ($index_delay > 0)
- $this->configService->setAppValue('index_delay', $index_delay);
+ $this->configService->setAppValue('index_delay_min', $index_delay_min);
+ if ($index_delay_max > 0)
+ $this->configService->setAppValue('index_delay_max', $index_delay_max);
if ($force_index === '1') {
$this->configService->setAppValue('configured', '1');
diff --git a/lib/Service/BackgroundService.php b/lib/Service/BackgroundService.php
index 3c8db1d..0c8b818 100644
--- a/lib/Service/BackgroundService.php
+++ b/lib/Service/BackgroundService.php
@@ -105,7 +105,7 @@ class BackgroundService
private function cronIndex()
{
- if (($this->configService->timeIndexDelay('files') && $this->configService->neededIndexFiles()) || $this->configService->timeIndexDelay('files', 24)) {
+ if (($this->configService->timeIndexDelay('files') && $this->configService->neededIndexFiles()) || $this->configService->timeIndexDelay('files', 24 * $this->configService->getAppValue('index_delay_max'))) {
// $this->miscService->log('___cronFiles');
$this->configService->needIndexFiles(false);
$this->cronIndexFiles();
@@ -113,7 +113,7 @@ class BackgroundService
$this->configService->timeIndex('files');
}
- if (($this->configService->timeIndexDelay('bookmarks') && $this->configService->neededIndexBookmarks()) || $this->configService->timeIndexDelay('bookmarks', 24)) {
+ if (($this->configService->timeIndexDelay('bookmarks') && $this->configService->neededIndexBookmarks()) || $this->configService->timeIndexDelay('bookmarks', 24 * $this->configService->getAppValue('index_delay_max'))) {
// $this->miscService->log('___cronBookmarks');
$this->configService->needIndexBookmarks(false);
$this->cronIndexBookmarks();
diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php
index 0345d07..eb34b81 100644
--- a/lib/Service/ConfigService.php
+++ b/lib/Service/ConfigService.php
@@ -56,6 +56,8 @@ class ConfigService
'index_live' => '1',
'index_live_queuekey' => '19375',
'index_delay' => '2',
+ 'index_delay_min' => '2',
+ 'index_delay_max' => '4',
'use_cron' => '1',
'index_locked' => '0',
'index_files_last' => '0',
@@ -106,17 +108,7 @@ class ConfigService
public function removeOldConfig()
{
- $this->deleteAppValue('display_result');
- $this->deleteAppValue('solr_lock');
- $this->deleteAppValue('needed_index');
- $this->deleteAppValue('last_index');
- $this->deleteAppValue('live_extract');
- $this->deleteAppValue('live_docupdate');
- $this->deleteAppValue('max_size');
- $this->deleteAppValue('external_index');
- $this->deleteAppValue('index_files_live_extract');
- $this->deleteAppValue('index_files_live');
- $this->deleteAppValue('index_files_live_update');
+ $this->setAppValue('index_delay_min', $this->getAppValue('index_delay'));
}
public function needIndexFiles($need)
@@ -158,7 +150,7 @@ class ConfigService
public function timeIndexDelay($type, $delay = 0)
{
if ($delay == 0)
- $delay = $this->getAppValue('index_delay');
+ $delay = $this->getAppValue('index_delay_min');
// Uncomment this line to force index each tick of backgroundjob
// $delay = 0;
diff --git a/lib/Service/IndexService.php b/lib/Service/IndexService.php
index 2fea703..8b44cdb 100644
--- a/lib/Service/IndexService.php
+++ b/lib/Service/IndexService.php
@@ -179,8 +179,8 @@ class IndexService
if ($solrDocs === null)
$solrDocs = $this->getDocuments($type, $userId, 0, $ierror);
else
- if ($solrDocs === false)
- $solrDocs = $this->getDocuments($type, $userId, $data[0]->getId(), $ierror);
+ if ($solrDocs === false && reset($data) && $sync = current($data))
+ $solrDocs = $this->getDocuments($type, $userId, $sync->getId(), $ierror);
$progress = null;
if ($this->output !== null) {
diff --git a/templates/settings.admin.php b/templates/settings.admin.php
index bc89492..ab2a452 100644
--- a/templates/settings.admin.php
+++ b/templates/settings.admin.php
@@ -231,19 +231,30 @@ style('nextant', 'admin');
</tr>
<tr style="height: 30px;">
- <td class="nextant_admin_left">
- <?php p($l->t('Background Index delay :')) ?></td>
- <td><input type="text" name="solr_index_delay"
- id="solr_index_delay" value="2" style="width: 50px;" /><?php p($l->t('hours')); ?></td>
+ <td class="nextant_admin_left" style="text-valign: top;">
+ <?php p($l->t('Minimum Background Index delay :')) ?></td>
+ <td><input type="text" name="solr_index_delay_min"
+ id="solr_index_delay_min" value="2"
+ style="width: 50px; margin-right: 10px;" /><?php p($l->t('hours')); ?>
+ </td>
</tr>
+ <tr style="height: 30px;">
+ <td class="nextant_admin_left" style="text-valign: top;">
+ <?php p($l->t('Maximum Background Index delay :')) ?></td>
+ <td><input type="text" name="solr_index_delay_max"
+ id="solr_index_delay_max" value="2"
+ style="width: 50px; margin-right: 10px;" /><?php p($l->t('days')); ?>
+ </td>
+ </tr>
<tr style="height: 30px;">
<td class="nextant_admin_left">
- <?php p($l->t('Use System Cron :')); ?>
+ <?php p($l->t('Nextcloud Cron :')); ?>
</td>
<td colspan="2"><input type="checkbox" name="solr_use_cron"
- id="solr_use_cron" value="1" style="margin: 10px;" /></td>
+ id="solr_use_cron" value="1" style="margin: 10px;" />
+
</tr>
<tr style="height: 30px;">