Passed
Push — master ( 23253d...e10516 )
by Morris
10:19 queued 11s
created
core/ajax/update.php 2 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 use Symfony\Component\EventDispatcher\GenericEvent;
36 36
 
37 37
 if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
38
-	@set_time_limit(0);
38
+    @set_time_limit(0);
39 39
 }
40 40
 
41 41
 require_once '../../lib/base.php';
@@ -49,189 +49,189 @@  discard block
 block discarded – undo
49 49
 $eventSource->send('success', (string)$l->t('Preparing update'));
50 50
 
51 51
 class FeedBackHandler {
52
-	/** @var integer */
53
-	private $progressStateMax = 100;
54
-	/** @var integer */
55
-	private $progressStateStep = 0;
56
-	/** @var string */
57
-	private $currentStep;
58
-	/** @var \OCP\IEventSource */
59
-	private $eventSource;
60
-	/** @var \OCP\IL10N */
61
-	private $l10n;
62
-
63
-	public function __construct(\OCP\IEventSource $eventSource, \OCP\IL10N $l10n) {
64
-		$this->eventSource = $eventSource;
65
-		$this->l10n = $l10n;
66
-	}
67
-
68
-	public function handleRepairFeedback($event) {
69
-		if (!$event instanceof GenericEvent) {
70
-			return;
71
-		}
72
-
73
-		switch ($event->getSubject()) {
74
-			case '\OC\Repair::startProgress':
75
-				$this->progressStateMax = $event->getArgument(0);
76
-				$this->progressStateStep = 0;
77
-				$this->currentStep = $event->getArgument(1);
78
-				break;
79
-			case '\OC\Repair::advance':
80
-				$this->progressStateStep += $event->getArgument(0);
81
-				$desc = $event->getArgument(1);
82
-				if (empty($desc)) {
83
-					$desc = $this->currentStep;
84
-				}
85
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
86
-				break;
87
-			case '\OC\Repair::finishProgress':
88
-				$this->progressStateMax = $this->progressStateStep;
89
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
90
-				break;
91
-			case '\OC\Repair::step':
92
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair step:') . ' ' . $event->getArgument(0));
93
-				break;
94
-			case '\OC\Repair::info':
95
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair info:') . ' ' . $event->getArgument(0));
96
-				break;
97
-			case '\OC\Repair::warning':
98
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0));
99
-				break;
100
-			case '\OC\Repair::error':
101
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair error:') . ' ' . $event->getArgument(0));
102
-				break;
103
-		}
104
-	}
52
+    /** @var integer */
53
+    private $progressStateMax = 100;
54
+    /** @var integer */
55
+    private $progressStateStep = 0;
56
+    /** @var string */
57
+    private $currentStep;
58
+    /** @var \OCP\IEventSource */
59
+    private $eventSource;
60
+    /** @var \OCP\IL10N */
61
+    private $l10n;
62
+
63
+    public function __construct(\OCP\IEventSource $eventSource, \OCP\IL10N $l10n) {
64
+        $this->eventSource = $eventSource;
65
+        $this->l10n = $l10n;
66
+    }
67
+
68
+    public function handleRepairFeedback($event) {
69
+        if (!$event instanceof GenericEvent) {
70
+            return;
71
+        }
72
+
73
+        switch ($event->getSubject()) {
74
+            case '\OC\Repair::startProgress':
75
+                $this->progressStateMax = $event->getArgument(0);
76
+                $this->progressStateStep = 0;
77
+                $this->currentStep = $event->getArgument(1);
78
+                break;
79
+            case '\OC\Repair::advance':
80
+                $this->progressStateStep += $event->getArgument(0);
81
+                $desc = $event->getArgument(1);
82
+                if (empty($desc)) {
83
+                    $desc = $this->currentStep;
84
+                }
85
+                $this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
86
+                break;
87
+            case '\OC\Repair::finishProgress':
88
+                $this->progressStateMax = $this->progressStateStep;
89
+                $this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
90
+                break;
91
+            case '\OC\Repair::step':
92
+                $this->eventSource->send('success', (string)$this->l10n->t('Repair step:') . ' ' . $event->getArgument(0));
93
+                break;
94
+            case '\OC\Repair::info':
95
+                $this->eventSource->send('success', (string)$this->l10n->t('Repair info:') . ' ' . $event->getArgument(0));
96
+                break;
97
+            case '\OC\Repair::warning':
98
+                $this->eventSource->send('notice', (string)$this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0));
99
+                break;
100
+            case '\OC\Repair::error':
101
+                $this->eventSource->send('notice', (string)$this->l10n->t('Repair error:') . ' ' . $event->getArgument(0));
102
+                break;
103
+        }
104
+    }
105 105
 }
106 106
 
107 107
 if (\OCP\Util::needUpgrade()) {
108
-	$config = \OC::$server->getSystemConfig();
109
-	if ($config->getValue('upgrade.disable-web', false)) {
110
-		$eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
111
-		$eventSource->close();
112
-		exit();
113
-	}
114
-
115
-	// if a user is currently logged in, their session must be ignored to
116
-	// avoid side effects
117
-	\OC_User::setIncognitoMode(true);
118
-
119
-	$logger = \OC::$server->getLogger();
120
-	$config = \OC::$server->getConfig();
121
-	$updater = new \OC\Updater(
122
-			$config,
123
-			\OC::$server->getIntegrityCodeChecker(),
124
-			$logger,
125
-			\OC::$server->query(\OC\Installer::class)
126
-	);
127
-	$incompatibleApps = [];
128
-
129
-	$dispatcher = \OC::$server->getEventDispatcher();
130
-	$dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($eventSource, $l) {
131
-		if ($event instanceof GenericEvent) {
132
-			$eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
133
-		}
134
-	});
135
-	$dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($eventSource, $l) {
136
-		if ($event instanceof GenericEvent) {
137
-			$eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
138
-		}
139
-	});
140
-	$feedBack = new FeedBackHandler($eventSource, $l);
141
-	$dispatcher->addListener('\OC\Repair::startProgress', [$feedBack, 'handleRepairFeedback']);
142
-	$dispatcher->addListener('\OC\Repair::advance', [$feedBack, 'handleRepairFeedback']);
143
-	$dispatcher->addListener('\OC\Repair::finishProgress', [$feedBack, 'handleRepairFeedback']);
144
-	$dispatcher->addListener('\OC\Repair::step', [$feedBack, 'handleRepairFeedback']);
145
-	$dispatcher->addListener('\OC\Repair::info', [$feedBack, 'handleRepairFeedback']);
146
-	$dispatcher->addListener('\OC\Repair::warning', [$feedBack, 'handleRepairFeedback']);
147
-	$dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']);
148
-
149
-	$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
150
-		$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
151
-	});
152
-	$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
153
-		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
154
-	});
155
-	$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
156
-		$eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
157
-	});
158
-	$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) {
159
-		$eventSource->send('success', (string)$l->t('Updating database schema'));
160
-	});
161
-	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
162
-		$eventSource->send('success', (string)$l->t('Updated database'));
163
-	});
164
-	$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($eventSource, $l) {
165
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
166
-	});
167
-	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
168
-		$eventSource->send('success', (string)$l->t('Checked database schema update'));
169
-	});
170
-	$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
171
-		$eventSource->send('success', (string)$l->t('Checking updates of apps'));
172
-	});
173
-	$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) {
174
-		$eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app]));
175
-	});
176
-	$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) {
177
-		$eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app]));
178
-	});
179
-	$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) {
180
-		$eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app]));
181
-	});
182
-	$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) {
183
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
184
-	});
185
-	$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
186
-		$eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
187
-	});
188
-	$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
189
-		$eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version]));
190
-	});
191
-	$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
192
-		$incompatibleApps[]= $app;
193
-	});
194
-	$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) {
195
-		$eventSource->send('failure', $message);
196
-		$eventSource->close();
197
-		$config->setSystemValue('maintenance', false);
198
-	});
199
-	$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
200
-		$eventSource->send('success', (string)$l->t('Set log level to debug'));
201
-	});
202
-	$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
203
-		$eventSource->send('success', (string)$l->t('Reset log level'));
204
-	});
205
-	$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) {
206
-		$eventSource->send('success', (string)$l->t('Starting code integrity check'));
207
-	});
208
-	$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) {
209
-		$eventSource->send('success', (string)$l->t('Finished code integrity check'));
210
-	});
211
-
212
-	try {
213
-		$updater->upgrade();
214
-	} catch (\Exception $e) {
215
-		\OC::$server->getLogger()->logException($e, [
216
-			'level' => ILogger::ERROR,
217
-			'app' => 'update',
218
-		]);
219
-		$eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
220
-		$eventSource->close();
221
-		exit();
222
-	}
223
-
224
-	$disabledApps = [];
225
-	foreach ($incompatibleApps as $app) {
226
-		$disabledApps[$app] = (string) $l->t('%s (incompatible)', [$app]);
227
-	}
228
-
229
-	if (!empty($disabledApps)) {
230
-		$eventSource->send('notice',
231
-			(string)$l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
232
-	}
108
+    $config = \OC::$server->getSystemConfig();
109
+    if ($config->getValue('upgrade.disable-web', false)) {
110
+        $eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
111
+        $eventSource->close();
112
+        exit();
113
+    }
114
+
115
+    // if a user is currently logged in, their session must be ignored to
116
+    // avoid side effects
117
+    \OC_User::setIncognitoMode(true);
118
+
119
+    $logger = \OC::$server->getLogger();
120
+    $config = \OC::$server->getConfig();
121
+    $updater = new \OC\Updater(
122
+            $config,
123
+            \OC::$server->getIntegrityCodeChecker(),
124
+            $logger,
125
+            \OC::$server->query(\OC\Installer::class)
126
+    );
127
+    $incompatibleApps = [];
128
+
129
+    $dispatcher = \OC::$server->getEventDispatcher();
130
+    $dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($eventSource, $l) {
131
+        if ($event instanceof GenericEvent) {
132
+            $eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
133
+        }
134
+    });
135
+    $dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($eventSource, $l) {
136
+        if ($event instanceof GenericEvent) {
137
+            $eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
138
+        }
139
+    });
140
+    $feedBack = new FeedBackHandler($eventSource, $l);
141
+    $dispatcher->addListener('\OC\Repair::startProgress', [$feedBack, 'handleRepairFeedback']);
142
+    $dispatcher->addListener('\OC\Repair::advance', [$feedBack, 'handleRepairFeedback']);
143
+    $dispatcher->addListener('\OC\Repair::finishProgress', [$feedBack, 'handleRepairFeedback']);
144
+    $dispatcher->addListener('\OC\Repair::step', [$feedBack, 'handleRepairFeedback']);
145
+    $dispatcher->addListener('\OC\Repair::info', [$feedBack, 'handleRepairFeedback']);
146
+    $dispatcher->addListener('\OC\Repair::warning', [$feedBack, 'handleRepairFeedback']);
147
+    $dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']);
148
+
149
+    $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
150
+        $eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
151
+    });
152
+    $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
153
+        $eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
154
+    });
155
+    $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
156
+        $eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
157
+    });
158
+    $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) {
159
+        $eventSource->send('success', (string)$l->t('Updating database schema'));
160
+    });
161
+    $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
162
+        $eventSource->send('success', (string)$l->t('Updated database'));
163
+    });
164
+    $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($eventSource, $l) {
165
+        $eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
166
+    });
167
+    $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
168
+        $eventSource->send('success', (string)$l->t('Checked database schema update'));
169
+    });
170
+    $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
171
+        $eventSource->send('success', (string)$l->t('Checking updates of apps'));
172
+    });
173
+    $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) {
174
+        $eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app]));
175
+    });
176
+    $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) {
177
+        $eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app]));
178
+    });
179
+    $updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) {
180
+        $eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app]));
181
+    });
182
+    $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) {
183
+        $eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
184
+    });
185
+    $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
186
+        $eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
187
+    });
188
+    $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
189
+        $eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version]));
190
+    });
191
+    $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
192
+        $incompatibleApps[]= $app;
193
+    });
194
+    $updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) {
195
+        $eventSource->send('failure', $message);
196
+        $eventSource->close();
197
+        $config->setSystemValue('maintenance', false);
198
+    });
199
+    $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
200
+        $eventSource->send('success', (string)$l->t('Set log level to debug'));
201
+    });
202
+    $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
203
+        $eventSource->send('success', (string)$l->t('Reset log level'));
204
+    });
205
+    $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) {
206
+        $eventSource->send('success', (string)$l->t('Starting code integrity check'));
207
+    });
208
+    $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) {
209
+        $eventSource->send('success', (string)$l->t('Finished code integrity check'));
210
+    });
211
+
212
+    try {
213
+        $updater->upgrade();
214
+    } catch (\Exception $e) {
215
+        \OC::$server->getLogger()->logException($e, [
216
+            'level' => ILogger::ERROR,
217
+            'app' => 'update',
218
+        ]);
219
+        $eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
220
+        $eventSource->close();
221
+        exit();
222
+    }
223
+
224
+    $disabledApps = [];
225
+    foreach ($incompatibleApps as $app) {
226
+        $disabledApps[$app] = (string) $l->t('%s (incompatible)', [$app]);
227
+    }
228
+
229
+    if (!empty($disabledApps)) {
230
+        $eventSource->send('notice',
231
+            (string)$l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
232
+    }
233 233
 } else {
234
-	$eventSource->send('notice', (string)$l->t('Already up to date'));
234
+    $eventSource->send('notice', (string)$l->t('Already up to date'));
235 235
 }
236 236
 
237 237
 $eventSource->send('done', '');
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 // need to send an initial message to force-init the event source,
47 47
 // which will then trigger its own CSRF check and produces its own CSRF error
48 48
 // message
49
-$eventSource->send('success', (string)$l->t('Preparing update'));
49
+$eventSource->send('success', (string) $l->t('Preparing update'));
50 50
 
51 51
 class FeedBackHandler {
52 52
 	/** @var integer */
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
 				if (empty($desc)) {
83 83
 					$desc = $this->currentStep;
84 84
 				}
85
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
85
+				$this->eventSource->send('success', (string) $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
86 86
 				break;
87 87
 			case '\OC\Repair::finishProgress':
88 88
 				$this->progressStateMax = $this->progressStateStep;
89
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
89
+				$this->eventSource->send('success', (string) $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
90 90
 				break;
91 91
 			case '\OC\Repair::step':
92
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair step:') . ' ' . $event->getArgument(0));
92
+				$this->eventSource->send('success', (string) $this->l10n->t('Repair step:').' '.$event->getArgument(0));
93 93
 				break;
94 94
 			case '\OC\Repair::info':
95
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair info:') . ' ' . $event->getArgument(0));
95
+				$this->eventSource->send('success', (string) $this->l10n->t('Repair info:').' '.$event->getArgument(0));
96 96
 				break;
97 97
 			case '\OC\Repair::warning':
98
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0));
98
+				$this->eventSource->send('notice', (string) $this->l10n->t('Repair warning:').' '.$event->getArgument(0));
99 99
 				break;
100 100
 			case '\OC\Repair::error':
101
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair error:') . ' ' . $event->getArgument(0));
101
+				$this->eventSource->send('notice', (string) $this->l10n->t('Repair error:').' '.$event->getArgument(0));
102 102
 				break;
103 103
 		}
104 104
 	}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 if (\OCP\Util::needUpgrade()) {
108 108
 	$config = \OC::$server->getSystemConfig();
109 109
 	if ($config->getValue('upgrade.disable-web', false)) {
110
-		$eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
110
+		$eventSource->send('failure', (string) $l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
111 111
 		$eventSource->close();
112 112
 		exit();
113 113
 	}
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 	$incompatibleApps = [];
128 128
 
129 129
 	$dispatcher = \OC::$server->getEventDispatcher();
130
-	$dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($eventSource, $l) {
130
+	$dispatcher->addListener('\OC\DB\Migrator::executeSql', function($event) use ($eventSource, $l) {
131 131
 		if ($event instanceof GenericEvent) {
132
-			$eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
132
+			$eventSource->send('success', (string) $l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
133 133
 		}
134 134
 	});
135
-	$dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($eventSource, $l) {
135
+	$dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($eventSource, $l) {
136 136
 		if ($event instanceof GenericEvent) {
137
-			$eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
137
+			$eventSource->send('success', (string) $l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
138 138
 		}
139 139
 	});
140 140
 	$feedBack = new FeedBackHandler($eventSource, $l);
@@ -146,67 +146,67 @@  discard block
 block discarded – undo
146 146
 	$dispatcher->addListener('\OC\Repair::warning', [$feedBack, 'handleRepairFeedback']);
147 147
 	$dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']);
148 148
 
149
-	$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
150
-		$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
149
+	$updater->listen('\OC\Updater', 'maintenanceEnabled', function() use ($eventSource, $l) {
150
+		$eventSource->send('success', (string) $l->t('Turned on maintenance mode'));
151 151
 	});
152
-	$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
153
-		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
152
+	$updater->listen('\OC\Updater', 'maintenanceDisabled', function() use ($eventSource, $l) {
153
+		$eventSource->send('success', (string) $l->t('Turned off maintenance mode'));
154 154
 	});
155
-	$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
156
-		$eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
155
+	$updater->listen('\OC\Updater', 'maintenanceActive', function() use ($eventSource, $l) {
156
+		$eventSource->send('success', (string) $l->t('Maintenance mode is kept active'));
157 157
 	});
158
-	$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) {
159
-		$eventSource->send('success', (string)$l->t('Updating database schema'));
158
+	$updater->listen('\OC\Updater', 'dbUpgradeBefore', function() use ($eventSource, $l) {
159
+		$eventSource->send('success', (string) $l->t('Updating database schema'));
160 160
 	});
161
-	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
162
-		$eventSource->send('success', (string)$l->t('Updated database'));
161
+	$updater->listen('\OC\Updater', 'dbUpgrade', function() use ($eventSource, $l) {
162
+		$eventSource->send('success', (string) $l->t('Updated database'));
163 163
 	});
164
-	$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($eventSource, $l) {
165
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
164
+	$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use ($eventSource, $l) {
165
+		$eventSource->send('success', (string) $l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
166 166
 	});
167
-	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
168
-		$eventSource->send('success', (string)$l->t('Checked database schema update'));
167
+	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function() use ($eventSource, $l) {
168
+		$eventSource->send('success', (string) $l->t('Checked database schema update'));
169 169
 	});
170
-	$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
171
-		$eventSource->send('success', (string)$l->t('Checking updates of apps'));
170
+	$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($eventSource, $l) {
171
+		$eventSource->send('success', (string) $l->t('Checking updates of apps'));
172 172
 	});
173
-	$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) {
174
-		$eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app]));
173
+	$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use ($eventSource, $l) {
174
+		$eventSource->send('success', (string) $l->t('Checking for update of app "%s" in appstore', [$app]));
175 175
 	});
176
-	$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) {
177
-		$eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app]));
176
+	$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use ($eventSource, $l) {
177
+		$eventSource->send('success', (string) $l->t('Update app "%s" from appstore', [$app]));
178 178
 	});
179
-	$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) {
180
-		$eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app]));
179
+	$updater->listen('\OC\Updater', 'checkAppStoreApp', function($app) use ($eventSource, $l) {
180
+		$eventSource->send('success', (string) $l->t('Checked for update of app "%s" in appstore', [$app]));
181 181
 	});
182
-	$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) {
183
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
182
+	$updater->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($eventSource, $l) {
183
+		$eventSource->send('success', (string) $l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
184 184
 	});
185
-	$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
186
-		$eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
185
+	$updater->listen('\OC\Updater', 'appUpgradeCheck', function() use ($eventSource, $l) {
186
+		$eventSource->send('success', (string) $l->t('Checked database schema update for apps'));
187 187
 	});
188
-	$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
189
-		$eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version]));
188
+	$updater->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($eventSource, $l) {
189
+		$eventSource->send('success', (string) $l->t('Updated "%1$s" to %2$s', [$app, $version]));
190 190
 	});
191
-	$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
192
-		$incompatibleApps[]= $app;
191
+	$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use (&$incompatibleApps) {
192
+		$incompatibleApps[] = $app;
193 193
 	});
194
-	$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) {
194
+	$updater->listen('\OC\Updater', 'failure', function($message) use ($eventSource, $config) {
195 195
 		$eventSource->send('failure', $message);
196 196
 		$eventSource->close();
197 197
 		$config->setSystemValue('maintenance', false);
198 198
 	});
199
-	$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
200
-		$eventSource->send('success', (string)$l->t('Set log level to debug'));
199
+	$updater->listen('\OC\Updater', 'setDebugLogLevel', function($logLevel, $logLevelName) use ($eventSource, $l) {
200
+		$eventSource->send('success', (string) $l->t('Set log level to debug'));
201 201
 	});
202
-	$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
203
-		$eventSource->send('success', (string)$l->t('Reset log level'));
202
+	$updater->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use ($eventSource, $l) {
203
+		$eventSource->send('success', (string) $l->t('Reset log level'));
204 204
 	});
205
-	$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) {
206
-		$eventSource->send('success', (string)$l->t('Starting code integrity check'));
205
+	$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use ($eventSource, $l) {
206
+		$eventSource->send('success', (string) $l->t('Starting code integrity check'));
207 207
 	});
208
-	$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) {
209
-		$eventSource->send('success', (string)$l->t('Finished code integrity check'));
208
+	$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use ($eventSource, $l) {
209
+		$eventSource->send('success', (string) $l->t('Finished code integrity check'));
210 210
 	});
211 211
 
212 212
 	try {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			'level' => ILogger::ERROR,
217 217
 			'app' => 'update',
218 218
 		]);
219
-		$eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
219
+		$eventSource->send('failure', get_class($e).': '.$e->getMessage());
220 220
 		$eventSource->close();
221 221
 		exit();
222 222
 	}
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 
229 229
 	if (!empty($disabledApps)) {
230 230
 		$eventSource->send('notice',
231
-			(string)$l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
231
+			(string) $l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
232 232
 	}
233 233
 } else {
234
-	$eventSource->send('notice', (string)$l->t('Already up to date'));
234
+	$eventSource->send('notice', (string) $l->t('Already up to date'));
235 235
 }
236 236
 
237 237
 $eventSource->send('done', '');
Please login to merge, or discard this patch.