diff options
author | daita <maxence@pontapreta.net> | 2017-02-06 13:03:37 +0300 |
---|---|---|
committer | daita <maxence@pontapreta.net> | 2017-02-06 13:03:37 +0300 |
commit | 03788329fa0109c8934c7eae8f83472ec8c436dd (patch) | |
tree | 9b3617f8062bf4680c8612eb61036f3e2bebdca6 | |
parent | 012780cae0269f0f9ec93231c54bc12b127979d7 (diff) |
#136 - removing Semaphore support
-rw-r--r-- | js/settings.admin.js | 38 | ||||
-rw-r--r-- | lib/Command/Check.php | 4 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 28 | ||||
-rw-r--r-- | lib/Service/ConfigService.php | 6 | ||||
-rw-r--r-- | lib/Service/QueueService.php | 38 | ||||
-rw-r--r-- | templates/settings.admin.php | 8 |
6 files changed, 63 insertions, 59 deletions
diff --git a/js/settings.admin.js b/js/settings.admin.js index 6470816..1f670db 100644 --- a/js/settings.admin.js +++ b/js/settings.admin.js @@ -221,29 +221,29 @@ $(document) $('#solr_core').val(response.solr_core); $('#solr_timeout').val(response.solr_timeout); - if (response.index_live == 1 - && response.ext_sysvmsg_loaded == false) - response.index_live = 2; + // if (response.index_live == 1 + // && response.ext_sysvmsg_loaded == false) + // response.index_live = 2; if (response.configured > 0) { $('#nextant_suboptions :input').prop( 'disabled', false); $('#nextant_help_link').unbind('click'); $('#nextant_suboptions').fadeTo(delay, 1); - $('#solr_index_live_queuekey').prop('disabled', - true); - if (response.index_live == 1) - $('#solr_index_live_queuekey').fadeTo( - delay, 0.85); - else - $('#solr_index_live_queuekey').fadeTo( - delay, 0); - if (response.ext_sysvmsg_loaded == false) - $('#solr_index_live option[value="1"]') - .prop('disabled', true); - else - $('#solr_index_live option[value="1"]') - .prop('disabled', false); + // $('#solr_index_live_queuekey').prop('disabled', + // true); + // if (response.index_live == 1) + // $('#solr_index_live_queuekey').fadeTo( + // delay, 0.85); + // else + // $('#solr_index_live_queuekey').fadeTo( + // delay, 0); + // if (response.ext_sysvmsg_loaded == false) + // $('#solr_index_live option[value="1"]') + // .prop('disabled', true); + // else + // $('#solr_index_live option[value="1"]') + // .prop('disabled', false); } else { $('#nextant_suboptions :input').attr( @@ -327,8 +327,8 @@ $(document) response.resource_level); $('#solr_index_live').val(response.index_live); - $('#solr_index_live_queuekey').val( - response.index_live_queuekey); + // $('#solr_index_live_queuekey').val( + // response.index_live_queuekey); $('#solr_use_cron').prop('checked', (response.use_cron == 1)); diff --git a/lib/Command/Check.php b/lib/Command/Check.php index 09812fa..fa7de06 100644 --- a/lib/Command/Check.php +++ b/lib/Command/Check.php @@ -86,8 +86,8 @@ class Check extends Base $info['solr_url'] = '**HIDDEN**'; $info['solr_core'] = '**HIDDEN**'; - $qk = $info['index_live_queuekey']; - $info['index_live_queuekey'] = substr($qk, 0, - 3) . '???'; + // $qk = $info['index_live_queuekey']; + // $info['index_live_queuekey'] = substr($qk, 0, - 3) . '???'; } $output->writeln(var_export($info, true)); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 2585856..1227b25 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -120,7 +120,6 @@ class SettingsController extends Controller 'index_bookmarks_needed' => $this->configService->getAppValue('index_bookmarks_needed'), 'resource_level' => $this->configService->getAppValue('resource_level'), '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_min' => $this->configService->getAppValue('index_delay_min'), 'index_delay_max' => $this->configService->getAppValue('index_delay_max'), @@ -132,6 +131,7 @@ class SettingsController extends Controller 'ext_sysvmsg_loaded' => extension_loaded('sysvmsg'), 'source' => $source ); + // 'index_live_queuekey' => $this->configService->getAppValue('index_live_queuekey'), return $response; } @@ -175,17 +175,17 @@ class SettingsController extends Controller { $this->configService->setAppValue('resource_level', $resource_level); - if ($index_live === '1') { - if (extension_loaded('sysvmsg')) { - - if ($this->configService->getAppValue('index_live') !== '1') - $this->configService->setAppValue('index_live_queuekey', rand(20000, 990000)); - - $this->configService->setAppValue('index_live', $index_live); - } - } else { - $this->configService->setAppValue('index_live', $index_live); - } + // if ($index_live === '1') { + // if (extension_loaded('sysvmsg')) { + + // if ($this->configService->getAppValue('index_live') !== '1') + // $this->configService->setAppValue('index_live_queuekey', rand(20000, 990000)); + + // $this->configService->setAppValue('index_live', $index_live); + // } + // } else { + $this->configService->setAppValue('index_live', $index_live); + // } $this->configService->setAppValue('use_cron', $use_cron); @@ -418,8 +418,8 @@ class SettingsController extends Controller if ($this->configService->getAppValue('configured') !== '1') { $this->configService->setAppValue('configured', '2'); - if (! extension_loaded('sysvmsg')) - $this->configService->setAppValue('index_live', '2'); + // if (! extension_loaded('sysvmsg')) + // $this->configService->setAppValue('index_live', '2'); } $message = $this->l10n->t('Your configuration has been saved'); diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index eb34b81..3c1dfd2 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -53,7 +53,7 @@ class ConfigService 'solr_timeout' => '30', 'resource_level' => '4', - 'index_live' => '1', + 'index_live' => '2', 'index_live_queuekey' => '19375', 'index_delay' => '2', 'index_delay_min' => '2', @@ -108,7 +108,9 @@ class ConfigService public function removeOldConfig() { - $this->setAppValue('index_delay_min', $this->getAppValue('index_delay')); + if ($this->getAppValue('index_live') === '1') + $this->setAppValue('index_live', '2'); + // $this->setAppValue('index_delay_min', $this->getAppValue('index_delay')); } public function needIndexFiles($need) diff --git a/lib/Service/QueueService.php b/lib/Service/QueueService.php index 7e2cc99..b5423d6 100644 --- a/lib/Service/QueueService.php +++ b/lib/Service/QueueService.php @@ -68,11 +68,11 @@ class QueueService case '0': return; - case '1': - $queue = msg_get_queue($this->configService->getAppValue('index_live_queuekey')); - if (! msg_send($queue, 1, ItemQueue::toJson($item))) - $this->miscService->log('can\'t msg_send()'); - break; +// case '1': +// $queue = msg_get_queue($this->configService->getAppValue('index_live_queuekey')); +// if (! msg_send($queue, 1, ItemQueue::toJson($item))) +// $this->miscService->log('can\'t msg_send()'); +// break; case '2': $this->liveQueueMapper->insert(new LiveQueue($item)); @@ -86,9 +86,9 @@ class QueueService case '0': return; - case '1': - msg_remove_queue(msg_get_queue($this->configService->getAppValue('index_live_queuekey'))); - break; +// case '1': +// msg_remove_queue(msg_get_queue($this->configService->getAppValue('index_live_queuekey'))); +// break; case '2': $this->liveQueueMapper->clear(); @@ -102,22 +102,22 @@ class QueueService case '0': return; - case '1': - $queue = msg_get_queue($this->configService->getAppValue('index_live_queuekey')); +// case '1': +// $queue = msg_get_queue($this->configService->getAppValue('index_live_queuekey')); - $msg_type = null; - $msg = null; - $max_msg_size = 512; +// $msg_type = null; +// $msg = null; +// $max_msg_size = 512; - $infos = msg_stat_queue($queue); +// $infos = msg_stat_queue($queue); - if (! $standby && $infos['msg_qnum'] === 0) - return false; +// if (! $standby && $infos['msg_qnum'] === 0) +// return false; - if (! msg_receive($queue, 1, $msg_type, $max_msg_size, $msg, true, 0, $error)) - return false; +// if (! msg_receive($queue, 1, $msg_type, $max_msg_size, $msg, true, 0, $error)) +// return false; - return ItemQueue::fromJson($msg); +// return ItemQueue::fromJson($msg); case '2': $msg = null; diff --git a/templates/settings.admin.php b/templates/settings.admin.php index ab2a452..fb60e56 100644 --- a/templates/settings.admin.php +++ b/templates/settings.admin.php @@ -224,10 +224,12 @@ style('nextant', 'admin'); </td> <td colspan="2"><select id="solr_index_live" style="width: 200px"> <option value="0"><?php p($l->t('Disabled')); ?></option> - <option value="1"><?php p($l->t('Using Semaphore')); ?></option> + <!-- <option value="1"><?php p($l->t('Using Semaphore')); ?></option> --> <option value="2"><?php p($l->t('Using Database')); ?></option> - </select> <input type="text" id="solr_index_live_queuekey" - style="width: 100px; font-size: 12px;" /></td> + </select> +<!-- <input type="text" id="solr_index_live_queuekey" + style="width: 100px; font-size: 12px;" /> --> + </td> </tr> <tr style="height: 30px;"> |