You are here

function realistic_dummy_content_api_apply_recipe in Realistic Dummy Content 7

Same name and namespace in other branches
  1. 8.2 api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()
  2. 8 api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()
  3. 7.2 api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()
  4. 3.x api/realistic_dummy_content_api.module \realistic_dummy_content_api_apply_recipe()

Attempts to generate all realistic content for the current site.

Parameters

$log: A class which implements the interface RealisticDummyContentLog. Logging will be different if you are using drush or in the context of an automated test, for example.

2 calls to realistic_dummy_content_api_apply_recipe()
drush_realistic_dummy_content_api_generate_realistic in api/realistic_dummy_content_api.drush.inc
Callback: Generates realistic content
realistic_dummy_content_DatabaseTestCase::testRecipe in api/tests/realistic_dummy_content_api.db.test

File

api/realistic_dummy_content_api.module, line 397
API code allowing other modules to generate realistic dummy content. See the Realistic Dummy Content module for an example of how to use.

Code

function realistic_dummy_content_api_apply_recipe($log) {
  try {
    if (!class_exists('RealisticDummyContentRecipe')) {

      // When upgrading from beta3, class names may have changed, so rebuild the registry
      // to avoid presenting a "class not found" fatal error.
      registry_rebuild();
    }
    RealisticDummyContentRecipe::Run($log);
  } catch (Exception $e) {
    $log
      ->log('An exception occurred while trying to apply a recipe');
    $log
      ->error($e
      ->getMessage());
  }
}