for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This class does a full resync of the database by
* enqueuing an outbound action for every single object
* that we care about
*/
class Jetpack_Sync_Full {
static $array_chunk_size = 5;
$array_chunk_size
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
class A { var $property; }
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.
function start() {
// TODO
This check looks TODO comments that have been left in the code.
TODO
``TODO``s show that something is left unfinished and should be attended to.
$this->enqueue_all_posts();
}
private function enqueue_all_posts() {
global $wpdb;
// I hope this is never bigger than RAM...
$post_ids = $wpdb->get_col( "SELECT id FROM $wpdb->posts");
// Request posts in groups of N for efficiency
$chunked_post_ids = array_chunk( $post_ids, self::$array_chunk_size );
foreach ( $chunked_post_ids as $chunk ) {
$posts = get_posts( array( 'post__in' => $chunk, 'post_status' => 'any' ) );
foreach ( $posts as $post ) {
do_action( 'jp_full_sync_post', $post );
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.