Network.php
944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace AC\Plugin\Updater;
use AC\Plugin\Updater;
use AC\Plugin\Version;
use AC\Plugin\VersionStorage;
class Network extends Updater {
/**
* @var Version
*/
private $version;
/**
* @var VersionStorage
*/
private $storage;
public function __construct( $version_key, Version $version ) {
$this->version = $version;
$this->storage = new VersionStorage( $version_key, true );
}
/**
* Current and before version 5 check
* @return bool
*/
public function is_new_install() {
if ( $this->storage->get()->is_valid() ) {
return false;
}
return empty( get_site_option( 'cpupdate_cac-pro' ) );
}
/**
* @param Version|null $version
*
* @return bool
*/
protected function update_stored_version( Version $version = null ) {
return $this->storage->save( $version ?: $this->version );
}
/**
* @return Version
*/
public function get_stored_version() {
return $this->storage->get();
}
}