Updater::getUpdaterFromDirectory

public static Updater::getUpdaterFromDirectory($directory)

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

File

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

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.'));
}
doc_Drupal
2016-10-29 09:51:04
Comments
Leave a Comment

Please login to continue.