Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtificialOwl committed Oct 14, 2016
1 parent b19cd47 commit c23686a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
7 changes: 4 additions & 3 deletions js/settings.admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ $(document)

nextantSettings.saving(true);

var index_needed = -1;
var force_index = 0;
if (switched == 'force_index')
index_files_needed = 1;
force_index = 1;

var data = {
index_files_live_extract : ($('#solr_index_files_live_extract')
.is(':checked')) ? 1 : 0,
Expand All @@ -64,7 +65,7 @@ $(document)
.is(':checked')) ? 1 : 0,
display_result : $('#solr_display_result')
.val(),
index_files_needed : index_files_needed
force_index : force_index
}

if (switched == 'index_files_live_extract')
Expand Down
4 changes: 3 additions & 1 deletion lib/Command/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

if ($input->getOption('background')) {
$this->configService->needIndexFiles(true, ($input->getOption('force')));
if ($input->getOption('force'))
$this->configService->setAppValue('configured', '1');
$this->configService->needIndexFiles(true);
$this->configService->setAppValue('index_locked', '0');
$output->writeln('An indexing process will start as a background process within the next few hours');
return;
Expand Down
8 changes: 5 additions & 3 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,18 @@ public function updateSubOptions($instant)
return $response;
}

public function setOptions($index_files_live_extract, $index_files_live_update, $index_files_max_size, $index_files_external_index, $index_bookmarks, $display_result, $index_files_needed)
public function setOptions($index_files_live_extract, $index_files_live_update, $index_files_max_size, $index_files_external_index, $index_bookmarks, $display_result, $force_index)
{
$this->configService->setAppValue('index_files_live_extract', $index_files_live_extract);
$this->configService->setAppValue('index_files_live_update', $index_files_live_update);
$this->configService->setAppValue('index_files_external_index', $index_files_external_index);
$this->configService->setAppValue('index_files_max_size', $index_files_max_size);
$this->configService->setAppValue('index_bookmarks', $index_bookmarks);
$this->configService->setAppValue('display_result', $display_result);
if ($index_files_needed == 1)
$this->configService->needIndexFiles(true, true);
if ($force_index == '1') {
$this->configService->setAppValue('configured', '1');
$this->configService->needIndexFiles(true);
}

return $this->updateSubOptions(false);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Cron/BackgroundIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ protected function run($argument)
$this->rootFolder = $c->query('RootFolder');

// $this->setDebug(true);

if (! $this->solrService->configured(false))
return;

if (! $this->configService->neededIndexFiles()) {
$this->miscService->debug('Looks like there is no need to index');
return;
Expand Down
9 changes: 4 additions & 5 deletions lib/Service/ConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ public function copyConfigFrom050()
$this->deleteAppValue('external_index');
}

public function needIndexFiles($need, $force = false)
public function needIndexFiles($need)
{
if (! $need)
if ($need)
$this->setAppValue('index_files_needed', '1');
else
$this->setAppValue('index_files_needed', '0');
else
if ($force || $this->getAppValue('index_files_needed') == '0')
$this->setAppValue('index_files_needed', '1');
}

public function neededIndexFiles()
Expand Down

0 comments on commit c23686a

Please sign in to comment.