public static function Updater::getUpdaterFromDirectory

Determines which Updater class can operate on the given directory.

Parameters

string $directory: Extracted Drupal project.

Return value

string The class name which can work with this project type.

Throws

Drupal\Core\Updater\UpdaterException

1 call to Updater::getUpdaterFromDirectory()
Updater::factory in drupal/core/lib/Drupal/Core/Updater/Updater.php
Returns an Updater of the appropriate type depending on the source.

File

drupal/core/lib/Drupal/Core/Updater/Updater.php, line 71
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 getUpdaterFromDirectory($directory) {

  // Gets a list of possible implementing classes.
  $updaters = drupal_get_updaters();
  foreach ($updaters as $updater) {
    $class = $updater['class'];
    if (call_user_func(array(
      $class,
      'canUpdateDirectory',
    ), $directory)) {
      return $class;
    }
  }
  throw new UpdaterException(t('Cannot determine the type of project.'));
}