@@ -504,10 +504,11 @@ private static function batchInsertInit(){
504504 return ;
505505 self ::$ batchInsertInit = true ;
506506 self ::$ batchInsertCommand = static ::getDb ()->createCommand ();
507- register_shutdown_function (function (){
508- if (self ::hasBatchInsert ())
509- yii::warning (static ::className ().' : batch insert mode not completed! ' );
510- });
507+ if (self ::$ batchInsertCommand ->db ->enableLogging )
508+ register_shutdown_function (function (){
509+ if (self ::hasBatchInsert ())
510+ yii::warning (static ::className ().' : batch insert mode not completed! ' );
511+ });
511512 }
512513
513514 /**
@@ -570,10 +571,11 @@ private static function batchUpdateInit(){
570571 return ;
571572 self ::$ batchUpdateInit = true ;
572573 self ::$ batchUpdateCommand = static ::getDb ()->createCommand ();
573- register_shutdown_function (function (){
574- if (self ::hasBatchUpdate ())
575- yii::warning (static ::className ().' : batch update mode not completed! ' );
576- });
574+ if (self ::$ batchUpdateCommand ->db ->enableLogging )
575+ register_shutdown_function (function (){
576+ if (self ::hasBatchUpdate ())
577+ yii::warning (static ::className ().' : batch update mode not completed! ' );
578+ });
577579 }
578580
579581 /**
@@ -648,10 +650,11 @@ private static function batchDeleteInit(){
648650 return ;
649651 self ::$ batchDeleteInit = true ;
650652 self ::$ batchDeleteCommand = static ::getDb ()->createCommand ();
651- register_shutdown_function (function (){
652- if (self ::hasBatchDelete ())
653- yii::warning (static ::className ().' : batch delete mode not completed! ' );
654- });
653+ if (self ::$ batchDeleteCommand ->db ->enableLogging )
654+ register_shutdown_function (function (){
655+ if (self ::hasBatchDelete ())
656+ yii::warning (static ::className ().' : batch delete mode not completed! ' );
657+ });
655658 }
656659
657660 /**
0 commit comments