V5000.php
1.16 KB
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
<?php
namespace ACP\Plugin\NetworkUpdate;
use AC\Plugin;
use ACP\Entity\License;
use ACP\LicenseKeyRepository;
use ACP\LicenseRepository;
use ACP\Plugin\Update;
/**
* Migrates license settings for the multisite network
*/
class V5000 extends Update\V5000 {
public function apply_update() {
parent::apply_update();
// Run the update script for the first (main) site in order to migrate Layout settings for Sites and Network. We need to perform all necessary updates
$stored_version = AC()->get_stored_version()->get_value();
$updater = AC()->get_updater();
$updater
->add_update( new Plugin\Update\V3005( $stored_version ) )
->add_update( new Plugin\Update\V3007( $stored_version ) )
->add_update( new Plugin\Update\V3201( $stored_version ) )
->add_update( new Plugin\Update\V4000( $stored_version ) )
->parse_updates();
}
// For network
protected function save_license( License $license ) {
( new LicenseRepository( true ) )->save( $license );
( new LicenseKeyRepository( true ) )->save( $license->get_key() );
}
protected function get_license_option( $option = '' ) {
return get_site_option( self::LICENSE_OPTION_KEY . $option );
}
}