summaryrefslogtreecommitdiffstats
path: root/core/Application.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Application.php')
-rw-r--r--core/Application.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php
index 9a29b4bcdff..400d86f5991 100644
--- a/core/Application.php
+++ b/core/Application.php
@@ -28,8 +28,12 @@
namespace OC\Core;
+use OC\DB\MissingIndexInformation;
+use OC\DB\SchemaWrapper;
use OCP\AppFramework\App;
+use OCP\IDBConnection;
use OCP\Util;
+use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class Application
@@ -46,5 +50,28 @@ class Application extends App {
$container->registerService('defaultMailAddress', function () {
return Util::getDefaultEmailAddress('lostpassword-noreply');
});
+
+ $server = $container->getServer();
+ $eventDispatcher = $server->getEventDispatcher();
+
+ $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT,
+ function(GenericEvent $event) use ($container) {
+ /** @var MissingIndexInformation $subject */
+ $subject = $event->getSubject();
+
+ $schema = new SchemaWrapper($container->query(IDBConnection::class));
+
+ if ($schema->hasTable('share')) {
+ $table = $schema->getTable('share');
+
+ if (!$table->hasIndex('share_with_index')) {
+ $subject->addHintForMissingSubject($table->getName(), 'share_with_index');
+ }
+ if (!$table->hasIndex('parent_index')) {
+ $subject->addHintForMissingSubject($table->getName(), 'parent_index');
+ }
+ }
+ }
+ );
}
}