1.20.x updater.inc public static Updater::factory($source)

Return an Updater of the appropriate type depending on the source.

If a directory is provided which contains a module, will return a ModuleUpdater.

Parameters

string $source: Directory of a Backdrop project.

Return value

Updater:

Throws

UpdaterException

File

includes/updater.inc, line 95
Classes used for updating various files in the Backdrop 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…

Class

Updater
Base class for Updaters used in Backdrop.

Code

public static function factory($source) {
  if (is_dir($source)) {
    $updater = self::getUpdaterFromDirectory($source);
  }
  else {
    throw new UpdaterException(t('Unable to determine the type of the source directory.'));
  }
  return new $updater($source);
}