Updater::getUpdaterFromDirectory

public static function Updater::getUpdaterFromDirectory

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.

File

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

© 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/includes!updater.inc/function/Updater::getUpdaterFromDirectory/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部