add_cap( $cap ); } } Database::install(); Maintenance::schedule(); Jobs::schedule_next(); update_option( self::VERSION_OPTION, VERSION, false ); } /** * Runs on plugin deactivation. Data and capabilities are kept so that * reactivating restores everything; uninstall.php removes them. */ public static function deactivate(): void { Maintenance::unschedule(); } /** * Re-applies setup after a plugin update (activation hooks do not run on update), * or when the database schema is behind the code, then continues converting * forms to schemas and encrypting files stored unencrypted by earlier builds until all are done. */ public static function maybe_upgrade(): void { if ( get_option( self::VERSION_OPTION ) !== VERSION || get_option( Database::VERSION_OPTION ) !== Database::SCHEMA_VERSION ) { self::activate(); } Schema_Migration::maybe_run(); Uploads::encrypt_existing(); } }