Provide a way to disable automatical updates checking

This commit is contained in:
Dmitriy Simushev 2015-05-26 14:45:34 +00:00
parent 2fc85b1068
commit 4e7f9eac50
4 changed files with 20 additions and 7 deletions

View File

@ -111,6 +111,7 @@ class FeaturesController extends AbstractController
'showonlineoperators',
'enablecaptcha',
'trackoperators',
'autocheckupdates',
);
}
}

View File

@ -97,14 +97,16 @@ class CronWorker
$dispatcher = EventDispatcher::getInstance();
$dispatcher->triggerEvent(Events::CRON_RUN);
// Run the update checker
if (!$this->updateChecker->run()) {
$this->errors = array_merge(
$this->errors,
$this->updateChecker->getErrors()
);
if (Settings::get('autocheckupdates') == '1') {
// Run the update checker
if (!$this->updateChecker->run()) {
$this->errors = array_merge(
$this->errors,
$this->updateChecker->getErrors()
);
return false;
return false;
}
}
} catch (\Exception $e) {
$this->log[] = $e->getMessage();

View File

@ -97,6 +97,7 @@ class Settings
'surveyaskgroup' => '1',
'surveyaskmessage' => '0',
'enablepopupnotification' => '0',
'autocheckupdates' => '1', /* Check updates automatically */
'showonlineoperators' => '0',
'enablecaptcha' => '0',
'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */

View File

@ -172,6 +172,15 @@
<br clear="all"/>
</div>
<div class="field">
<label for="autocheck-updates" class="field-label">{{l10n "Check updates automatically"}}</label>
<div class="field-value">
<input id="autocheck-updates" type="checkbox" name="autocheckupdates" value="on"{{#if formautocheckupdates}} checked="checked"{{/if}}{{#unless canmodify}} disabled="disabled"{{/unless}}/>
</div>
<label for="autocheck-updates" class="field-description"> &mdash; {{l10n "System will check updates for the core and plugins automatically using cron"}}</label>
<br clear="all"/>
</div>
{{#if canmodify}}
<div class="form-button">
<input type="submit" name="save" class="submit-button-background save-button" value="{{l10n "Save"}}"/>