Skip to content

Conversation

@Designburo
Copy link
Collaborator

…l API call in 2.7.x

@Designburo Designburo self-assigned this Jan 14, 2026
Comment on lines 18 to 19
// TODO: Rewrite this to be an proper API call for version 2.7.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget this, as the current implementation is rather hacky.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep planned for next week

$ret,
JSON_PRETTY_PRINT
);
$database = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_PRIMARY );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using dependency injection instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do with the rewrite.

try {
$database->commit(
__METHOD__,
IDatabase::FLUSHING_INTERNAL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is FLUSHING_INTERNAL used instead of FLUSHING_ONE?

"format" => "json",
"query" => $query
] );
$data = $api->apiPost( $postdata, true );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does $api come from?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when a user visits this file directly from the browser? Why isn't this a proper API module?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first comment was : TODO: Rewrite this to be an proper API call for version 2.7.0. This has been done

Comment on lines 221 to 224
return json_encode(
$ret,
JSON_PRETTY_PRINT
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code

Comment on lines 199 to 203
if ( $wgScriptPath !== "" ) {
$smwQueryUrl = "/" . ltrim( $wgScriptPath, '/' ) . '/index.php/Special:FlexForm';
$smwQueryUrl = "/" . ltrim( $wgScriptPath, '/' ) . '/api.php';
} else {
$smwQueryUrl = '/index.php/Special:FlexForm';
$smwQueryUrl = '/api.php';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just:

$smwQueryUrl = '/' . $wgScriptPath . 'api.php';

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have seen to many variations in $wgScriptPath to trust it to start with "/" or not

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks very similar to the code in the SemanticAsk class.

Copy link
Collaborator Author

@Designburo Designburo Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SemanticAsk classes will be removed

@Designburo Designburo marked this pull request as draft January 21, 2026 12:52
@Designburo Designburo marked this pull request as ready for review January 21, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants