public static function Updater::factory

Returns an Updater of the appropriate type depending on the source.

If a directory is provided which contains a module, will return a ModuleUpdater.

Parameters

string $source: Directory of a Drupal project.

Return value

Drupal\Core\Updater\Updater A new Drupal\Core\Updater\Updater object.

Throws

Drupal\Core\Updater\UpdaterException

2 calls to Updater::factory()
update_manager_install_form_submit in drupal/core/modules/update/update.manager.inc
Form submission handler for update_manager_install_form().
update_manager_update_ready_form_submit in drupal/core/modules/update/update.manager.inc
Form submission handler for update_manager_update_ready_form().

File

drupal/core/lib/Drupal/Core/Updater/Updater.php, line 50
Definition of Drupal\Core\Updater\Updater.

Class

Updater
Defines the base class for Updaters used in Drupal.

Namespace

Drupal\Core\Updater

Code

public static function factory($source) {
  if (is_dir($source)) {
    $updater = self::getUpdaterFromDirectory($source);
  }
  else {
    throw new UpdaterException(t('Unable to determine the type of the source directory.'));
  }
  return new $updater($source);
}