summaryrefslogtreecommitdiffstats
path: root/settings/Controller
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-04 16:20:01 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-06-06 16:55:01 +0200
commit393d9aae74862e14e80223e44880f4f706c88d6f (patch)
tree37e2db4534c2c5f3f29672228e88543d1895c74f /settings/Controller
parentf13c2b20b6fa2048b30687aa3a85e706b70f2500 (diff)
downloadnextcloud-server-393d9aae74862e14e80223e44880f4f706c88d6f.tar.gz
nextcloud-server-393d9aae74862e14e80223e44880f4f706c88d6f.zip
Add a hint that some indexes are not added yet
* gives the admin a chance to discover the missing indexes and improve the performance of the instance without digging through the manual * nicely integrated in the setup checks where this kind of hints belong to * also adds an option to integrate this from an app based on events * fix style of setting warnings Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'settings/Controller')
-rw-r--r--settings/Controller/CheckSetupController.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php
index 4debc52fc51..e1073be4697 100644
--- a/settings/Controller/CheckSetupController.php
+++ b/settings/Controller/CheckSetupController.php
@@ -33,6 +33,7 @@ namespace OC\Settings\Controller;
use bantu\IniGetWrapper\IniGetWrapper;
use GuzzleHttp\Exception\ClientException;
use OC\AppFramework\Http;
+use OC\DB\MissingIndexInformation;
use OC\IntegrityCheck\Checker;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataDisplayResponse;
@@ -40,10 +41,13 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
+use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\IURLGenerator;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\GenericEvent;
/**
* @package OC\Settings\Controller
@@ -63,18 +67,9 @@ class CheckSetupController extends Controller {
private $checker;
/** @var ILogger */
private $logger;
+ /** @var EventDispatcherInterface */
+ private $dispatcher;
- /**
- * @param string $AppName
- * @param IRequest $request
- * @param IConfig $config
- * @param IClientService $clientService
- * @param IURLGenerator $urlGenerator
- * @param \OC_Util $util
- * @param IL10N $l10n
- * @param Checker $checker
- * @param ILogger $logger
- */
public function __construct($AppName,
IRequest $request,
IConfig $config,
@@ -83,7 +78,8 @@ class CheckSetupController extends Controller {
\OC_Util $util,
IL10N $l10n,
Checker $checker,
- ILogger $logger) {
+ ILogger $logger,
+ EventDispatcherInterface $dispatcher) {
parent::__construct($AppName, $request);
$this->config = $config;
$this->clientService = $clientService;
@@ -92,6 +88,7 @@ class CheckSetupController extends Controller {
$this->l10n = $l10n;
$this->checker = $checker;
$this->logger = $logger;
+ $this->dispatcher = $dispatcher;
}
/**
@@ -419,6 +416,19 @@ Raw output
}
/**
+ * Check if the required FreeType functions are present
+ * @return bool
+ */
+ protected function hasMissingIndexes() {
+ $indexInfo = new MissingIndexInformation();
+ // Dispatch event so apps can also hint for pending index updates if needed
+ $event = new GenericEvent($indexInfo);
+ $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event);
+
+ return $indexInfo->getListOfMissingIndexes();
+ }
+
+ /**
* @return DataResponse
*/
public function check() {
@@ -440,6 +450,7 @@ Raw output
'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'),
'isSettimelimitAvailable' => $this->isSettimelimitAvailable(),
'hasFreeTypeSupport' => $this->hasFreeTypeSupport(),
+ 'hasMissingIndexes' => $this->hasMissingIndexes(),
]
);
}