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