Determines which Updater class can operate on the given directory.
string $directory: Extracted Drupal project.
string The class name which can work with this project type.
Drupal\Core\Updater\UpdaterException
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.'));
}