Updater::factory

public static Updater::factory($source, $root)

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.

string $root: The root directory under which the project will be copied to if it's a new project. Usually this is the app root (the directory in which the Drupal site is installed).

Return value

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

Throws

\Drupal\Core\Updater\UpdaterException

File

core/lib/Drupal/Core/Updater/Updater.php, line 63

Class

Updater
Defines the base class for Updaters used in Drupal.

Namespace

Drupal\Core\Updater

Code

public static function factory($source, $root) {
  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, $root);
}
doc_Drupal
2016-10-29 09:51:03
Comments
Leave a Comment

Please login to continue.