88 */
99namespace OC \Core \Command \Db ;
1010
11+ use Doctrine \DBAL \Platforms \MySQLPlatform ;
12+ use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
1113use OC \DB \Connection ;
1214use Symfony \Component \Console \Command \Command ;
1315use Symfony \Component \Console \Helper \Table ;
1416use Symfony \Component \Console \Input \InputInterface ;
1517use Symfony \Component \Console \Input \InputOption ;
1618use Symfony \Component \Console \Output \OutputInterface ;
17- use Doctrine \DBAL \Platforms \MySQLPlatform ;
18- use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
1919
2020class DbLocks extends Command {
2121
@@ -39,19 +39,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3939 $ asJson = $ input ->getOption ('json ' );
4040
4141 if ($ platform instanceof MySQLPlatform) {
42- $ sql = " SELECT r.trx_id AS waiting_trx_id,
42+ $ sql = ' SELECT r.trx_id AS waiting_trx_id,
4343 r.trx_mysql_thread_id AS waiting_thread,
4444 r.trx_query AS waiting_query,
4545 b.trx_id AS blocking_trx_id,
4646 b.trx_mysql_thread_id AS blocking_thread,
4747 b.trx_query AS blocking_query
4848 FROM information_schema.innodb_lock_waits w
4949 JOIN information_schema.innodb_trx b ON b.trx_id = w.blocking_trx_id
50- JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_trx_id " ;
50+ JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_trx_id ' ;
5151 $ headers = ['Waiting TRX ' , 'Waiting Thread ' , 'Waiting Query ' , 'Blocking TRX ' , 'Blocking Thread ' , 'Blocking Query ' ];
5252 $ cols = ['waiting_trx_id ' , 'waiting_thread ' , 'waiting_query ' , 'blocking_trx_id ' , 'blocking_thread ' , 'blocking_query ' ];
5353 } elseif ($ platform instanceof PostgreSQLPlatform) {
54- $ sql = " SELECT blocked_locks.pid AS blocked_pid,
54+ $ sql = ' SELECT blocked_locks.pid AS blocked_pid,
5555 blocked_activity.usename AS blocked_user,
5656 blocking_locks.pid AS blocking_pid,
5757 blocking_activity.usename AS blocking_user,
@@ -65,9 +65,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6565 AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation
6666 AND blocking_locks.pid != blocked_locks.pid
6767 JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid = blocking_locks.pid
68- WHERE NOT blocked_locks.granted " ;
68+ WHERE NOT blocked_locks.granted ' ;
6969 $ headers = ['Blocked PID ' , 'Blocked User ' , 'Blocking PID ' , 'Blocking User ' , 'Blocked Query ' , 'Duration ' ];
70- $ cols = ['blocked_pid ' , 'blocked_user ' , 'blocking_pid ' , 'blocking_user ' , 'blocked_query ' , 'blocked_duration ' ];
70+ $ cols = ['blocked_pid ' , 'blocked_user ' , 'blocking_pid ' , 'blocking_user ' , 'blocked_query ' , 'blocked_duration ' ];
7171 } else {
7272 $ output ->writeln ('<comment>db:locks is not supported for SQLite and Oracle (SQLite uses file-level locking).</comment> ' );
7373 return Command::SUCCESS ;
@@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9292 $ table ->setHeaders ($ headers );
9393
9494 foreach ($ rows as $ row ) {
95- $ table ->addRow (array_map (fn ($ col ) => $ row [$ col ] ?? '— ' , $ cols ));
95+ $ table ->addRow (array_map (fn ($ col ) => $ row [$ col ] ?? '— ' , $ cols ));
9696 }
9797
9898 $ table ->render ();
0 commit comments