public static function 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.'));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Updater!Updater.php/function/Updater::getUpdaterFromDirectory/8.1.x