66use Azuriom \Models \User ;
77use Azuriom \Games \ServerBridge ;
88use Illuminate \Support \Facades \DB ;
9- use Illuminate \Support \Facades \Schema ;
109use Azuriom \Plugin \Shop \Models \User as ShopUser ;
1110
1211/**
@@ -25,7 +24,7 @@ public function getServerData()
2524 {
2625 if (@fsockopen ($ this ->server ->address , $ this ->server ->port , $ errorno , $ errorstr , 0.1 )) {
2726 $ connected = 0 ;
28- if (Schema:: connection ( ' sqlsrv ' )-> hasTable ( ' CHARACTER_01_DBF.dbo.tblMultiServerInfo ' )) {
27+ if ($ this -> hasTblMultiServerInfoView ( )) {
2928 $ connected = DB ::connection ('sqlsrv ' )->table ('CHARACTER_01_DBF.dbo.tblMultiServerInfo ' )->where ('MultiServer ' , '1 ' )->count ();
3029 } else {
3130 $ connected = DB ::connection ('sqlsrv ' )->table ('CHARACTER_01_DBF.dbo.CHARACTER_TBL ' )->where ('MultiServer ' , '1 ' )->count ();
@@ -113,7 +112,7 @@ private function getPlayerFallback($user, &$idPlayer, &$idServer)
113112
114113 private function playerIsConnected ($ idPlayer , $ idServer )
115114 {
116- if (Schema:: connection ( ' sqlsrv ' )-> hasTable ( ' CHARACTER_01_DBF.dbo.tblMultiServerInfo ' )) {
115+ if ($ this -> hasTblMultiServerInfoView ( )) {
117116 return DB ::connection ('sqlsrv ' )->table ('CHARACTER_01_DBF.dbo.tblMultiServerInfo ' )
118117 ->where ([
119118 ['m_idPlayer ' , $ idPlayer ],
@@ -163,4 +162,11 @@ private function sendItemsWithSocket($idPlayer, $idServer, $commands)
163162 fclose ($ fp );
164163 }
165164 }
165+
166+ private function hasTblMultiServerInfoView ()
167+ {
168+ return DB ::connection ('sqlsrv ' )->table ('CHARACTER_01_DBF.INFORMATION_SCHEMA.TABLES ' )
169+ ->where ('TABLE_NAME ' , 'tblMultiServerInfo ' )
170+ ->exists ();
171+ }
166172}
0 commit comments