function Updater::factory

Same name in other branches
  1. 9 core/lib/Drupal/Core/Updater/Updater.php \Drupal\Core\Updater\Updater::factory()
  2. 8.9.x core/lib/Drupal/Core/Updater/Updater.php \Drupal\Core\Updater\Updater::factory()
  3. 10 core/lib/Drupal/Core/Updater/Updater.php \Drupal\Core\Updater\Updater::factory()
  4. 11.x core/lib/Drupal/Core/Updater/Updater.php \Drupal\Core\Updater\Updater::factory()

Return 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

Updater

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

File

includes/updater.inc, line 104

Class

Updater
Base class for Updaters used in Drupal.

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.