); } } /** * Determine if migration is allowed. * * @since 1.7.5 */ private function is_allowed(): bool { // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( isset( $_GET['service-worker'] ) ) { return false; } return wp_doing_cron() || is_admin() || wpforms_doing_wp_cli(); } /** * Maybe create custom plugin tables. * * @since 1.7.6 */ public function maybe_create_tables() { if ( $this->tables_check_done ) { /** * We should do tables check only once - when the first migration has been started. * The DB::get_existing_custom_tables() without caching causes performance issue * on huge multisite with thousands of tables. */ return; } // We need actual information about existing tables, so drop the cache. Transient::delete( DB::EXISTING_TABLES_TRANSIENT_NAME ); $custom_tables = DB::get_existing_custom_tables(); foreach ( static::CUSTOM_TABLE_HANDLER_CLASSES as $custom_table_handler_class ) { if ( ! class_exists( $custom_table_handler_class ) ) { continue; } $custom_table_handler = new $custom_table_handler_class(); if ( ! in_array( $custom_table_handler->table_name, $custom_tables, true ) ) { $custom_table_handler->create_table(); } } $this->tables_check_done = true; } /** * Maybe convert the migration option format. * * @since 1.7.5 */ private function maybe_convert_migration_option() { /** * Retrieve the migration option and check its format. * Old format: a string 'x.y.z' containing the last migrated version. * New format: [ 'x.y.z' => {status}, 'x1.y1.z1' => {status}... ], * where {status} is a migration status. * Negative means some status (-1 for 'started' etc.), * zero means completed earlier at unknown time, * positive means completion timestamp. */ $this->migrated = get_option( static::MIGRATED_OPTION_NAME ); // If the option is an array, it means that it is already converted to the new format. if ( is_array( $this->migrated ) ) { return; } /** * Convert the option to the new format. * * Old option names contained 'version', * like 'wpforms_version', 'wpforms_version_lite', 'wpforms_stripe_version' etc. * We preserve old options for downgrade cases. * New option names should contain 'versions' and be like 'wpforms_versions' etc. */ $this->migrated = get_option( str_replace( 'versions', 'version', static::MIGRATED_OPTION_NAME ) ); $version = $this->migrated === false ? self::INITIAL_FAKE_VERSION : (string) $this->migrated; $timestamp = $version === static::CURRENT_VERSION ? time() : 0; $this->migrated = [ $version => $timestamp ]; $max_version = $this->get_max_version( $this->migrated ); foreach ( $this->get_upgrade_classes() as $upgrade_class ) { $upgrade_version = $this->get_upgrade_version( $upgrade_class ); if ( ! isset( $this->migrated[ $upgrade_version ] ) && version_compare( $upgrade_version, $max_version, '<' ) ) { $this->migrated[ $upgrade_version ] = 0; } } unset( $this->migrated[ self::INITIAL_FAKE_VERSION ] ); ksort( $this->migrated ); update_option( static::MIGRATED_OPTION_NAME, $this->migrated ); } /** * Get the max version. * * @since 1.7.5 * * @param array $versions Versions. * * @return string */ private function get_max_version( array $versions ): string { // phpcs:ignore WPForms.Formatting.EmptyLineBeforeReturn.RemoveEmptyLineBeforeReturnStatement return array_reduce( array_keys( $versions ), static function ( $carry, $version ) { return version_compare( $version, $carry, '>' ) ? $version : $carry; }, self::INITIAL_FAKE_VERSION ); } /** * Determine if it is the core plugin (Lite or Pro). * * @since 1.7.5 * * @return bool True if it is the core plugin. */ protected function is_core_plugin(): bool { // phpcs:ignore WPForms.Formatting.EmptyLineBeforeReturn.RemoveEmptyLineBeforeReturnStatement return strpos( static::MIGRATED_OPTION_NAME, 'wpforms_versions' ) === 0; } /** * Log migration message. * * @since 1.8.2.3 * * @param bool $migrated Migration status. * @param string $plugin_name Plugin name. * @param string $upgrade_version Upgrade version. * * @return void */ private function log_migration_message( bool $migrated, string $plugin_name, string $upgrade_version ) { $message = $migrated ? sprintf( 'Migration of %1$s to %2$s completed.', $plugin_name, $upgrade_version ) : sprintf( 'Migration of %1$s to %2$s failed.', $plugin_name, $upgrade_version ); $this->log( $message ); } }
Fatal error: Uncaught Error: Class 'WPForms\Migrations\Base' not found in /home/candoodesigncom/public_html/wp-content/plugins/wpforms-lite/src/Migrations/Migrations.php:14 Stack trace: #0 /home/candoodesigncom/public_html/wp-content/plugins/seo-by-rank-math-pro/vendor/composer/ClassLoader.php(571): include() #1 /home/candoodesigncom/public_html/wp-content/plugins/seo-by-rank-math-pro/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/home/candoodes...') #2 [internal function]: Composer\Autoload\ClassLoader->loadClass('WPForms\\Migrati...') #3 [internal function]: spl_autoload_call('WPForms\\Migrati...') #4 /home/candoodesigncom/public_html/wp-content/plugins/wpforms-lite/src/WPForms.php(307): class_exists('\\WPForms\\Migrat...') #5 /home/candoodesigncom/public_html/wp-content/plugins/wpforms-lite/src/WPForms.php(365): WPForms\WPForms->register(Array) #6 /home/candoodesigncom/public_html/wp-content/plugins/wpforms-lite/src/Loader.php(30): WPForms\WPForms->register_bulk(Array) #7 /home/candoodesigncom/pu in /home/candoodesigncom/public_html/wp-content/plugins/wpforms-lite/src/Migrations/Migrations.php on line 14