Skip to content

Commit 29fbbae

Browse files
Make the automatic-login-check optional, per a config setting in ProcessWireUpgradeCheck module. Note that the default is now OFF, so must be enabled if you want that feature.
1 parent 5493c1e commit 29fbbae

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

ProcessWireUpgrade.module

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ProcessWireUpgrade extends Process {
2121
return array(
2222
'title' => 'Upgrades',
2323
'summary' => 'Tool that helps you identify and install core and module upgrades.',
24-
'version' => 2,
24+
'version' => 3,
2525
'author' => 'Ryan Cramer',
2626
'installs' => 'ProcessWireUpgradeCheck',
2727
'icon' => 'coffee'

ProcessWireUpgradeCheck.config.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
class ProcessWireUpgradeCheckConfig extends ModuleConfig {
4+
public function __construct() {
5+
$this->add(array(
6+
array(
7+
'name' => 'useLoginHook',
8+
'type' => 'radios',
9+
'label' => $this->_('Check for upgrades on superuser login?'),
10+
'description' => $this->_('If "No" is selected, then upgrades will only be checked manually when you click to Setup > Upgrades.'),
11+
'notes' => $this->_('Automatic upgrade check requires ProcessWire 2.5.20 or newer.'),
12+
'options' => array(
13+
1 => $this->_('Yes'),
14+
0 => $this->_('No')
15+
),
16+
'optionColumns' => 1,
17+
'value' => 0
18+
)
19+
));
20+
}
21+
}

ProcessWireUpgradeCheck.module

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ProcessWireUpgradeCheck extends WireData implements Module {
2323
return array(
2424
'title' => 'Upgrades Checker',
2525
'summary' => 'Automatically checks for core and installed module upgrades at routine intervals.',
26-
'version' => 3,
26+
'version' => 4,
2727
'autoload' => "template=admin",
2828
'singular' => true,
2929
'author' => 'Ryan Cramer',
@@ -35,12 +35,18 @@ class ProcessWireUpgradeCheck extends WireData implements Module {
3535
const versionURL = 'https://raw.githubusercontent.com/ryancramerdesign/ProcessWire/{branch}/wire/core/ProcessWire.php';
3636
const zipURL = 'https://github.com/ryancramerdesign/ProcessWire/archive/{branch}.zip';
3737

38+
public function __construct() {
39+
$this->set('useLoginHook', 1);
40+
}
41+
3842
/**
3943
* Initialize and perform access checks
4044
*
4145
*/
4246
public function init() {
43-
$this->session->addHookAfter('login', $this, 'loginHook');
47+
if($this->useLoginHook) {
48+
$this->session->addHookAfter('login', $this, 'loginHook');
49+
}
4450
}
4551

4652
/**
@@ -337,7 +343,5 @@ class ProcessWireUpgradeCheck extends WireData implements Module {
337343
if(count($newerBranches > 1)) ksort($newerBranches);
338344
return $newerBranches;
339345
}
340-
341-
342346
}
343347

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ reason, you can manually restore from the backups should you
2727
need to.
2828

2929
If your ProcessWire version is new enough to have the
30-
WireDatabaseBackup class (PW 2.4.14+) then this module will
30+
WireDatabaseBackup class (PW 2.5.14+) then this module will
3131
also give you the option of backing up your database.
3232

3333

@@ -48,6 +48,7 @@ environments before using in production environments.
4848
## Requirements
4949

5050
- ProcessWire 2.3.4 or newer (for core upgrade capability)
51-
- ProcessWIre 2.5.0 or newer (for auto-upgrade notifications)
51+
- ProcessWire 2.5.0 or newer (for module upgrade capability)
52+
- ProcessWire 2.5.20 or newer (for automatic upgrade checks)
5253

5354

0 commit comments

Comments
 (0)