@@ -110,7 +110,8 @@ protected function initialize(InputInterface $input, OutputInterface $output)
110
110
'fsync ' => $ input ->getOption ('fsync ' ),
111
111
);
112
112
113
- $ this ->printStatusCallback = function () {};
113
+ $ this ->printStatusCallback = function () {
114
+ };
114
115
register_tick_function (array ($ this , 'printStatus ' ));
115
116
}
116
117
@@ -128,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
128
129
}
129
130
130
131
/**
131
- * Migrate message documents
132
+ * Migrate message documents.
132
133
*/
133
134
private function migrateMessages (OutputInterface $ output )
134
135
{
@@ -145,10 +146,11 @@ private function migrateMessages(OutputInterface $output)
145
146
146
147
if (!$ numTotal = $ cursor ->count ()) {
147
148
$ output ->writeln ('There are no message documents to migrate. ' );
149
+
148
150
return ;
149
151
}
150
152
151
- $ this ->printStatusCallback = function () use ($ output , &$ numProcessed , $ numTotal ) {
153
+ $ this ->printStatusCallback = function () use ($ output , &$ numProcessed , $ numTotal ) {
152
154
$ output ->write (sprintf ("Processed: <info>%d</info> / Complete: <info>%d%%</info> \r" , $ numProcessed , round (100 * ($ numProcessed / $ numTotal ))));
153
155
};
154
156
@@ -169,12 +171,12 @@ private function migrateMessages(OutputInterface $output)
169
171
}
170
172
}
171
173
172
- $ output ->write (str_repeat (' ' , 28 + ceil (log10 ($ numProcessed ))) . "\r" );
174
+ $ output ->write (str_repeat (' ' , 28 + ceil (log10 ($ numProcessed ))). "\r" );
173
175
$ output ->writeln (sprintf ('Migrated <info>%d</info> message documents. ' , $ numProcessed ));
174
176
}
175
177
176
178
/**
177
- * Migrate thread documents
179
+ * Migrate thread documents.
178
180
*/
179
181
private function migrateThreads (OutputInterface $ output )
180
182
{
@@ -194,10 +196,11 @@ private function migrateThreads(OutputInterface $output)
194
196
195
197
if (!$ numTotal = $ cursor ->count ()) {
196
198
$ output ->writeln ('There are no thread documents to migrate. ' );
199
+
197
200
return ;
198
201
}
199
202
200
- $ this ->printStatusCallback = function () use ($ output , &$ numProcessed , $ numTotal ) {
203
+ $ this ->printStatusCallback = function () use ($ output , &$ numProcessed , $ numTotal ) {
201
204
$ output ->write (sprintf ("Processed: <info>%d</info> / Complete: <info>%d%%</info> \r" , $ numProcessed , round (100 * ($ numProcessed / $ numTotal ))));
202
205
};
203
206
@@ -222,7 +225,7 @@ private function migrateThreads(OutputInterface $output)
222
225
}
223
226
}
224
227
225
- $ output ->write (str_repeat (' ' , 28 + ceil (log10 ($ numProcessed ))) . "\r" );
228
+ $ output ->write (str_repeat (' ' , 28 + ceil (log10 ($ numProcessed ))). "\r" );
226
229
$ output ->writeln (sprintf ('Migrated <info>%d</info> thread documents. ' , $ numProcessed ));
227
230
}
228
231
@@ -250,6 +253,7 @@ private function createMessageMetadata(array &$message)
250
253
* Sets the unreadForParticipants array on the message.
251
254
*
252
255
* @see Message::doEnsureUnreadForParticipantsArray()
256
+ *
253
257
* @param array &$message
254
258
*/
255
259
private function createMessageUnreadForParticipants (array &$ message )
@@ -328,6 +332,7 @@ private function createThreadLastMessageDate(array &$thread)
328
332
* Sets the active participant arrays on the thread.
329
333
*
330
334
* @see Thread::doEnsureActiveParticipantArrays()
335
+ *
331
336
* @param array $thread
332
337
*/
333
338
private function createThreadActiveParticipantArrays (array &$ thread )
@@ -386,11 +391,13 @@ private function createThreadActiveParticipantArrays(array &$thread)
386
391
}
387
392
388
393
/**
389
- * Get the MongoCollection for the given class
394
+ * Get the MongoCollection for the given class.
390
395
*
391
396
* @param ManagerRegistry $registry
392
397
* @param string $class
398
+ *
393
399
* @return \MongoCollection
400
+ *
394
401
* @throws \RuntimeException if the class has no DocumentManager
395
402
*/
396
403
private function getMongoCollectionForClass (ManagerRegistry $ registry , $ class )
@@ -403,7 +410,7 @@ private function getMongoCollectionForClass(ManagerRegistry $registry, $class)
403
410
}
404
411
405
412
/**
406
- * Invokes the print status callback
413
+ * Invokes the print status callback.
407
414
*
408
415
* Since unregister_tick_function() does not support anonymous functions, it
409
416
* is easier to register one method (this) and invoke a dynamic callback.
0 commit comments