| @@ 329-346 (lines=18) @@ | ||
| 326 | /** |
|
| 327 | * @return \OCP\IDBConnection |
|
| 328 | */ |
|
| 329 | protected function reconnectToDatabase(OutputInterface $output) { |
|
| 330 | /** @var Connection | IDBConnection $connection*/ |
|
| 331 | $connection = \OC::$server->getDatabaseConnection(); |
|
| 332 | try { |
|
| 333 | $connection->close(); |
|
| 334 | } catch (\Exception $ex) { |
|
| 335 | $output->writeln("<info>Error while disconnecting from database: {$ex->getMessage()}</info>"); |
|
| 336 | } |
|
| 337 | while (!$connection->isConnected()) { |
|
| 338 | try { |
|
| 339 | $connection->connect(); |
|
| 340 | } catch (\Exception $ex) { |
|
| 341 | $output->writeln("<info>Error while re-connecting to database: {$ex->getMessage()}</info>"); |
|
| 342 | sleep(60); |
|
| 343 | } |
|
| 344 | } |
|
| 345 | return $connection; |
|
| 346 | } |
|
| 347 | ||
| 348 | } |
|
| 349 | ||
| @@ 252-269 (lines=18) @@ | ||
| 249 | /** |
|
| 250 | * @return \OCP\IDBConnection |
|
| 251 | */ |
|
| 252 | protected function reconnectToDatabase(OutputInterface $output) { |
|
| 253 | /** @var Connection | IDBConnection $connection*/ |
|
| 254 | $connection = \OC::$server->getDatabaseConnection(); |
|
| 255 | try { |
|
| 256 | $connection->close(); |
|
| 257 | } catch (\Exception $ex) { |
|
| 258 | $output->writeln("<info>Error while disconnecting from database: {$ex->getMessage()}</info>"); |
|
| 259 | } |
|
| 260 | while (!$connection->isConnected()) { |
|
| 261 | try { |
|
| 262 | $connection->connect(); |
|
| 263 | } catch (\Exception $ex) { |
|
| 264 | $output->writeln("<info>Error while re-connecting to database: {$ex->getMessage()}</info>"); |
|
| 265 | sleep(60); |
|
| 266 | } |
|
| 267 | } |
|
| 268 | return $connection; |
|
| 269 | } |
|
| 270 | ||
| 271 | /** |
|
| 272 | * @return \OCP\Files\Folder |
|