function tesseract_content_blocks_update()
{
    $packages = tesseract_get_packages_url();
    $result = tesseract_import_packages($packages);
    echo json_encode($result);
    die;
}
Example #2
0
function tesseract_do_import_packages()
{
    $doing_import = get_option('tesseract_doing_import', false);
    if (!$doing_import) {
        try {
            update_option('tesseract_doing_import', true);
            $packages = tesseract_get_packages();
            tesseract_import_packages($packages);
            delete_option('tesseract_doing_import');
        } catch (Exception $e) {
            delete_option('tesseract_doing_import');
            throw $e;
        }
    }
}
Example #3
0
 function testPackageUpdate()
 {
     // Run importer with a package, version 1.0
     $packages = tesseract_get_packages(dirname(__FILE__) . '/data/test-update-package.json');
     tesseract_import_packages($packages);
     $slug = $packages["1"]['details']['slug'];
     // Assert that a post from that package is present with a certain title
     $posts = tesseract_get_tracked_posts_from_package_slug($slug);
     $this->assertEquals('Post 1.0', $posts[0]->post_title);
     // Run importer with same package slug, version 1.1, with an updated post title
     $packages = tesseract_get_packages(dirname(__FILE__) . '/data/test-update-package-updated.json');
     tesseract_import_packages($packages);
     // Assert that the post title has changed, and the old post doesn't exist
     $posts = tesseract_get_tracked_posts_from_package_slug($slug);
     $this->assertEquals(1, count($posts));
     $this->assertEquals('Post 1.1', $posts[0]->post_title);
 }
Example #4
0
function tesseract_do_import_packages()
{
    $packages = tesseract_get_packages();
    tesseract_import_packages($packages);
}