diff --git a/gfexcel.php b/gfexcel.php index f3b38e09..01270996 100644 --- a/gfexcel.php +++ b/gfexcel.php @@ -35,6 +35,12 @@ define( 'GFEXCEL_MIN_PHP_VERSION', '7.2' ); } +$src_folder = __DIR__ . '/build/vendor_prefixed/gravitykit/gravityexport-lite-src'; +if ( ! is_readable( $src_folder ) ) { + $src_folder = __DIR__ . '/src'; +} +define( 'GFEXCEL_SRC_FOLDER', $src_folder ); + if ( version_compare( phpversion(), GFEXCEL_MIN_PHP_VERSION, '<' ) ) { $show_minimum_php_version_message = function () { $message = wpautop( sprintf( esc_html__( 'GravityExport Lite requires PHP %s or newer.', 'gk-gravityexport-lite' ), GFEXCEL_MIN_PHP_VERSION ) ); @@ -63,7 +69,8 @@ } $autoload_file = __DIR__ . '/build/vendor/autoload.php'; - $is_build = true; + + $is_build = true; if ( ! file_exists( $autoload_file ) ) { $autoload_file = __DIR__ . '/vendor/autoload.php'; $is_build = false; diff --git a/readme.txt b/readme.txt index b3068c1b..6fba2ddb 100644 --- a/readme.txt +++ b/readme.txt @@ -256,6 +256,10 @@ You can hide a row by adding a hook. Checkout this example: == Changelog == += develop = + +* Fixed: A warning would appear when upgrading GravityExport Lite. + = 2.3.6 on December 18, 2024 = * Fixed: Type errors on fields no longer cause exports to fail. Values become empty, and errors are logged. diff --git a/src/Migration/Manager/MigrationManager.php b/src/Migration/Manager/MigrationManager.php index 33ebf3ac..00228a9c 100644 --- a/src/Migration/Manager/MigrationManager.php +++ b/src/Migration/Manager/MigrationManager.php @@ -72,6 +72,8 @@ private function maybe_migrate(): void { $this->migrate(); } catch ( MigrationException $e ) { GravityExportAddon::get_instance()->log_error( sprintf( 'Migration error: %s', $e->getMessage() ) ); + // Clear running status. + $this->repository->setRunning( false ); } } diff --git a/src/Migration/Repository/FileSystemMigrationRepository.php b/src/Migration/Repository/FileSystemMigrationRepository.php index 3262f83a..1b62d59d 100644 --- a/src/Migration/Repository/FileSystemMigrationRepository.php +++ b/src/Migration/Repository/FileSystemMigrationRepository.php @@ -51,6 +51,10 @@ public function shouldMigrate(): bool { * @since 2.0.0 */ public function getMigrations(): array { + if ( ! is_readable( $this->migration_path ) ) { + return []; + } + // Change directory for glob. We do this here, so we can better test `getMigrations()`. chdir( $this->migration_path ); diff --git a/src/ServiceProvider/AddOnProvider.php b/src/ServiceProvider/AddOnProvider.php index 10f3ae6b..4fe1911f 100644 --- a/src/ServiceProvider/AddOnProvider.php +++ b/src/ServiceProvider/AddOnProvider.php @@ -59,7 +59,7 @@ public function register(): void { $container = $this->getContainer(); $container->add( MigrationRepositoryInterface::class, FileSystemMigrationRepository::class ) - ->addArgument( dirname( GFEXCEL_PLUGIN_FILE ) . '/src/Migration/Migration/' ); + ->addArgument( GFEXCEL_SRC_FOLDER . '/Migration/Migration/' ); $container->add( NotificationRepositoryInterface::class, NotificationRepository::class ); $container->add( NotificationManager::class )->addArgument( NotificationRepositoryInterface::class );