|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
4
|
|
|
* @copyright Copyright (c) 2016 Joas Schilling <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* @author Bernhard Posselt <[email protected]> |
|
7
|
|
|
* @author Christoph Wurst <[email protected]> |
|
8
|
|
|
* @author Joas Schilling <[email protected]> |
|
9
|
|
|
* @author Lukas Reschke <[email protected]> |
|
10
|
|
|
* @author Morris Jobke <[email protected]> |
|
11
|
|
|
* @author Victor Dubiniuk <[email protected]> |
|
12
|
|
|
* |
|
13
|
|
|
* @license AGPL-3.0 |
|
14
|
|
|
* |
|
15
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
16
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
17
|
|
|
* as published by the Free Software Foundation. |
|
18
|
|
|
* |
|
19
|
|
|
* This program is distributed in the hope that it will be useful, |
|
20
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22
|
|
|
* GNU Affero General Public License for more details. |
|
23
|
|
|
* |
|
24
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
25
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
26
|
|
|
* |
|
27
|
|
|
*/ |
|
28
|
|
|
|
|
29
|
|
|
namespace OC\Core; |
|
30
|
|
|
|
|
31
|
|
|
use OC\DB\MissingIndexInformation; |
|
32
|
|
|
use OC\DB\SchemaWrapper; |
|
33
|
|
|
use OCP\AppFramework\App; |
|
34
|
|
|
use OCP\IDBConnection; |
|
35
|
|
|
use OCP\Util; |
|
36
|
|
|
use Symfony\Component\EventDispatcher\GenericEvent; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Class Application |
|
40
|
|
|
* |
|
41
|
|
|
* @package OC\Core |
|
42
|
|
|
*/ |
|
43
|
|
|
class Application extends App { |
|
44
|
|
|
|
|
45
|
|
|
public function __construct() { |
|
46
|
|
|
parent::__construct('core'); |
|
47
|
|
|
|
|
48
|
|
|
$container = $this->getContainer(); |
|
49
|
|
|
|
|
50
|
|
|
$container->registerService('defaultMailAddress', function () { |
|
51
|
|
|
return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
52
|
|
|
}); |
|
53
|
|
|
|
|
54
|
|
|
$server = $container->getServer(); |
|
55
|
|
|
$eventDispatcher = $server->getEventDispatcher(); |
|
56
|
|
|
|
|
57
|
|
|
$eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
58
|
|
|
function(GenericEvent $event) use ($container) { |
|
59
|
|
|
/** @var MissingIndexInformation $subject */ |
|
60
|
|
|
$subject = $event->getSubject(); |
|
61
|
|
|
|
|
62
|
|
|
$schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
63
|
|
|
|
|
64
|
|
|
if ($schema->hasTable('share')) { |
|
65
|
|
|
$table = $schema->getTable('share'); |
|
66
|
|
|
|
|
67
|
|
|
if (!$table->hasIndex('share_with_index')) { |
|
68
|
|
|
$subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
69
|
|
|
} |
|
70
|
|
|
if (!$table->hasIndex('parent_index')) { |
|
71
|
|
|
$subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
if ($schema->hasTable('filecache')) { |
|
76
|
|
|
$table = $schema->getTable('filecache'); |
|
77
|
|
|
|
|
78
|
|
|
if (!$table->hasIndex('fs_mtime')) { |
|
79
|
|
|
$subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|