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

Stream Wrapper: Tweaks to vip files update-filesizes script #1173

Merged
merged 8 commits into from Mar 12, 2019

Conversation

mjangda
Copy link
Member

@mjangda mjangda commented Mar 7, 2019

A couple of optimizations and improvements:

  • Create meta if it doesn't exist
  • BETWEEN instead of LIMIT (much faster when using INDEX)
  • Confirmation step

And a few other small changes.

Checklist

Please make sure the items below have been covered before requesting a review:

  • n/a This change works and has been tested locally (or has an appropriate fallback).
  • This change works and has been tested on a Go sandbox.
  • n/a This change has relevant unit tests (if applicable).

That way we store the filesize and avoid future lookups.
Just to be sure :)
Script won't work without it.
Much faster than really large LIMITs especially when using an index.
@mjangda mjangda changed the title vip files update-filesizes: Tweaks to script Stream Wrapper: Tweaks to vip files update-filesizes script Mar 7, 2019
End the loop only after we've finished going through all IDs.

Also kills the progress bar which isn't great for seeing ongoing
progress on really large sites.

$max_id = $wpdb->get_var( 'SELECT ID FROM ' . $wpdb->posts . ' ORDER BY ID DESC LIMIT 1' );

$end_index = $start_index + $batch_size;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we at all concerned about how accurate the $end_index would be? It is very likely that the post ID will not be sequential

Copy link
Member Author

Choose a reason for hiding this comment

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

With the way it's written, we just loop through all post IDs until we hit the highest one. We will probably have batches where there are 0 results or 0 attachments but that's okay.

@mjangda mjangda merged commit 463aa13 into master Mar 12, 2019
@mjangda mjangda deleted the update/tweak-files-cli branch March 12, 2019 05:03
@mjangda
Copy link
Member Author

mjangda commented Mar 12, 2019

r133803-deploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants