public static function Updater::getUpdaterFromDirectory

7.x updater.inc public static Updater::getUpdaterFromDirectory($directory)

Determine 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.

1 call to Updater::getUpdaterFromDirectory()
Updater::factory in drupal-7.x/includes/updater.inc
Return an Updater of the appropriate type depending on the source.

File

drupal-7.x/includes/updater.inc, line 113
Classes used for updating various files in the Drupal webroot. These classes use a FileTransfer object to actually perform the operations. Normally, the FileTransfer is provided when the site owner is redirected to authorize.php as part of a multistep…

Class

Updater
Base class for Updaters used in Drupal.

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