Skip to content

Commit

Permalink
Provide a way to disable automatical updates checking
Browse files Browse the repository at this point in the history
  • Loading branch information
JustBlackBird committed May 26, 2015
1 parent 2fc85b1 commit 4e7f9ea
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ protected function getOptionsList()
'showonlineoperators',
'enablecaptcha',
'trackoperators',
'autocheckupdates',
);
}
}
18 changes: 10 additions & 8 deletions src/mibew/libs/classes/Mibew/Maintenance/CronWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ public function run()
$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()
);

return false;
if (Settings::get('autocheckupdates') == '1') {
// Run the update checker
if (!$this->updateChecker->run()) {
$this->errors = array_merge(
$this->errors,
$this->updateChecker->getErrors()
);

return false;
}
}
} catch (\Exception $e) {
$this->log[] = $e->getMessage();
Expand Down
1 change: 1 addition & 0 deletions src/mibew/libs/classes/Mibew/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected function __construct()
'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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}"/>
Expand Down

0 comments on commit 4e7f9ea

Please sign in to comment.