-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update for MediaWiki 1.42 and use virtual domain #99
Conversation
70dd376
to
20fae9f
Compare
@coderabbitai review |
Actions PerformedReview triggered.
|
WalkthroughThe recent updates involve upgrading MediaWiki from version 1.41 to 1.42, along with refactoring dependencies across various files. Notable changes include transitioning from Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (18)
- .github/workflows/mediawiki-tests.yml (1 hunks)
- extension.json (6 hunks)
- includes/Hooks/Handlers/Installer.php (1 hunks)
- includes/Hooks/Handlers/Main.php (4 hunks)
- includes/ImportDumpOOUIForm.php (1 hunks)
- includes/ImportDumpRequestManager.php (5 hunks)
- includes/ImportDumpRequestQueuePager.php (4 hunks)
- includes/ImportDumpRequestViewer.php (4 hunks)
- includes/Jobs/ImportDumpJob.php (4 hunks)
- includes/Jobs/ImportDumpNotifyJob.php (1 hunks)
- includes/Notifications/EchoImportFailedPresentationModel.php (1 hunks)
- includes/Notifications/EchoNewRequestPresentationModel.php (1 hunks)
- includes/Notifications/EchoRequestCommentPresentationModel.php (1 hunks)
- includes/Notifications/EchoRequestStatusUpdatePresentationModel.php (1 hunks)
- includes/ServiceWiring.php (2 hunks)
- includes/Specials/SpecialRequestImport.php (4 hunks)
- includes/Specials/SpecialRequestImportQueue.php (2 hunks)
- tests/phpunit/ImportDumpRequestManagerTest.php (2 hunks)
Files skipped from review due to trivial changes (9)
- .github/workflows/mediawiki-tests.yml
- includes/Hooks/Handlers/Installer.php
- includes/ImportDumpOOUIForm.php
- includes/Jobs/ImportDumpNotifyJob.php
- includes/Notifications/EchoImportFailedPresentationModel.php
- includes/Notifications/EchoNewRequestPresentationModel.php
- includes/Notifications/EchoRequestCommentPresentationModel.php
- includes/Notifications/EchoRequestStatusUpdatePresentationModel.php
- includes/Specials/SpecialRequestImportQueue.php
Additional comments not posted (19)
includes/ServiceWiring.php (1)
14-14
: Change fromDBLoadBalancerFactory
toConnectionProvider
aligns with the PR's objectives for dependency updates.Verification successful
The search results indicate that
ConnectionProvider
is being used across the codebase, replacingDBLoadBalancerFactory
. Here are the files whereConnectionProvider
is used:
tests/phpunit/ImportDumpRequestManagerTest.php
includes/ServiceWiring.php
includes/ImportDumpRequestManager.php
includes/ImportDumpRequestQueuePager.php
includes/Specials/SpecialRequestImportQueue.php
includes/Specials/SpecialRequestImport.php
includes/Jobs/ImportDumpJob.php
includes/Hooks/Handlers/Main.php
This confirms that the dependency update has been applied consistently.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that `ConnectionProvider` is properly used in place of `DBLoadBalancerFactory` across the codebase. # Test: Search for the old dependency usage. Expect: No occurrences of `DBLoadBalancerFactory`. rg --type php 'DBLoadBalancerFactory'Length of output: 37
Script:
#!/bin/bash # Description: Verify that `ConnectionProvider` is properly used across the codebase. # Test: Search for the new dependency usage. Expect: Occurrences of `ConnectionProvider`. rg --type php 'ConnectionProvider'Length of output: 2131
tests/phpunit/ImportDumpRequestManagerTest.php (1)
17-37
: Implementation ofImportDumpStatus
and updates to test setup are appropriate and align with the main codebase changes.includes/ImportDumpRequestQueuePager.php (1)
50-50
: Updated database connection handling usingConnectionProvider
is correctly implemented.includes/Hooks/Handlers/Main.php (1)
Line range hint
29-48
: Constructor and method updates to useConnectionProvider
are correctly implemented, ensuring compatibility with the new MediaWiki version.extension.json (1)
10-10
: Updates to the MediaWiki version requirement and service configurations inextension.json
are correctly implemented.Also applies to: 32-114, 158-158
Verification successful
The
onLoginFormValidErrorMessages
method in theMain
class correctly implements theLoginFormValidErrorMessagesHook
interface. No compatibility issues were found with the new MediaWiki version.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the extension functions correctly with the new MediaWiki version and dependencies. # Test: Check for any compatibility issues reported in logs. rg --type json 'MediaWiki' | grep 'Error'Length of output: 39
Script:
#!/bin/bash # Description: Verify that the extension functions correctly with the new MediaWiki version and dependencies. # Test: Check for any compatibility issues reported in logs or other relevant files. rg 'MediaWiki' | grep -i 'error\|warning'Length of output: 126
Script:
#!/bin/bash # Description: Extract the relevant lines around the `LoginFormValidErrorMessagesHook` usage in `includes/Hooks/Handlers/Main.php`. # Extract lines around the reference to `LoginFormValidErrorMessagesHook`. rg --context 5 'LoginFormValidErrorMessagesHook' includes/Hooks/Handlers/Main.phpLength of output: 931
Script:
#!/bin/bash # Description: Extract the implementation of the `LoginFormValidErrorMessagesHook` interface in the `Main` class. # Extract the implementation of the `LoginFormValidErrorMessagesHook` interface. ast-grep --lang php --pattern 'class Main implements LoginFormValidErrorMessagesHook { $$$ }' includes/Hooks/Handlers/Main.phpLength of output: 235
Script:
#!/bin/bash # Description: Extract the implementation of the `LoginFormValidErrorMessagesHook` interface in the `Main` class. # Extract method implementations in the `Main` class. rg --pcre2 --context 10 'class Main.*\{|\bfunction\b' includes/Hooks/Handlers/Main.phpLength of output: 1657
includes/Jobs/ImportDumpJob.php (1)
Line range hint
12-133
: Constructor and import method updates inImportDumpJob
are correctly implemented, ensuring compatibility with the new MediaWiki version.includes/Specials/SpecialRequestImport.php (1)
Line range hint
12-197
: Constructor and method updates inSpecialRequestImport
are correctly implemented, ensuring compatibility with the new MediaWiki version.Also applies to: 390-406
includes/ImportDumpRequestManager.php (4)
15-15
: Added import forMediaWiki\Message\Message
.This change aligns with the PR's objective to update namespace usage across the project for better maintainability and compatibility with MediaWiki 1.42.
138-138
: Updated database connection logic to useIConnectionProvider
.This change is part of the dependency refactoring to replace
DBLoadBalancerFactory
withConnectionProvider
. It ensures that the class uses the updated dependency correctly.
310-310
: RefactoredinsertInterwikiPrefix
to use the new database connection method.This update is consistent with the overall PR's goal of dependency refactoring. It correctly utilizes the new
IConnectionProvider
interface for database operations, enhancing maintainability.
360-360
: EnhancedgetInterwikiPrefix
to use the new database connection method.This modification is part of the dependency refactoring, ensuring that the method uses the updated
IConnectionProvider
interface. It's a good practice to keep the database interaction methods consistent across the class.includes/ImportDumpRequestViewer.php (8)
6-6
: Namespace adjustment forIContextSource
is correct and aligns with the PR objectives.
8-8
: Namespace adjustment forHTMLForm
is correct and aligns with the PR objectives.
11-11
: Namespace adjustment forMessage
is correct and aligns with the PR objectives.
449-453
: The validation methodisValidComment
correctly checks for empty or whitespace-only comments. This is a good practice to ensure meaningful user input.
461-465
: The validation methodisValidDatabase
correctly checks if the provided database target is in the list of local databases. This is crucial for ensuring that operations are performed on valid databases.
473-477
: The validation methodisValidReason
correctly checks for empty or whitespace-only reasons. This is important for ensuring that reasons provided are meaningful and not just blank inputs.
486-490
: The validation methodisValidInterwikiPrefix
correctly checks for empty or whitespace-only interwiki prefixes. This ensures that the prefixes used are valid and meaningful.
499-514
: The validation methodisValidInterwikiUrl
correctly checks for empty or whitespace-only URLs and validates the URL structure. This is crucial for ensuring that the URLs used are valid and properly formatted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- includes/ImportDumpRequestViewer.php (4 hunks)
- includes/Specials/SpecialRequestImport.php (4 hunks)
Files skipped from review as they are similar to previous changes (2)
- includes/ImportDumpRequestViewer.php
- includes/Specials/SpecialRequestImport.php
P.S. I deleted comments below to clean up this PR, but they were related to creating SpecialRequestImportTest --@Universal-Omega
@coderabbitai review |
Actions PerformedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- includes/Hooks/Handlers/Main.php (4 hunks)
- includes/Jobs/ImportDumpJob.php (4 hunks)
- includes/Specials/SpecialRequestImport.php (4 hunks)
- tests/phpunit/SpecialRequestImportTest.php (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- includes/Hooks/Handlers/Main.php
- includes/Jobs/ImportDumpJob.php
- includes/Specials/SpecialRequestImport.php
Additional Context Used
Path-based Instructions (1)
tests/phpunit/SpecialRequestImportTest.php (1)
Pattern
**/*.php
: Follow MediaWiki PHP Coding Standards:Indentation:
- Use tabs for indentation, not spaces.
Spaces:
- Use spaces on either side of binary operators.
Example: $a = $b + $c; (Correct) $a=$b+$c; (Incorrect)- Add spaces inside parentheses, except where they are empty.
Example: $a = getFoo( $b ); (Correct) $a = getFoo($b); (Incorrect)- Do not add a space after a function name.
Example: $c = getBar(); (Correct) $c = getBar (); (Incorrect)Function Return Type Hint:
- Add a space after the colon in the function return type hint.
Example: function square( int $x ): int { return $x * $x; }Arrays:
- Use spaces in brackets when declaring an array, except where the array is empty.
Example: $a = [ 'foo', 'bar' ]; (Correct) $a = ['foo', 'bar']; (Incorrect)- Do not put spaces in brackets when accessing array elements.
Example: $c = $a[0]; (Correct) $c = $a[ 0 ]; (Incorrect)Control Structures:
- Add a space after control structure keywords.
Example: if ( isFoo() ) { ... } (Correct) if(isFoo()){ ... } (Incorrect)Type Casting:
- Do not use a space within or after the cast operator.
Example: (int)$foo; (Correct) (int) $bar; (Incorrect)Comments:
- In comments, there should be one space between the # or // and the comment text.
Example: // This is a comment. (Correct) //This is a comment. (Incorrect)Ternary Operator:
- Keep ternary operator expressions short and obvious.
- For multi-line ternary expressions, place the '?' and ':' at the beginning of the new lines.
File Formatting:
- Avoid trailing whitespace on lines.
Learnings (1)
tests/phpunit/SpecialRequestImportTest.php (2)
User: Universal-Omega PR: miraheze/ImportDump#99 File: includes/Specials/SpecialRequestImport.php:9-9 Timestamp: 2024-05-18T23:25:00.346Z Learning: When generating unit tests for MediaWiki special pages, use data providers for validation callbacks, add @covers and @group comments, and ensure to mock dependencies like IConnectionProvider, MimeAnalyzer, PermissionManager, RepoGroup, and UserFactory.
User: Universal-Omega PR: miraheze/ImportDump#99 File: includes/Specials/SpecialRequestImport.php:9-9 Timestamp: 2024-05-18T23:09:23.415Z Learning: When generating unit tests for MediaWiki special pages, ensure to mock dependencies like IConnectionProvider, MimeAnalyzer, PermissionManager, RepoGroup, and UserFactory.
Additional comments not posted (12)
tests/phpunit/SpecialRequestImportTest.php (12)
29-44
: Setup method correctly initializes dependencies forSpecialRequestImport
.
46-51
: Cleanup process in tearDown method is implemented correctly.
57-59
: Constructor test correctly verifies object instantiation.
64-75
: Execution test method is thorough and correctly tests the behavior ofSpecialRequestImport
.
80-84
: Logged out test correctly expects an exception, ensuring proper access control.
90-129
: Submission test method is well-structured and effectively uses a data provider to test various scenarios.
136-158
: Data provider for onSubmit test method correctly supplies both valid and invalid scenarios.
164-211
: Duplicate submission test method correctly ensures that duplicates are detected and handled appropriately.
217-223
: Database validation test method correctly uses a data provider to test various scenarios.
231-235
: Data provider for isValidDatabase test method correctly supplies both valid and invalid scenarios.
242-248
: Reason validation test method correctly uses a data provider to test various scenarios.
256-260
: Data provider for isValidReason test method correctly supplies both valid and invalid scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- tests/phpunit/SpecialRequestImportTest.php (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- tests/phpunit/SpecialRequestImportTest.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- tests/phpunit/ImportDumpRequestManagerTest.php (4 hunks)
- tests/phpunit/SpecialRequestImportTest.php (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- tests/phpunit/ImportDumpRequestManagerTest.php
Additional Context Used
Path-based Instructions (1)
tests/phpunit/SpecialRequestImportTest.php (1)
Pattern
**/*.php
: Follow MediaWiki PHP Coding Standards:Indentation:
- Use tabs for indentation, not spaces.
Spaces:
- Use spaces on either side of binary operators.
Example: $a = $b + $c; (Correct) $a=$b+$c; (Incorrect)- Add spaces inside parentheses, except where they are empty.
Example: $a = getFoo( $b ); (Correct) $a = getFoo($b); (Incorrect)- Do not add a space after a function name.
Example: $c = getBar(); (Correct) $c = getBar (); (Incorrect)Function Return Type Hint:
- Add a space after the colon in the function return type hint.
Example: function square( int $x ): int { return $x * $x; }Arrays:
- Use spaces in brackets when declaring an array, except where the array is empty.
Example: $a = [ 'foo', 'bar' ]; (Correct) $a = ['foo', 'bar']; (Incorrect)- Do not put spaces in brackets when accessing array elements.
Example: $c = $a[0]; (Correct) $c = $a[ 0 ]; (Incorrect)Control Structures:
- Add a space after control structure keywords.
Example: if ( isFoo() ) { ... } (Correct) if(isFoo()){ ... } (Incorrect)Type Casting:
- Do not use a space within or after the cast operator.
Example: (int)$foo; (Correct) (int) $bar; (Incorrect)Comments:
- In comments, there should be one space between the # or // and the comment text.
Example: // This is a comment. (Correct) //This is a comment. (Incorrect)Ternary Operator:
- Keep ternary operator expressions short and obvious.
- For multi-line ternary expressions, place the '?' and ':' at the beginning of the new lines.
File Formatting:
- Avoid trailing whitespace on lines.
Learnings (1)
tests/phpunit/SpecialRequestImportTest.php (2)
User: Universal-Omega PR: miraheze/ImportDump#99 File: includes/Specials/SpecialRequestImport.php:9-9 Timestamp: 2024-05-18T23:25:00.346Z Learning: When generating unit tests for MediaWiki special pages, use data providers for validation callbacks, add @covers and @group comments, and ensure to mock dependencies like IConnectionProvider, MimeAnalyzer, PermissionManager, RepoGroup, and UserFactory.
User: Universal-Omega PR: miraheze/ImportDump#99 File: includes/Specials/SpecialRequestImport.php:9-9 Timestamp: 2024-05-18T23:09:23.415Z Learning: When generating unit tests for MediaWiki special pages, ensure to mock dependencies like IConnectionProvider, MimeAnalyzer, PermissionManager, RepoGroup, and UserFactory.
Additional comments not posted (12)
tests/phpunit/SpecialRequestImportTest.php (12)
35-44
: Constructor setup correctly initializesSpecialRequestImport
with necessary dependencies.
47-54
:setUp
method correctly configures global settings and initializes the test object.
57-60
:tearDown
method correctly handles cleanup of test resources.
68-69
:testConstructor
correctly verifies the object type ofspecialRequestImport
.
75-78
:testExecute
method correctly simulates the special page execution and verifies the output.
84-86
:testExecuteNotLoggedIn
correctly handles the scenario where a user is not logged in.
93-140
:testOnSubmit
method and its data provider correctly test the form submission logic with various scenarios.
235-241
:testIsValidDatabase
method and its data provider correctly test the database validation logic.
258-263
:testIsValidReason
method and its data provider correctly test the reason validation logic.
280-316
:testGetFormFields
method correctly tests the form fields generated by the special page under various configurations.
322-331
:testCheckPermissions
method correctly tests the permission checking logic of the special page.
337-339
:testGetLogType
method correctly retrieves the log type associated with the special page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (19)
- .github/workflows/mediawiki-tests.yml (1 hunks)
- extension.json (6 hunks)
- includes/Hooks/Handlers/Installer.php (1 hunks)
- includes/Hooks/Handlers/Main.php (4 hunks)
- includes/ImportDumpOOUIForm.php (1 hunks)
- includes/ImportDumpRequestManager.php (5 hunks)
- includes/ImportDumpRequestQueuePager.php (4 hunks)
- includes/ImportDumpRequestViewer.php (4 hunks)
- includes/Jobs/ImportDumpJob.php (4 hunks)
- includes/Jobs/ImportDumpNotifyJob.php (1 hunks)
- includes/Notifications/EchoImportFailedPresentationModel.php (1 hunks)
- includes/Notifications/EchoNewRequestPresentationModel.php (1 hunks)
- includes/Notifications/EchoRequestCommentPresentationModel.php (1 hunks)
- includes/Notifications/EchoRequestStatusUpdatePresentationModel.php (1 hunks)
- includes/ServiceWiring.php (2 hunks)
- includes/Specials/SpecialRequestImport.php (4 hunks)
- includes/Specials/SpecialRequestImportQueue.php (2 hunks)
- tests/phpunit/ImportDumpRequestManagerTest.php (4 hunks)
- tests/phpunit/SpecialRequestImportTest.php (1 hunks)
Files skipped from review as they are similar to previous changes (19)
- .github/workflows/mediawiki-tests.yml
- extension.json
- includes/Hooks/Handlers/Installer.php
- includes/Hooks/Handlers/Main.php
- includes/ImportDumpOOUIForm.php
- includes/ImportDumpRequestManager.php
- includes/ImportDumpRequestQueuePager.php
- includes/ImportDumpRequestViewer.php
- includes/Jobs/ImportDumpJob.php
- includes/Jobs/ImportDumpNotifyJob.php
- includes/Notifications/EchoImportFailedPresentationModel.php
- includes/Notifications/EchoNewRequestPresentationModel.php
- includes/Notifications/EchoRequestCommentPresentationModel.php
- includes/Notifications/EchoRequestStatusUpdatePresentationModel.php
- includes/ServiceWiring.php
- includes/Specials/SpecialRequestImport.php
- includes/Specials/SpecialRequestImportQueue.php
- tests/phpunit/ImportDumpRequestManagerTest.php
- tests/phpunit/SpecialRequestImportTest.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- tests/phpunit/Specials/SpecialRequestImportTest.php (1 hunks)
Additional Context Used
Path-based Instructions (1)
tests/phpunit/Specials/SpecialRequestImportTest.php (1)
Pattern
**/*.php
: Follow MediaWiki PHP Coding Standards:Indentation:
- Use tabs for indentation, not spaces.
Spaces:
- Use spaces on either side of binary operators.
Example: $a = $b + $c; (Correct) $a=$b+$c; (Incorrect)- Add spaces inside parentheses, except where they are empty.
Example: $a = getFoo( $b ); (Correct) $a = getFoo($b); (Incorrect)- Do not add a space after a function name.
Example: $c = getBar(); (Correct) $c = getBar (); (Incorrect)Function Return Type Hint:
- Add a space after the colon in the function return type hint.
Example: function square( int $x ): int { return $x * $x; }Arrays:
- Use spaces in brackets when declaring an array, except where the array is empty.
Example: $a = [ 'foo', 'bar' ]; (Correct) $a = ['foo', 'bar']; (Incorrect)- Do not put spaces in brackets when accessing array elements.
Example: $c = $a[0]; (Correct) $c = $a[ 0 ]; (Incorrect)Control Structures:
- Add a space after control structure keywords.
Example: if ( isFoo() ) { ... } (Correct) if(isFoo()){ ... } (Incorrect)Type Casting:
- Do not use a space within or after the cast operator.
Example: (int)$foo; (Correct) (int) $bar; (Incorrect)Comments:
- In comments, there should be one space between the # or // and the comment text.
Example: // This is a comment. (Correct) //This is a comment. (Incorrect)Ternary Operator:
- Keep ternary operator expressions short and obvious.
- For multi-line ternary expressions, place the '?' and ':' at the beginning of the new lines.
File Formatting:
- Avoid trailing whitespace on lines.
Learnings (1)
tests/phpunit/Specials/SpecialRequestImportTest.php (2)
User: Universal-Omega PR: miraheze/ImportDump#99 File: includes/Specials/SpecialRequestImport.php:9-9 Timestamp: 2024-05-18T23:25:00.346Z Learning: When generating unit tests for MediaWiki special pages, use data providers for validation callbacks, add @covers and @group comments, and ensure to mock dependencies like IConnectionProvider, MimeAnalyzer, PermissionManager, RepoGroup, and UserFactory.
User: Universal-Omega PR: miraheze/ImportDump#99 File: includes/Specials/SpecialRequestImport.php:9-9 Timestamp: 2024-05-18T23:09:23.415Z Learning: When generating unit tests for MediaWiki special pages, ensure to mock dependencies like IConnectionProvider, MimeAnalyzer, PermissionManager, RepoGroup, and UserFactory.
Additional comments not posted (14)
tests/phpunit/Specials/SpecialRequestImportTest.php (14)
28-28
: Ensure the class declaration follows MediaWiki PHP coding standards.
35-45
: ThenewSpecialPage
method correctly implements dependency injection for creating theSpecialRequestImport
instance.
47-55
: ThesetUp
method appropriately configures the testing environment and initializes theSpecialRequestImport
instance.
57-63
: ThetearDown
method correctly handles cleanup by removing the test file if it exists, ensuring no side effects between tests.
68-70
: ThetestConstructor
method correctly asserts that thespecialRequestImport
instance is of the expected class.
75-79
: ThetestExecute
method correctly simulates the page execution and checks the output, effectively testing theexecute
method ofSpecialRequestImport
.
84-87
: ThetestExecuteNotLoggedIn
method correctly expects aUserNotLoggedIn
exception, appropriately testing access control in theexecute
method.
93-141
: ThetestOnSubmit
method effectively tests theonSubmit
method ofSpecialRequestImport
using various data scenarios provided byonSubmitDataProvider
. The method setups and assertions are correctly implemented for each scenario.Also applies to: 148-229
235-241
: ThetestIsValidDatabase
method correctly tests theisValidDatabase
method ofSpecialRequestImport
using scenarios provided byisValidDatabaseDataProvider
. The assertions are appropriately implemented for each scenario.Also applies to: 249-252
258-264
: ThetestIsValidReason
method correctly tests theisValidReason
method ofSpecialRequestImport
using scenarios provided byisValidReasonDataProvider
. The assertions are appropriately implemented for each scenario.Also applies to: 272-275
280-317
: ThetestGetFormFields
method correctly tests the form fields returned bygetFormFields
, ensuring that fields are correctly included or excluded based on configuration settings.
322-332
: ThetestCheckPermissions
method correctly tests thecheckPermissions
method ofSpecialRequestImport
, ensuring that it behaves as expected under normal conditions.
337-339
: ThetestGetLogType
method correctly asserts that the log type returned is as expected, ensuring that logging is categorized correctly.
348-353
: ThesetSessionUser
method correctly manipulates the RequestContext and session to set the user, facilitating tests that require user sessions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- includes/ConfigNames.php (1 hunks)
- includes/ImportDumpRequestManager.php (7 hunks)
- includes/ImportDumpRequestViewer.php (8 hunks)
- includes/Jobs/ImportDumpNotifyJob.php (2 hunks)
- includes/Specials/SpecialRequestImport.php (6 hunks)
Files skipped from review due to trivial changes (1)
- includes/ConfigNames.php
Files skipped from review as they are similar to previous changes (3)
- includes/ImportDumpRequestManager.php
- includes/ImportDumpRequestViewer.php
- includes/Jobs/ImportDumpNotifyJob.php
Additional Context Used
Path-based Instructions (1)
includes/Specials/SpecialRequestImport.php (1)
Pattern
**/*.php
: Follow MediaWiki PHP Coding Standards:Indentation:
- Use tabs for indentation, not spaces.
Spaces:
- Use spaces on either side of binary operators.
Example: $a = $b + $c; (Correct) $a=$b+$c; (Incorrect)- Add spaces inside parentheses, except where they are empty.
Example: $a = getFoo( $b ); (Correct) $a = getFoo($b); (Incorrect)- Do not add a space after a function name.
Example: $c = getBar(); (Correct) $c = getBar (); (Incorrect)Function Return Type Hint:
- Add a space after the colon in the function return type hint.
Example: function square( int $x ): int { return $x * $x; }Arrays:
- Use spaces in brackets when declaring an array, except where the array is empty.
Example: $a = [ 'foo', 'bar' ]; (Correct) $a = ['foo', 'bar']; (Incorrect)- Do not put spaces in brackets when accessing array elements.
Example: $c = $a[0]; (Correct) $c = $a[ 0 ]; (Incorrect)Control Structures:
- Add a space after control structure keywords.
Example: if ( isFoo() ) { ... } (Correct) if(isFoo()){ ... } (Incorrect)Type Casting:
- Do not use a space within or after the cast operator.
Example: (int)$foo; (Correct) (int) $bar; (Incorrect)Comments:
- In comments, there should be one space between the # or // and the comment text.
Example: // This is a comment. (Correct) //This is a comment. (Incorrect)Ternary Operator:
- Keep ternary operator expressions short and obvious.
- For multi-line ternary expressions, place the '?' and ':' at the beginning of the new lines.
File Formatting:
- Avoid trailing whitespace on lines.
Additional comments not posted (3)
includes/Specials/SpecialRequestImport.php (3)
12-12
: The new imports and the implementation ofImportDumpStatus
are correctly aligned with the PR's objectives to handle virtual domains and update dependencies.Also applies to: 23-23
88-89
: The modifications in theexecute
method to usegetReplicaDatabase
with a domain and to check the current wiki's domain are well-implemented and necessary for the support of virtual domains.Also applies to: 95-96
198-198
: The changes in theonSubmit
method, including the use ofgetPrimaryDatabase
with a domain, handling of file uploads, and checks for duplicates and valid inputs, are well-implemented and enhance the functionality and security of the import process.Also applies to: 321-321, 357-357, 391-395, 403-407
Also adds new tests for SpecialRequestImport and ImportDumpRequestManager to ensure new DatabaseVirtualDomains handling. It also adds a new ConfigNames class to improve code standards and protect against typos.
This should not be merged until we want to drop MediaWiki 1.41 support.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
DBLoadBalancerFactory
withConnectionProvider
in various classes for more efficient database management.ConfigNames
to facilitate getting configuration options and to protect against typos.Tests
SpecialRequestImport
to ensure robust functionality and reliability.