芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/public_html/wp-content/plugins/google-listings-and-ads/src/Installer.php
wp = $wp; } /** * Register a service. */ public function register(): void { add_action( 'admin_init', function () { $this->admin_init(); } ); } /** * Admin init. */ protected function admin_init(): void { if ( defined( 'IFRAME_REQUEST' ) || $this->wp->wp_doing_ajax() ) { return; } $this->check_if_plugin_files_updated(); $db_version = $this->get_db_version(); if ( $db_version !== $this->get_version() || apply_filters( 'woocommerce_gla_force_run_install', false ) ) { $this->install(); if ( '' === $db_version ) { $this->first_install(); } $this->options->update( OptionsInterface::DB_VERSION, $this->get_version() ); } } /** * Install GLA. * * Run on every plugin update. */ protected function install(): void { $old_version = $this->get_db_version(); $new_version = $this->get_version(); /** @var InstallableInterface[] */ $installables = $this->container->get( InstallableInterface::class ); foreach ( $installables as $installable ) { $installable->install( $old_version, $new_version ); } } /** * Checks and records if plugin files have been updated. */ protected function check_if_plugin_files_updated(): void { if ( $this->get_file_version() !== $this->get_version() ) { $this->options->update( OptionsInterface::FILE_VERSION, $this->get_version() ); } } /** * Runs on the first install of GLA. */ protected function first_install(): void { /** @var FirstInstallInterface[] $first_installers */ $first_installers = $this->container->get( FirstInstallInterface::class ); foreach ( $first_installers as $installer ) { $installer->first_install(); } } /** * Get the db version * * @return string */ protected function get_db_version(): string { return $this->options->get( OptionsInterface::DB_VERSION, '' ); } /** * Get the stored file version * * @return string */ protected function get_file_version(): string { return $this->options->get( OptionsInterface::FILE_VERSION, '' ); } }