I was working on unit tests and noticed that the custom tables for our Mollie integration were not installed.
|
// Admin. |
|
if ( is_admin() ) { |
|
$this->admin = new Admin\AdminModule( $this ); |
|
} |
|
$this->install = new Install( $plugin, $this ); |
|
// Actions. |
|
add_action( 'init', [ $this, 'init' ], 5 ); |
|
/** |
|
* Initialize. |
|
* |
|
* @return void |
|
*/ |
|
public function init() { |
|
if ( \get_option( 'pronamic_pay_version', null ) !== $this->plugin->get_version() ) { |
|
$this->install(); |
|
} |
|
|
|
// Integrations. |
|
$integrations = $this->get_upgradeable_integrations(); |
|
|
|
foreach ( $integrations as $integration ) { |
|
$version_option_name = $integration->get_version_option_name(); |
|
|
|
if ( null === $version_option_name ) { |
|
continue; |
|
} |
|
|
|
$version_option = \strval( $integration->get_version_option() ); |
|
|
|
$upgrades = $integration->get_upgrades(); |
|
|
|
foreach ( $upgrades as $upgrade ) { |
|
$version = $upgrade->get_version(); |
|
|
|
if ( ! version_compare( $version_option, $version, '<' ) ) { |
|
continue; |
|
} |
|
|
|
$upgrade->execute(); |
|
|
|
update_option( $version_option_name, $version ); |
|
} |
|
} |
|
} |