Skip to content
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

WIP Saying good bye to *_where_sql() functions #11407

Merged
merged 3 commits into from Nov 29, 2017
Merged

WIP Saying good bye to *_where_sql() functions #11407

merged 3 commits into from Nov 29, 2017

Conversation

hypeJunction
Copy link
Contributor

@hypeJunction hypeJunction commented Nov 24, 2017

Needs #11403

  • Add River repository tests
  • Add elgg_get_tags() tests

I am not going to bother with search tests on this. I am going to revive #10688 and add tests there.

foreach ($where as $w) {
$sql .= " $w and ";
}
$options = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need a test here. Should we move this to the blog plugin? I have never used it.

public function buildEntityClauses($qb) {
$ands = [];

$qb->joinEntitiesTable('rv', 'subject_guid', 'inner', 'se');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check if river API allows non-users to be subjects. If not, then we can remove this


return get_data($query);
return \Elgg\Database\Metadata::find($options);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Go back to get_data

@hypeJunction hypeJunction changed the title Saying good bye to *_where_sql() functions WIP Saying good bye to *_where_sql() functions Nov 24, 2017
@jdalsem
Copy link
Member

jdalsem commented Nov 25, 2017

let me know when this is ready for review

@hypeJunction
Copy link
Contributor Author

Not yet, more stuff coming. Hope to get it out of my life later today or tomorrow. Need to get back to real world problems

@hypeJunction
Copy link
Contributor Author

I think I am done here. Should have split this up into multiple PRs, but it was like a roller coaster.

I have added some performance improvements to metadata and annotations, as I have noticed there were a ton of useless queries happening during testing. Notably, metadata cache now cacheds IDs, so we don't have to read them from the database every time metadata is updated or created.

@hypeJunction
Copy link
Contributor Author

This also halves the build time. I simplified unit test entity table mock and stoped querying for active plugins if boot cache is populated

@hypeJunction
Copy link
Contributor Author

Could someone wipe the caches on Travis. I think we are running out of disk space.

@jdalsem
Copy link
Member

jdalsem commented Nov 27, 2017

Could someone wipe the caches on Travis. I think we are running out of disk space.

done... why did you think we ran out of it btw?

@hypeJunction
Copy link
Contributor Author

during one of the builds it failed on multiple boxes with memory error

@@ -203,6 +206,7 @@ Deprecated APIs
* ``elgg_list_entities_from_relationship``: Use ``elgg_list_entities()``
* ``elgg_list_entities_from_private_settings``: Use ``elgg_list_entities()``
* ``elgg_list_entities_from_access_id``: Use ``elgg_list_entities()``
* ``elgg_batch_delete_callback``
Copy link
Member

Choose a reason for hiding this comment

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

why remove this function? It can be helpful sometimes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it creates a anti-pattern. It makes it harder to read the code when used with ElggBatch. I'd rather we write explicit code with object instances that are type hinted.

@hypeJunction
Copy link
Contributor Author

You may want to review and merge this before it goes out of sync. I don't have any more time to invest into this.

Rewrites elgg_get_river(), elgg_get_tags(), search hooks and
other related functions with QueryBuilder.

Optimizes metadata and annotation CRUD operations to reduce
the number of DB queries.
Moves view rendering tests to static analysis, as they do not require
a database connection
@@ -74,6 +92,7 @@ public function assertViewOutput($expected, $view, $view_vars = [], $viewtype =
*/
public function testCanRenderViewWithEmptyVars($view, $viewtype) {
if (!elgg_view_exists($view, $viewtype)) {
dump($view);
Copy link
Member

Choose a reason for hiding this comment

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

is this left over debug code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, yes

Copy link
Member

Choose a reason for hiding this comment

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

if you could remove that, i'll merge this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@jeabakker jeabakker merged commit 1910ef4 into Elgg:master Nov 29, 2017
@hypeJunction hypeJunction deleted the qb-river branch November 29, 2017 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants