File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -868,11 +868,25 @@ private function auto_check_update() {
868868 */
869869 private function maybe_trigger_migration () {
870870
871+ $ cache = EE ::get_cache ();
872+
873+ /**
874+ * Below condition ensures that running EE::launch() or runcommand()
875+ * in migration file does not trigget migration again.
876+ */
877+ if ( $ cache ->read ( 'migration_running ' ) ) {
878+ EE ::debug ( 'Not triggering migrations since they seems to already been running. ' );
879+ return ;
880+ }
881+
882+ $ cache ->write ( 'migration_running ' , true );
883+
871884 $ db_version = Option::get ( 'version ' );
872885 $ current_version = EE_VERSION ;
873886
874887 if ( ! $ db_version ) {
875888 $ this ->trigger_migration ( $ current_version );
889+ $ cache ->remove ( 'migration_running ' );
876890
877891 return ;
878892 }
@@ -899,6 +913,8 @@ private function maybe_trigger_migration() {
899913 } elseif ( false !== strpos ( $ current_version , 'nightly ' ) ) {
900914 $ this ->trigger_migration ( $ current_version );
901915 }
916+
917+ $ cache ->remove ( 'migration_running ' );
902918 }
903919
904920 private function trigger_migration ( $ version ) {
You can’t perform that action at this time.
0 commit comments