27 $expectedConnectionType =
null
30 ->disableOriginalConstructor()
32 if ( $expectedConnectionType !==
null ) {
33 $mock->expects( $this->
any() )
34 ->method(
'getConnectionRef' )
35 ->with( $expectedConnectionType )
38 $mock->expects( $this->
any() )
39 ->method(
'getConnectionRef' )
50 $expectedConnectionType =
null
54 ->disableOriginalConstructor()
56 $mock->expects( $this->
any() )
57 ->method(
'getMainLB' )
67 ->disableOriginalConstructor()
69 $mock->expects( $this->
any() )
74 $mock->expects( $this->
any() )
75 ->method(
'lazyPush' )
87 ->disableOriginalConstructor()
88 ->setMethods( [
'get',
'set',
'delete',
'makeKey' ] )
90 $mock->expects( $this->
any() )
103 ->disableOriginalConstructor()
105 $mock->expects( $this->
any() )
106 ->method(
'isReadOnly' )
117 $mock->expects( $this->
any() )
120 $mock->expects( $this->
any() )
123 $mock->expects( $this->
any() )
124 ->method(
'getUserPage' )
125 ->will( $this->
returnValue( Title::makeTitle( NS_USER,
'MockUser' ) ) );
137 $fakeRow =
new stdClass();
138 foreach ( $rowValues as $valueName =>
$value ) {
139 $fakeRow->$valueName =
$value;
164 $mockDb->expects( $this->
once() )
165 ->method(
'selectField' )
170 'wl_user' => $user->getId(),
172 $this->isType(
'string' )
175 $mockDb->expects( $this->
once() )
184 $mockCache->expects( $this->never() )->method(
'get' );
185 $mockCache->expects( $this->never() )->method(
'set' );
186 $mockCache->expects( $this->
once() )
196 TestingAccessWrapper::newFromObject( $store )
197 ->cacheIndex = [ 0 => [
'F' => [ 7 =>
'RM-KEY', 9 =>
'KEEP-KEY' ] ] ];
199 $this->
assertTrue( $store->clearUserWatchedItems( $user ) );
206 $mockDb->expects( $this->
once() )
207 ->method(
'selectField' )
212 'wl_user' => $user->getId(),
214 $this->isType(
'string' )
219 $mockCache->expects( $this->never() )->method(
'get' );
220 $mockCache->expects( $this->never() )->method(
'set' );
221 $mockCache->expects( $this->never() )->method(
'delete' );
230 $this->
assertFalse( $store->clearUserWatchedItems( $user ) );
237 $mockDb->expects( $this->
exactly( 1 ) )
238 ->method(
'selectField' )
243 'wl_user' => $user->getId(),
245 $this->isType(
'string' )
250 $mockCache->expects( $this->never() )->method(
'get' );
251 $mockCache->expects( $this->never() )->method(
'set' );
252 $mockCache->expects( $this->never() )->method(
'delete' );
261 $this->
assertEquals( 12, $store->countWatchedItems( $user ) );
265 $titleValue =
new TitleValue( 0,
'SomeDbKey' );
268 $mockDb->expects( $this->
exactly( 1 ) )
269 ->method(
'selectField' )
274 'wl_namespace' => $titleValue->getNamespace(),
275 'wl_title' => $titleValue->getDBkey(),
277 $this->isType(
'string' )
282 $mockCache->expects( $this->never() )->method(
'get' );
283 $mockCache->expects( $this->never() )->method(
'set' );
284 $mockCache->expects( $this->never() )->method(
'delete' );
293 $this->
assertEquals( 7, $store->countWatchers( $titleValue ) );
306 $this->
getFakeRow( [
'wl_title' =>
'SomeDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'100' ] ),
307 $this->
getFakeRow( [
'wl_title' =>
'OtherDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'300' ] ),
308 $this->
getFakeRow( [
'wl_title' =>
'AnotherDbKey',
'wl_namespace' =>
'1',
'watchers' =>
'500' ]
311 $mockDb->expects( $this->
once() )
312 ->method(
'makeWhereFrom2d' )
314 [ [
'SomeDbKey' => 1,
'OtherDbKey' => 1 ], [
'AnotherDbKey' => 1 ] ],
315 $this->
isType(
'string' ),
318 ->will( $this->
returnValue(
'makeWhereFrom2d return value' ) );
319 $mockDb->expects( $this->
once() )
323 [
'wl_title',
'wl_namespace',
'watchers' =>
'COUNT(*)' ],
324 [
'makeWhereFrom2d return value' ],
325 $this->
isType(
'string' ),
327 'GROUP BY' => [
'wl_namespace',
'wl_title' ],
335 $mockCache->expects( $this->never() )->method(
'get' );
336 $mockCache->expects( $this->never() )->method(
'set' );
337 $mockCache->expects( $this->never() )->method(
'delete' );
347 0 => [
'SomeDbKey' => 100,
'OtherDbKey' => 300 ],
348 1 => [
'AnotherDbKey' => 500 ],
350 $this->
assertEquals( $expected, $store->countWatchersMultiple( $titleValues ) );
356 [
"50; DROP TABLE watchlist;\n--" ],
373 $this->
getFakeRow( [
'wl_title' =>
'SomeDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'100' ] ),
374 $this->
getFakeRow( [
'wl_title' =>
'OtherDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'300' ] ),
375 $this->
getFakeRow( [
'wl_title' =>
'AnotherDbKey',
'wl_namespace' =>
'1',
'watchers' =>
'500' ]
378 $mockDb->expects( $this->
once() )
379 ->method(
'makeWhereFrom2d' )
381 [ [
'SomeDbKey' => 1,
'OtherDbKey' => 1 ], [
'AnotherDbKey' => 1 ] ],
382 $this->
isType(
'string' ),
385 ->will( $this->
returnValue(
'makeWhereFrom2d return value' ) );
386 $mockDb->expects( $this->
once() )
390 [
'wl_title',
'wl_namespace',
'watchers' =>
'COUNT(*)' ],
391 [
'makeWhereFrom2d return value' ],
392 $this->
isType(
'string' ),
394 'GROUP BY' => [
'wl_namespace',
'wl_title' ],
395 'HAVING' =>
'COUNT(*) >= 50',
403 $mockCache->expects( $this->never() )->method(
'get' );
404 $mockCache->expects( $this->never() )->method(
'set' );
405 $mockCache->expects( $this->never() )->method(
'delete' );
415 0 => [
'SomeDbKey' => 100,
'OtherDbKey' => 300 ],
416 1 => [
'AnotherDbKey' => 500 ],
420 $store->countWatchersMultiple( $titleValues, [
'minimumWatchers' => $minWatchers ] )
425 $titleValue =
new TitleValue( 0,
'SomeDbKey' );
428 $mockDb->expects( $this->
exactly( 1 ) )
429 ->method(
'selectField' )
434 'wl_namespace' => $titleValue->getNamespace(),
435 'wl_title' => $titleValue->getDBkey(),
436 'wl_notificationtimestamp >= \'TS111TS\' OR wl_notificationtimestamp IS NULL',
438 $this->isType(
'string' )
441 $mockDb->expects( $this->
exactly( 1 ) )
442 ->method(
'addQuotes' )
446 $mockDb->expects( $this->
exactly( 1 ) )
447 ->method(
'timestamp' )
449 return 'TS' .
$value .
'TS';
453 $mockCache->expects( $this->never() )->method(
'set' );
454 $mockCache->expects( $this->never() )->method(
'get' );
455 $mockCache->expects( $this->never() )->method(
'delete' );
464 $this->
assertEquals( 7, $store->countVisitingWatchers( $titleValue,
'111' ) );
468 $titleValuesWithThresholds = [
471 [
new TitleValue( 1,
'AnotherDbKey' ),
'123' ],
475 $this->
getFakeRow( [
'wl_title' =>
'SomeDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'100' ] ),
476 $this->
getFakeRow( [
'wl_title' =>
'OtherDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'300' ] ),
478 [
'wl_title' =>
'AnotherDbKey',
'wl_namespace' =>
'1',
'watchers' =>
'500' ]
482 $mockDb->expects( $this->
exactly( 2 * 3 ) )
483 ->method(
'addQuotes' )
487 $mockDb->expects( $this->
exactly( 3 ) )
488 ->method(
'timestamp' )
490 return 'TS' .
$value .
'TS';
492 $mockDb->expects( $this->
any() )
493 ->method(
'makeList' )
499 $sqlConj = $conj ===
LIST_AND ?
' AND ' :
' OR ';
500 return implode( $sqlConj,
array_map(
function (
$s ) {
501 return '(' .
$s .
')';
505 $mockDb->expects( $this->never() )
506 ->method(
'makeWhereFrom2d' );
509 '((wl_namespace = 0) AND (' .
510 "(((wl_title = 'SomeDbKey') AND (" .
511 "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
513 "(wl_title = 'OtherDbKey') AND (" .
514 "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
516 ') OR ((wl_namespace = 1) AND (' .
517 "(((wl_title = 'AnotherDbKey') AND (" .
518 "(wl_notificationtimestamp >= 'TS123TS') OR (wl_notificationtimestamp IS NULL)" .
520 $mockDb->expects( $this->
once() )
524 [
'wl_namespace',
'wl_title',
'watchers' =>
'COUNT(*)' ],
526 $this->
isType(
'string' ),
528 'GROUP BY' => [
'wl_namespace',
'wl_title' ],
536 $mockCache->expects( $this->never() )->method(
'get' );
537 $mockCache->expects( $this->never() )->method(
'set' );
538 $mockCache->expects( $this->never() )->method(
'delete' );
548 0 => [
'SomeDbKey' => 100,
'OtherDbKey' => 300 ],
549 1 => [
'AnotherDbKey' => 500 ],
553 $store->countVisitingWatchersMultiple( $titleValuesWithThresholds )
558 $titleValuesWithThresholds = [
561 [
new TitleValue( 1,
'AnotherDbKey' ),
'123' ],
567 $this->
getFakeRow( [
'wl_title' =>
'SomeDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'100' ] ),
568 $this->
getFakeRow( [
'wl_title' =>
'OtherDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'300' ] ),
570 [
'wl_title' =>
'AnotherDbKey',
'wl_namespace' =>
'1',
'watchers' =>
'500' ]
573 [
'wl_title' =>
'SomeNotExisitingDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'100' ]
576 [
'wl_title' =>
'OtherNotExisitingDbKey',
'wl_namespace' =>
'0',
'watchers' =>
'200' ]
580 $mockDb->expects( $this->
exactly( 2 * 3 ) )
581 ->method(
'addQuotes' )
585 $mockDb->expects( $this->
exactly( 3 ) )
586 ->method(
'timestamp' )
588 return 'TS' .
$value .
'TS';
590 $mockDb->expects( $this->
any() )
591 ->method(
'makeList' )
597 $sqlConj = $conj ===
LIST_AND ?
' AND ' :
' OR ';
598 return implode( $sqlConj,
array_map(
function (
$s ) {
599 return '(' .
$s .
')';
603 $mockDb->expects( $this->
once() )
604 ->method(
'makeWhereFrom2d' )
606 [ [
'SomeNotExisitingDbKey' => 1,
'OtherNotExisitingDbKey' => 1 ] ],
607 $this->
isType(
'string' ),
613 '((wl_namespace = 0) AND (' .
614 "(((wl_title = 'SomeDbKey') AND (" .
615 "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
617 "(wl_title = 'OtherDbKey') AND (" .
618 "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
620 ') OR ((wl_namespace = 1) AND (' .
621 "(((wl_title = 'AnotherDbKey') AND (" .
622 "(wl_notificationtimestamp >= 'TS123TS') OR (wl_notificationtimestamp IS NULL)" .
625 '(makeWhereFrom2d return value)';
626 $mockDb->expects( $this->
once() )
630 [
'wl_namespace',
'wl_title',
'watchers' =>
'COUNT(*)' ],
632 $this->
isType(
'string' ),
634 'GROUP BY' => [
'wl_namespace',
'wl_title' ],
642 $mockCache->expects( $this->never() )->method(
'get' );
643 $mockCache->expects( $this->never() )->method(
'set' );
644 $mockCache->expects( $this->never() )->method(
'delete' );
655 'SomeDbKey' => 100,
'OtherDbKey' => 300,
656 'SomeNotExisitingDbKey' => 100,
'OtherNotExisitingDbKey' => 200
658 1 => [
'AnotherDbKey' => 500 ],
662 $store->countVisitingWatchersMultiple( $titleValuesWithThresholds )
670 $titleValuesWithThresholds = [
673 [
new TitleValue( 1,
'AnotherDbKey' ),
'123' ],
677 $mockDb->expects( $this->
any() )
678 ->method(
'makeList' )
679 ->will( $this->
returnValue(
'makeList return value' ) );
680 $mockDb->expects( $this->
once() )
684 [
'wl_namespace',
'wl_title',
'watchers' =>
'COUNT(*)' ],
685 'makeList return value',
686 $this->
isType(
'string' ),
688 'GROUP BY' => [
'wl_namespace',
'wl_title' ],
689 'HAVING' =>
'COUNT(*) >= 50',
697 $mockCache->expects( $this->never() )->method(
'get' );
698 $mockCache->expects( $this->never() )->method(
'set' );
699 $mockCache->expects( $this->never() )->method(
'delete' );
709 0 => [
'SomeDbKey' => 0,
'OtherDbKey' => 0 ],
710 1 => [
'AnotherDbKey' => 0 ],
714 $store->countVisitingWatchersMultiple( $titleValuesWithThresholds, $minWatchers )
722 $mockDb->expects( $this->
exactly( 1 ) )
723 ->method(
'selectRowCount' )
728 "wl_notificationtimestamp IS NOT NULL",
736 $mockCache->expects( $this->never() )->method(
'set' );
737 $mockCache->expects( $this->never() )->method(
'get' );
738 $mockCache->expects( $this->never() )->method(
'delete' );
747 $this->
assertEquals( 9, $store->countUnreadNotifications( $user ) );
757 $mockDb->expects( $this->
exactly( 1 ) )
758 ->method(
'selectRowCount' )
763 "wl_notificationtimestamp IS NOT NULL",
766 $this->
isType(
'string' ),
772 $mockCache->expects( $this->never() )->method(
'set' );
773 $mockCache->expects( $this->never() )->method(
'get' );
774 $mockCache->expects( $this->never() )->method(
'delete' );
785 $store->countUnreadNotifications( $user, $limit )
796 $mockDb->expects( $this->
exactly( 1 ) )
797 ->method(
'selectRowCount' )
802 "wl_notificationtimestamp IS NOT NULL",
805 $this->
isType(
'string' ),
811 $mockCache->expects( $this->never() )->method(
'set' );
812 $mockCache->expects( $this->never() )->method(
'get' );
813 $mockCache->expects( $this->never() )->method(
'delete' );
824 $store->countUnreadNotifications( $user, $limit )
830 $mockDb->expects( $this->
once() )
836 'wl_notificationtimestamp',
840 'wl_title' =>
'Old_Title',
842 'WatchedItemStore::duplicateEntry',
845 ->will( $this->
returnValue(
new FakeResultWrapper( [] ) ) );
854 $store->duplicateEntry(
855 Title::newFromText(
'Old_Title' ),
856 Title::newFromText(
'New_Title' )
862 $this->
getFakeRow( [
'wl_user' =>
'1',
'wl_notificationtimestamp' =>
'20151212010101' ] ),
863 $this->
getFakeRow( [
'wl_user' =>
'2',
'wl_notificationtimestamp' =>
null ] ),
867 $mockDb->expects( $this->
at( 0 ) )
873 'wl_notificationtimestamp',
877 'wl_title' =>
'Old_Title',
880 ->will( $this->
returnValue(
new FakeResultWrapper( $fakeRows ) ) );
881 $mockDb->expects( $this->
at( 1 ) )
882 ->method(
'replace' )
885 [ [
'wl_user',
'wl_namespace',
'wl_title' ] ],
890 'wl_title' =>
'New_Title',
891 'wl_notificationtimestamp' =>
'20151212010101',
896 'wl_title' =>
'New_Title',
897 'wl_notificationtimestamp' =>
null,
904 $mockCache->expects( $this->never() )->method(
'get' );
905 $mockCache->expects( $this->never() )->method(
'delete' );
914 $store->duplicateEntry(
915 Title::newFromText(
'Old_Title' ),
916 Title::newFromText(
'New_Title' )
922 $mockDb->expects( $this->
at( 0 ) )
928 'wl_notificationtimestamp',
932 'wl_title' =>
'Old_Title',
935 ->will( $this->
returnValue(
new FakeResultWrapper( [] ) ) );
936 $mockDb->expects( $this->
at( 1 ) )
942 'wl_notificationtimestamp',
946 'wl_title' =>
'Old_Title',
949 ->will( $this->
returnValue(
new FakeResultWrapper( [] ) ) );
952 $mockCache->expects( $this->never() )->method(
'get' );
953 $mockCache->expects( $this->never() )->method(
'delete' );
962 $store->duplicateAllAssociatedEntries(
963 Title::newFromText(
'Old_Title' ),
964 Title::newFromText(
'New_Title' )
970 [ Title::newFromText(
'Old_Title' ), Title::newFromText(
'New_Title' ) ],
983 $this->
getFakeRow( [
'wl_user' =>
'1',
'wl_notificationtimestamp' =>
'20151212010101' ] ),
987 $mockDb->expects( $this->
at( 0 ) )
993 'wl_notificationtimestamp',
997 'wl_title' => $oldTarget->getDBkey(),
1000 ->will( $this->
returnValue(
new FakeResultWrapper( $fakeRows ) ) );
1001 $mockDb->expects( $this->
at( 1 ) )
1002 ->method(
'replace' )
1005 [ [
'wl_user',
'wl_namespace',
'wl_title' ] ],
1010 'wl_title' => $newTarget->getDBkey(),
1011 'wl_notificationtimestamp' =>
'20151212010101',
1014 $this->isType(
'string' )
1016 $mockDb->expects( $this->
at( 2 ) )
1017 ->method(
'select' )
1022 'wl_notificationtimestamp',
1026 'wl_title' => $oldTarget->getDBkey(),
1029 ->will( $this->
returnValue(
new FakeResultWrapper( $fakeRows ) ) );
1030 $mockDb->expects( $this->
at( 3 ) )
1031 ->method(
'replace' )
1034 [ [
'wl_user',
'wl_namespace',
'wl_title' ] ],
1039 'wl_title' => $newTarget->getDBkey(),
1040 'wl_notificationtimestamp' =>
'20151212010101',
1043 $this->isType(
'string' )
1047 $mockCache->expects( $this->never() )->method(
'get' );
1048 $mockCache->expects( $this->never() )->method(
'delete' );
1057 $store->duplicateAllAssociatedEntries(
1065 $mockDb->expects( $this->
once() )
1066 ->method(
'insert' )
1072 'wl_namespace' => 0,
1073 'wl_title' =>
'Some_Page',
1074 'wl_notificationtimestamp' =>
null,
1080 $mockCache->expects( $this->
once() )
1081 ->method(
'delete' )
1082 ->with(
'0:Some_Page:1' );
1093 Title::newFromText(
'Some_Page' )
1099 $mockDb->expects( $this->never() )
1100 ->method(
'insert' );
1103 $mockCache->expects( $this->never() )
1104 ->method(
'delete' );
1115 Title::newFromText(
'Some_Page' )
1128 $store->addWatchBatchForUser(
1129 $this->getMockNonAnonUserWithId( 1 ),
1137 $mockDb->expects( $this->
once() )
1138 ->method(
'insert' )
1144 'wl_namespace' => 0,
1145 'wl_title' =>
'Some_Page',
1146 'wl_notificationtimestamp' =>
null,
1150 'wl_namespace' => 1,
1151 'wl_title' =>
'Some_Page',
1152 'wl_notificationtimestamp' =>
null,
1157 $mockDb->expects( $this->
once() )
1158 ->method(
'affectedRows' )
1162 $mockCache->expects( $this->
exactly( 2 ) )
1163 ->method(
'delete' );
1164 $mockCache->expects( $this->
at( 1 ) )
1165 ->method(
'delete' )
1166 ->with(
'0:Some_Page:1' );
1167 $mockCache->expects( $this->
at( 3 ) )
1168 ->method(
'delete' )
1169 ->with(
'1:Some_Page:1' );
1181 $store->addWatchBatchForUser(
1190 $mockDb->expects( $this->never() )
1191 ->method(
'insert' );
1194 $mockCache->expects( $this->never() )
1195 ->method(
'delete' );
1205 $store->addWatchBatchForUser(
1206 $this->getAnonUser(),
1215 $mockDb->expects( $this->never() )
1216 ->method(
'insert' );
1219 $mockCache->expects( $this->never() )
1220 ->method(
'delete' );
1230 $store->addWatchBatchForUser( $user, [] )
1236 $mockDb->expects( $this->
once() )
1237 ->method(
'selectRow' )
1240 'wl_notificationtimestamp',
1243 'wl_namespace' => 0,
1244 'wl_title' =>
'SomeDbKey',
1248 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'20151212010101' ] )
1252 $mockCache->expects( $this->
once() )
1265 $watchedItem = $store->loadWatchedItem(
1270 $this->
assertEquals( 1, $watchedItem->getUser()->getId() );
1271 $this->
assertEquals(
'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
1272 $this->
assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
1277 $mockDb->expects( $this->
once() )
1278 ->method(
'selectRow' )
1281 'wl_notificationtimestamp',
1284 'wl_namespace' => 0,
1285 'wl_title' =>
'SomeDbKey',
1291 $mockCache->expects( $this->never() )->method(
'get' );
1292 $mockCache->expects( $this->never() )->method(
'delete' );
1302 $store->loadWatchedItem(
1303 $this->getMockNonAnonUserWithId( 1 ),
1311 $mockDb->expects( $this->never() )
1312 ->method(
'selectRow' );
1315 $mockCache->expects( $this->never() )->method(
'get' );
1316 $mockCache->expects( $this->never() )->method(
'delete' );
1326 $store->loadWatchedItem(
1327 $this->getAnonUser(),
1335 $mockDb->expects( $this->
once() )
1336 ->method(
'delete' )
1342 'wl_namespace' => 0,
1343 'wl_title' => [
'SomeDbKey' ],
1350 'wl_namespace' => 1,
1351 'wl_title' => [
'SomeDbKey' ],
1355 $mockDb->expects( $this->
exactly( 1 ) )
1356 ->method(
'affectedRows' )
1360 $mockCache->expects( $this->never() )->method(
'get' );
1361 $mockCache->expects( $this->
once() )
1362 ->method(
'delete' )
1364 [
'0:SomeDbKey:1' ],
1375 $titleValue =
new TitleValue( 0,
'SomeDbKey' );
1377 $store->removeWatch(
1378 $this->getMockNonAnonUserWithId( 1 ),
1379 Title::newFromTitleValue( $titleValue )
1386 $mockDb->expects( $this->
once() )
1387 ->method(
'delete' )
1393 'wl_namespace' => 0,
1394 'wl_title' => [
'SomeDbKey' ],
1401 'wl_namespace' => 1,
1402 'wl_title' => [
'SomeDbKey' ],
1407 $mockDb->expects( $this->
once() )
1408 ->method(
'affectedRows' )
1412 $mockCache->expects( $this->never() )->method(
'get' );
1413 $mockCache->expects( $this->
once() )
1414 ->method(
'delete' )
1416 [
'0:SomeDbKey:1' ],
1427 $titleValue =
new TitleValue( 0,
'SomeDbKey' );
1429 $store->removeWatch(
1430 $this->getMockNonAnonUserWithId( 1 ),
1431 Title::newFromTitleValue( $titleValue )
1438 $mockDb->expects( $this->never() )
1439 ->method(
'delete' );
1442 $mockCache->expects( $this->never() )->method(
'get' );
1443 $mockCache->expects( $this->never() )
1444 ->method(
'delete' );
1454 $store->removeWatch(
1455 $this->getAnonUser(),
1463 $mockDb->expects( $this->
once() )
1464 ->method(
'selectRow' )
1467 'wl_notificationtimestamp',
1470 'wl_namespace' => 0,
1471 'wl_title' =>
'SomeDbKey',
1475 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'20151212010101' ] )
1479 $mockCache->expects( $this->never() )->method(
'delete' );
1480 $mockCache->expects( $this->
once() )
1486 $mockCache->expects( $this->
once() )
1499 $watchedItem = $store->getWatchedItem(
1504 $this->
assertEquals( 1, $watchedItem->getUser()->getId() );
1505 $this->
assertEquals(
'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
1506 $this->
assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
1511 $mockDb->expects( $this->never() )
1512 ->method(
'selectRow' );
1515 $linkTarget =
new TitleValue( 0,
'SomeDbKey' );
1516 $cachedItem =
new WatchedItem( $mockUser, $linkTarget,
'20151212010101' );
1519 $mockCache->expects( $this->never() )->method(
'delete' );
1520 $mockCache->expects( $this->never() )->method(
'set' );
1521 $mockCache->expects( $this->
once() )
1537 $store->getWatchedItem(
1546 $mockDb->expects( $this->
once() )
1547 ->method(
'selectRow' )
1550 'wl_notificationtimestamp',
1553 'wl_namespace' => 0,
1554 'wl_title' =>
'SomeDbKey',
1560 $mockCache->expects( $this->never() )->method(
'set' );
1561 $mockCache->expects( $this->never() )->method(
'delete' );
1562 $mockCache->expects( $this->
once() )
1564 ->with(
'0:SomeDbKey:1' )
1575 $store->getWatchedItem(
1576 $this->getMockNonAnonUserWithId( 1 ),
1584 $mockDb->expects( $this->never() )
1585 ->method(
'selectRow' );
1588 $mockCache->expects( $this->never() )->method(
'set' );
1589 $mockCache->expects( $this->never() )->method(
'get' );
1590 $mockCache->expects( $this->never() )->method(
'delete' );
1600 $store->getWatchedItem(
1601 $this->getAnonUser(),
1609 $mockDb->expects( $this->
once() )
1610 ->method(
'select' )
1613 [
'wl_namespace',
'wl_title',
'wl_notificationtimestamp' ],
1618 'wl_namespace' => 0,
1619 'wl_title' =>
'Foo1',
1620 'wl_notificationtimestamp' =>
'20151212010101',
1623 'wl_namespace' => 1,
1624 'wl_title' =>
'Foo2',
1625 'wl_notificationtimestamp' =>
null,
1630 $mockCache->expects( $this->never() )->method(
'delete' );
1631 $mockCache->expects( $this->never() )->method(
'get' );
1632 $mockCache->expects( $this->never() )->method(
'set' );
1642 $watchedItems = $store->getWatchedItemsForUser( $user );
1646 foreach ( $watchedItems as $watchedItem ) {
1675 $mockDb->expects( $this->
once() )
1676 ->method(
'select' )
1679 [
'wl_namespace',
'wl_title',
'wl_notificationtimestamp' ],
1681 $this->
isType(
'string' ),
1682 [
'ORDER BY' => [
'wl_namespace ASC',
'wl_title ASC' ] ]
1693 $watchedItems = $store->getWatchedItemsForUser(
1709 $store->getWatchedItemsForUser(
1717 $mockDb->expects( $this->
once() )
1718 ->method(
'selectRow' )
1721 'wl_notificationtimestamp',
1724 'wl_namespace' => 0,
1725 'wl_title' =>
'SomeDbKey',
1729 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'20151212010101' ] )
1733 $mockCache->expects( $this->never() )->method(
'delete' );
1734 $mockCache->expects( $this->
once() )
1736 ->with(
'0:SomeDbKey:1' )
1738 $mockCache->expects( $this->
once() )
1753 $this->getMockNonAnonUserWithId( 1 ),
1761 $mockDb->expects( $this->
once() )
1762 ->method(
'selectRow' )
1765 'wl_notificationtimestamp',
1768 'wl_namespace' => 0,
1769 'wl_title' =>
'SomeDbKey',
1775 $mockCache->expects( $this->never() )->method(
'set' );
1776 $mockCache->expects( $this->never() )->method(
'delete' );
1777 $mockCache->expects( $this->
once() )
1779 ->with(
'0:SomeDbKey:1' )
1791 $this->getMockNonAnonUserWithId( 1 ),
1799 $mockDb->expects( $this->never() )
1800 ->method(
'selectRow' );
1803 $mockCache->expects( $this->never() )->method(
'set' );
1804 $mockCache->expects( $this->never() )->method(
'get' );
1805 $mockCache->expects( $this->never() )->method(
'delete' );
1816 $this->getAnonUser(),
1831 'wl_namespace' =>
'0',
1832 'wl_title' =>
'SomeDbKey',
1833 'wl_notificationtimestamp' =>
'20151212010101',
1837 'wl_namespace' =>
'1',
1838 'wl_title' =>
'AnotherDbKey',
1839 'wl_notificationtimestamp' =>
null,
1844 $mockDb->expects( $this->
once() )
1845 ->method(
'makeWhereFrom2d' )
1847 [ [
'SomeDbKey' => 1 ], [
'AnotherDbKey' => 1 ] ],
1848 $this->
isType(
'string' ),
1849 $this->
isType(
'string' )
1851 ->will( $this->
returnValue(
'makeWhereFrom2d return value' ) );
1852 $mockDb->expects( $this->
once() )
1853 ->method(
'select' )
1856 [
'wl_namespace',
'wl_title',
'wl_notificationtimestamp' ],
1858 'makeWhereFrom2d return value',
1861 $this->
isType(
'string' )
1866 $mockCache->expects( $this->
exactly( 2 ) )
1869 [
'0:SomeDbKey:1' ],
1870 [
'1:AnotherDbKey:1' ]
1873 $mockCache->expects( $this->never() )->method(
'set' );
1874 $mockCache->expects( $this->never() )->method(
'delete' );
1885 0 => [
'SomeDbKey' =>
'20151212010101', ],
1886 1 => [
'AnotherDbKey' =>
null, ],
1888 $store->getNotificationTimestampsBatch( $this->getMockNonAnonUserWithId( 1 ), $targets )
1899 $mockDb->expects( $this->
once() )
1900 ->method(
'makeWhereFrom2d' )
1902 [ [
'OtherDbKey' => 1 ] ],
1903 $this->
isType(
'string' ),
1904 $this->
isType(
'string' )
1906 ->will( $this->
returnValue(
'makeWhereFrom2d return value' ) );
1907 $mockDb->expects( $this->
once() )
1908 ->method(
'select' )
1911 [
'wl_namespace',
'wl_title',
'wl_notificationtimestamp' ],
1913 'makeWhereFrom2d return value',
1916 $this->
isType(
'string' )
1921 $mockCache->expects( $this->
once() )
1923 ->with(
'0:OtherDbKey:1' )
1925 $mockCache->expects( $this->never() )->method(
'set' );
1926 $mockCache->expects( $this->never() )->method(
'delete' );
1937 0 => [
'OtherDbKey' =>
false, ],
1939 $store->getNotificationTimestampsBatch( $this->getMockNonAnonUserWithId( 1 ), $targets )
1950 $cachedItem =
new WatchedItem( $user, $targets[0],
'20151212010101' );
1954 $mockDb->expects( $this->
once() )
1955 ->method(
'makeWhereFrom2d' )
1957 [ 1 => [
'AnotherDbKey' => 1 ] ],
1958 $this->
isType(
'string' ),
1959 $this->
isType(
'string' )
1961 ->will( $this->
returnValue(
'makeWhereFrom2d return value' ) );
1962 $mockDb->expects( $this->
once() )
1963 ->method(
'select' )
1966 [
'wl_namespace',
'wl_title',
'wl_notificationtimestamp' ],
1968 'makeWhereFrom2d return value',
1971 $this->
isType(
'string' )
1975 [
'wl_namespace' =>
'1',
'wl_title' =>
'AnotherDbKey',
'wl_notificationtimestamp' =>
null, ]
1980 $mockCache->expects( $this->
at( 1 ) )
1982 ->with(
'0:SomeDbKey:1' )
1984 $mockCache->expects( $this->
at( 3 ) )
1986 ->with(
'1:AnotherDbKey:1' )
1988 $mockCache->expects( $this->never() )->method(
'set' );
1989 $mockCache->expects( $this->never() )->method(
'delete' );
2000 0 => [
'SomeDbKey' =>
'20151212010101', ],
2001 1 => [
'AnotherDbKey' =>
null, ],
2003 $store->getNotificationTimestampsBatch( $user, $targets )
2015 new WatchedItem( $user, $targets[0],
'20151212010101' ),
2019 $mockDb->expects( $this->never() )->method( $this->
anything() );
2022 $mockCache->expects( $this->
at( 1 ) )
2024 ->with(
'0:SomeDbKey:1' )
2026 $mockCache->expects( $this->
at( 3 ) )
2028 ->with(
'1:AnotherDbKey:1' )
2030 $mockCache->expects( $this->never() )->method(
'set' );
2031 $mockCache->expects( $this->never() )->method(
'delete' );
2042 0 => [
'SomeDbKey' =>
'20151212010101', ],
2043 1 => [
'AnotherDbKey' =>
null, ],
2045 $store->getNotificationTimestampsBatch( $user, $targets )
2056 $mockDb->expects( $this->never() )->method( $this->
anything() );
2059 $mockCache->expects( $this->never() )->method( $this->
anything() );
2070 0 => [
'SomeDbKey' =>
false, ],
2071 1 => [
'AnotherDbKey' =>
false, ],
2073 $store->getNotificationTimestampsBatch( $this->getAnonUser(), $targets )
2079 $mockDb->expects( $this->never() )
2080 ->method(
'selectRow' );
2083 $mockCache->expects( $this->never() )->method(
'get' );
2084 $mockCache->expects( $this->never() )->method(
'set' );
2085 $mockCache->expects( $this->never() )->method(
'delete' );
2095 $store->resetNotificationTimestamp(
2096 $this->getAnonUser(),
2097 Title::newFromText(
'SomeDbKey' )
2104 $mockDb->expects( $this->
once() )
2105 ->method(
'selectRow' )
2108 'wl_notificationtimestamp',
2111 'wl_namespace' => 0,
2112 'wl_title' =>
'SomeDbKey',
2118 $mockCache->expects( $this->never() )->method(
'get' );
2119 $mockCache->expects( $this->never() )->method(
'set' );
2120 $mockCache->expects( $this->never() )->method(
'delete' );
2130 $store->resetNotificationTimestamp(
2131 $this->getMockNonAnonUserWithId( 1 ),
2132 Title::newFromText(
'SomeDbKey' )
2139 $title = Title::newFromText(
'SomeDbKey' );
2142 $mockDb->expects( $this->
once() )
2143 ->method(
'selectRow' )
2146 'wl_notificationtimestamp',
2149 'wl_namespace' => 0,
2150 'wl_title' =>
'SomeDbKey',
2154 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'20151212010101' ] )
2158 $mockCache->expects( $this->never() )->method(
'get' );
2159 $mockCache->expects( $this->
once() )
2165 $mockCache->expects( $this->
once() )
2166 ->method(
'delete' )
2167 ->with(
'0:SomeDbKey:1' );
2170 $mockQueueGroup->expects( $this->
once() )
2171 ->method(
'lazyPush' )
2184 $store->resetNotificationTimestamp(
2193 $title = Title::newFromText(
'SomeDbKey' );
2196 $mockDb->expects( $this->never() )
2197 ->method(
'selectRow' );
2200 $mockCache->expects( $this->never() )->method(
'get' );
2201 $mockCache->expects( $this->never() )->method(
'set' );
2202 $mockCache->expects( $this->
once() )
2203 ->method(
'delete' )
2204 ->with(
'0:SomeDbKey:1' );
2214 $mockQueueGroup->expects( $this->
any() )
2215 ->method(
'lazyPush' )
2221 $store->resetNotificationTimestamp(
2237 $title->expects( $this->
any() )
2238 ->method(
'getText' )
2240 $title->expects( $this->
any() )
2241 ->method(
'getDbKey' )
2243 $title->expects( $this->
any() )
2244 ->method(
'getNamespace' )
2253 callable $notificationTimestampCondition
2258 $jobParams =
$job->getParams();
2260 $this->
assertEquals(
'updateWatchlistNotification', $jobParams[
'type'] );
2262 $this->
assertEquals( $expectedUserId, $jobParams[
'userid'] );
2271 $title->expects( $this->
once() )
2272 ->method(
'getNextRevisionID' )
2277 $mockDb->expects( $this->never() )
2278 ->method(
'selectRow' );
2281 $mockCache->expects( $this->never() )->method(
'get' );
2282 $mockCache->expects( $this->never() )->method(
'set' );
2283 $mockCache->expects( $this->
once() )
2284 ->method(
'delete' )
2285 ->with(
'0:SomeTitle:1' );
2295 $mockQueueGroup->expects( $this->
any() )
2296 ->method(
'lazyPush' )
2304 return $time ===
null;
2311 $store->resetNotificationTimestamp(
2324 $title->expects( $this->
once() )
2325 ->method(
'getNextRevisionID' )
2330 $mockDb->expects( $this->
once() )
2331 ->method(
'selectRow' )
2334 'wl_notificationtimestamp',
2337 'wl_namespace' => 0,
2338 'wl_title' =>
'SomeDbKey',
2342 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'20151212010101' ] )
2346 $mockCache->expects( $this->never() )->method(
'get' );
2347 $mockCache->expects( $this->
once() )
2349 ->with(
'0:SomeDbKey:1', $this->
isType(
'object' ) );
2350 $mockCache->expects( $this->
once() )
2351 ->method(
'delete' )
2352 ->with(
'0:SomeDbKey:1' );
2362 $mockQueueGroup->expects( $this->
any() )
2363 ->method(
'lazyPush' )
2371 return $time !==
null &&
$time >
'20151212010101';
2377 $getTimestampCallCounter = 0;
2378 $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
2379 function ( $titleParam, $oldidParam )
use ( &$getTimestampCallCounter, $title, $oldid ) {
2380 $getTimestampCallCounter++;
2387 $store->resetNotificationTimestamp(
2396 ScopedCallback::consume( $scopedOverrideRevision );
2403 $title->expects( $this->
once() )
2404 ->method(
'getNextRevisionID' )
2409 $mockDb->expects( $this->
once() )
2410 ->method(
'selectRow' )
2413 'wl_notificationtimestamp',
2416 'wl_namespace' => 0,
2417 'wl_title' =>
'SomeDbKey',
2423 $mockCache->expects( $this->never() )->method(
'get' );
2424 $mockCache->expects( $this->never() )->method(
'set' );
2425 $mockCache->expects( $this->
once() )
2426 ->method(
'delete' )
2427 ->with(
'0:SomeDbKey:1' );
2437 $mockQueueGroup->expects( $this->
any() )
2438 ->method(
'lazyPush' )
2446 return $time ===
null;
2453 $store->resetNotificationTimestamp(
2466 $title->expects( $this->
once() )
2467 ->method(
'getNextRevisionID' )
2472 $mockDb->expects( $this->
once() )
2473 ->method(
'selectRow' )
2476 'wl_notificationtimestamp',
2479 'wl_namespace' => 0,
2480 'wl_title' =>
'SomeDbKey',
2484 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'30151212010101' ] )
2488 $mockCache->expects( $this->never() )->method(
'get' );
2489 $mockCache->expects( $this->
once() )
2491 ->with(
'0:SomeDbKey:1', $this->
isType(
'object' ) );
2492 $mockCache->expects( $this->
once() )
2493 ->method(
'delete' )
2494 ->with(
'0:SomeDbKey:1' );
2504 $mockQueueGroup->expects( $this->
any() )
2505 ->method(
'lazyPush' )
2513 return $time ===
'30151212010101';
2519 $getTimestampCallCounter = 0;
2520 $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
2521 function ( $titleParam, $oldidParam )
use ( &$getTimestampCallCounter, $title, $oldid ) {
2522 $getTimestampCallCounter++;
2529 $store->resetNotificationTimestamp(
2538 ScopedCallback::consume( $scopedOverrideRevision );
2545 $title->expects( $this->
once() )
2546 ->method(
'getNextRevisionID' )
2551 $mockDb->expects( $this->
once() )
2552 ->method(
'selectRow' )
2555 'wl_notificationtimestamp',
2558 'wl_namespace' => 0,
2559 'wl_title' =>
'SomeDbKey',
2563 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'30151212010101' ] )
2567 $mockCache->expects( $this->never() )->method(
'get' );
2568 $mockCache->expects( $this->
once() )
2570 ->with(
'0:SomeDbKey:1', $this->
isType(
'object' ) );
2571 $mockCache->expects( $this->
once() )
2572 ->method(
'delete' )
2573 ->with(
'0:SomeDbKey:1' );
2583 $mockQueueGroup->expects( $this->
any() )
2584 ->method(
'lazyPush' )
2592 return $time ===
false;
2598 $getTimestampCallCounter = 0;
2599 $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
2600 function ( $titleParam, $oldidParam )
use ( &$getTimestampCallCounter, $title, $oldid ) {
2601 $getTimestampCallCounter++;
2608 $store->resetNotificationTimestamp(
2617 ScopedCallback::consume( $scopedOverrideRevision );
2627 $this->
assertFalse( $store->setNotificationTimestampsForUser( $this->getAnonUser(),
'' ) );
2632 $timestamp =
'20100101010101';
2642 $callableCallCounter = 0;
2643 $mockCallback =
function ( $callable ) use ( &$callableCallCounter ) {
2644 $callableCallCounter++;
2647 $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback( $mockCallback );
2650 $store->setNotificationTimestampsForUser( $user, $timestamp )
2667 $callableCallCounter = 0;
2668 $mockCallback =
function ( $callable ) use ( &$callableCallCounter ) {
2669 $callableCallCounter++;
2672 $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback( $mockCallback );
2675 $store->setNotificationTimestampsForUser( $user, $timestamp )
2681 $timestamp =
'20100101010101';
2685 $mockDb->expects( $this->
once() )
2686 ->method(
'update' )
2689 [
'wl_notificationtimestamp' =>
'TS' . $timestamp .
'TS' ],
2690 [
'wl_user' => 1,
'wl_namespace' => 0,
'wl_title' => [
'Foo',
'Bar' ] ]
2693 $mockDb->expects( $this->
exactly( 1 ) )
2694 ->method(
'timestamp' )
2696 return 'TS' .
$value .
'TS';
2698 $mockDb->expects( $this->
once() )
2699 ->method(
'affectedRows' )
2710 $store->setNotificationTimestampsForUser( $user, $timestamp, $targets )
2716 $mockDb->expects( $this->
once() )
2717 ->method(
'selectFieldValues' )
2723 'wl_namespace' => 0,
2724 'wl_title' =>
'SomeDbKey',
2725 'wl_notificationtimestamp IS NULL'
2729 $mockDb->expects( $this->
once() )
2730 ->method(
'update' )
2733 [
'wl_notificationtimestamp' =>
null ],
2735 'wl_user' => [ 2, 3 ],
2736 'wl_namespace' => 0,
2737 'wl_title' =>
'SomeDbKey',
2742 $mockCache->expects( $this->never() )->method(
'set' );
2743 $mockCache->expects( $this->never() )->method(
'get' );
2744 $mockCache->expects( $this->never() )->method(
'delete' );
2755 $store->updateNotificationTimestamp(
2756 $this->getMockNonAnonUserWithId( 1 ),
2765 $mockDb->expects( $this->
once() )
2766 ->method(
'selectFieldValues' )
2772 'wl_namespace' => 0,
2773 'wl_title' =>
'SomeDbKey',
2774 'wl_notificationtimestamp IS NULL'
2780 $mockDb->expects( $this->never() )
2781 ->method(
'update' );
2784 $mockCache->expects( $this->never() )->method(
'set' );
2785 $mockCache->expects( $this->never() )->method(
'get' );
2786 $mockCache->expects( $this->never() )->method(
'delete' );
2795 $watchers = $store->updateNotificationTimestamp(
2806 $titleValue =
new TitleValue( 0,
'SomeDbKey' );
2809 $mockDb->expects( $this->
once() )
2810 ->method(
'selectRow' )
2812 $this->
getFakeRow( [
'wl_notificationtimestamp' =>
'20151212010101' ] )
2814 $mockDb->expects( $this->
once() )
2815 ->method(
'selectFieldValues' )
2819 $mockDb->expects( $this->
once() )
2820 ->method(
'update' );
2823 $mockCache->expects( $this->
once() )
2825 ->with(
'0:SomeDbKey:1', $this->
isType(
'object' ) );
2826 $mockCache->expects( $this->
once() )
2828 ->with(
'0:SomeDbKey:1' );
2829 $mockCache->expects( $this->
once() )
2830 ->method(
'delete' )
2831 ->with(
'0:SomeDbKey:1' );
2841 $store->getWatchedItem( $user, $titleValue );
2843 $store->updateNotificationTimestamp(
</td >< td > &</td >< td > t want your writing to be edited mercilessly and redistributed at will
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
Job for updating user activity like "last viewed" timestamps.
Simple store for keeping values in an associative array for the current process.
Class to handle enqueueing of background jobs.
Class to both describe a background job and handle jobs.
A service class for fetching the wiki's current read-only mode.
Represents a page (or page fragment) title within MediaWiki.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
testLoadWatchedItem_anonymousUser()
testLoadWatchedItem_noItem()
testCountWatchersMultiple_withMinimumWatchers( $minWatchers)
provideIntWithDbUnsafeVersion
testDuplicateAllAssociatedEntries_somethingToDuplicate(LinkTarget $oldTarget, LinkTarget $newTarget)
provideLinkTargetPairs
testIsWatchedItem_existingItem()
testGetNotificationTimestampsBatch_cachedItem()
getMockTitle( $text, $ns=0)
testDuplicateEntry_somethingToDuplicate()
testSetNotificationTimestampsForUser_nullTimestamp()
testGetWatchedItem_noItem()
getFakeRow(array $rowValues)
testCountVisitingWatchers()
testGetNotificationTimestampsBatch_anonymousUser()
testCountUnreadNotifications_withUnreadLimit_overLimit( $limit)
provideIntWithDbUnsafeVersion
testCountUnreadNotifications()
testIsWatchedItem_anonymousUser()
testGetWatchedItem_cachedItem()
testCountUnreadNotifications_withUnreadLimit_underLimit( $limit)
provideIntWithDbUnsafeVersion
testGetNotificationTimestampsBatch_notWatchedTarget()
testUpdateNotificationTimestamp_noWatchers()
testAddWatchBatchForUser_nonAnonymousUser()
testAddWatch_anonymousUser()
testCountVisitingWatchersMultiple_withMissingTargets()
testCountWatchersMultiple()
testResetNotificationTimestamp_oldidSpecifiedLatestRevisionForced()
testRemoveWatch_anonymousUser()
newWatchedItemStore(LBFactory $lbFactory, JobQueueGroup $queueGroup, HashBagOStuff $cache, ReadOnlyMode $readOnlyMode)
testSetNotificationTimestampsForUser_allRows()
testResetNotificationTimestamp_item()
testGetNotificationTimestampsBatch_allItemsCached()
testResetNotificationTimestamp_oldidSpecifiedNotLatestRevisionForced()
testDuplicateAllAssociatedEntries_nothingToDuplicate()
testResetNotificationTimestamp_noItem()
testUpdateNotificationTimestamp_watchersExist()
testAddWatchBatchForUser_anonymousUsersAreSkipped()
getMockNonAnonUserWithId( $id)
testAddWatchBatchReturnsTrue_whenGivenEmptyList()
getMockLoadBalancer( $mockDb, $expectedConnectionType=null)
testAddWatch_nonAnonymousUser()
testSetNotificationTimestampsForUser_specificTargets()
testResetNotificationTimestamp_anonymousUser()
testSetNotificationTimestampsForUser_anonUser()
testUpdateNotificationTimestamp_clearsCachedItems()
testGetWatchedItemsForUser_badSortOptionThrowsException()
testResetNotificationTimestamp_notWatchedPageForced()
testGetNotificationTimestampsBatch()
testGetWatchedItemsForUser_optionsAndEmptyResult( $forWrite, $dbType)
provideDbTypes
testClearWatchedItems_tooManyItemsWatched()
testGetWatchedItem_anonymousUser()
getMockReadOnlyMode( $readOnly=false)
testRemoveWatch_existingItem()
testDuplicateEntry_nothingToDuplicate()
testLoadWatchedItem_existingItem()
testCountVisitingWatchersMultiple()
testResetNotificationTimestamp_noItemForced()
testResetNotificationTimestamp_futureNotificationTimestampForced()
testGetWatchedItem_existingItem()
getMockLBFactory( $mockDb, $expectedConnectionType=null)
verifyCallbackJob(ActivityUpdateJob $job, LinkTarget $expectedTitle, $expectedUserId, callable $notificationTimestampCondition)
testResetNotificationTimestamp_futureNotificationTimestampNotForced()
testAddWatchBatchForUser_readOnlyDBReturnsFalse()
testGetWatchedItemsForUser()
provideIntWithDbUnsafeVersion()
testIsWatchedItem_noItem()
testCountVisitingWatchersMultiple_withMinimumWatchers( $minWatchers)
provideIntWithDbUnsafeVersion
Storage layer class for WatchedItems.
Representation of a pair of user and title for watchlist entries.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break anything
see documentation in includes Linker php for Linker::makeImageLink & $time
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback function
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(count( $args)< 1) $job