1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-20 07:21:30 +02:00

[ticket/12683] Add progress bar to create_index

PHPBB3-12683
This commit is contained in:
rubencm
2021-03-24 18:50:29 +01:00
committed by Ruben Calvo
parent ce54ee5e6f
commit 0a24704b4f
15 changed files with 151 additions and 111 deletions

View File

@@ -16,6 +16,8 @@ namespace phpbb\search;
use phpbb\config\config;
use phpbb\di\service_collection;
use phpbb\search\backend\search_backend_interface;
use phpbb\search\exception\no_search_backend_found_exception;
use RuntimeException;
class search_backend_factory
{
@@ -46,16 +48,36 @@ class search_backend_factory
*
* @param string $class
*
* @throws no_search_backend_found_exception
*
* @return search_backend_interface
*/
public function get(string $class): search_backend_interface
{
return $this->search_backends->get_by_class($class);
try
{
$search = $this->search_backends->get_by_class($class);
}
catch (RuntimeException $e)
{
if (strpos($e->getMessage(), 'No service found') === 0)
{
throw new no_search_backend_found_exception();
}
else
{
throw $e;
}
}
return $search;
}
/**
* Obtains active search backend
*
* @throws no_search_backend_found_exception
*
* @return search_backend_interface
*/
public function get_active(): search_backend_interface