AutoUpgrade.php
1 month ago
IncludeAutoUpgrade.php
3 years ago
InstallerPlugins.php
1 month ago
class-otgs-installer-upgrade-response.php
1 month ago
IncludeAutoUpgrade.php
20 lines
| 1 | <?php |
| 2 | |
| 3 | namespace OTGS\Installer\Upgrade; |
| 4 | |
| 5 | class IncludeAutoUpgrade { |
| 6 | private $shouldEnableUpdates; |
| 7 | |
| 8 | public function __construct( array $settings, $repositoryId ) { |
| 9 | $this->shouldEnableUpdates = isset( $settings['repositories'][ $repositoryId ]['auto_update'] ) && $settings['repositories'][ $repositoryId ]['auto_update']; |
| 10 | } |
| 11 | |
| 12 | public function includeDuringInstall( $pluginId ) { |
| 13 | if ( $this->shouldEnableUpdates ) { |
| 14 | $auto_updates = (array) get_site_option( 'auto_update_plugins', [] ); |
| 15 | $auto_updates[] = $pluginId; |
| 16 | $auto_updates = array_unique( $auto_updates ); |
| 17 | update_site_option( 'auto_update_plugins', $auto_updates ); |
| 18 | } |
| 19 | } |
| 20 | } |