diff --git a/core/core.services.yml b/core/core.services.yml index b850c9e..c9a0377 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -580,6 +580,9 @@ services: flood: class: Drupal\Core\Flood\DatabaseBackend arguments: ['@database', '@request'] + plugin.manager.filetransfer: + class: Drupal\Core\FileTransfer\FileTransferManager + arguments: ['@container.namespaces', '@module_handler'] mail.factory: class: Drupal\Core\Mail\MailFactory arguments: ['@config.factory'] diff --git a/core/includes/authorize.inc b/core/includes/authorize.inc index 70fb4ca..e582e9c 100644 --- a/core/includes/authorize.inc +++ b/core/includes/authorize.inc @@ -315,7 +315,7 @@ function authorize_get_filetransfer($backend, $settings = array()) { if (!empty($_SESSION['authorize_filetransfer_info'][$backend])) { $backend_info = $_SESSION['authorize_filetransfer_info'][$backend]; if (class_exists($backend_info['class'])) { - $filetransfer = $backend_info['class']::factory(DRUPAL_ROOT, $settings); + $filetransfer = $backend_info['class']::create(DRUPAL_ROOT, $settings); } } return $filetransfer; diff --git a/core/includes/common.inc b/core/includes/common.inc index a566bc5..72dcfaf 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -5016,26 +5016,6 @@ function drupal_get_updaters() { } /** - * Assembles the Drupal FileTransfer registry. - * - * @return - * The Drupal FileTransfer class registry. - * - * @see \Drupal\Core\FileTransfer\FileTransfer - * @see hook_filetransfer_info() - * @see hook_filetransfer_info_alter() - */ -function drupal_get_filetransfer_info() { - $info = &drupal_static(__FUNCTION__); - if (!isset($info)) { - $info = \Drupal::moduleHandler()->invokeAll('filetransfer_info'); - drupal_alter('filetransfer_info', $info); - uasort($info, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); - } - return $info; -} - -/** * @defgroup queue Queue operations * @{ * Queue items to allow later processing. diff --git a/core/lib/Drupal/Core/Annotation/FileTransfer.php b/core/lib/Drupal/Core/Annotation/FileTransfer.php new file mode 100644 index 0000000..58e9396 --- /dev/null +++ b/core/lib/Drupal/Core/Annotation/FileTransfer.php @@ -0,0 +1,44 @@ +alterInfo($module_handler, 'filetransfer_info'); + } + + /** + * {@inheritdoc} + */ + protected function findDefinitions() { + $definitions = parent::findDefinitions(); + + uasort($definitions, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + return $definitions; + } + +} diff --git a/core/lib/Drupal/Core/FileTransfer/FTP.php b/core/lib/Drupal/Core/FileTransfer/Ftp.php similarity index 73% rename from core/lib/Drupal/Core/FileTransfer/FTP.php rename to core/lib/Drupal/Core/FileTransfer/Ftp.php index 342660a..349c38f 100644 --- a/core/lib/Drupal/Core/FileTransfer/FTP.php +++ b/core/lib/Drupal/Core/FileTransfer/Ftp.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\FileTransfer\FTP. + * Definition of Drupal\Core\FileTransfer\Ftp. */ namespace Drupal\Core\FileTransfer; @@ -10,10 +10,10 @@ /** * Defines the base class for FTP implementations. */ -abstract class FTP extends FileTransfer { +abstract class Ftp extends FileTransferBase { /** - * Overrides Drupal\Core\FileTransfer\FileTransfer::__construct(). + * @{inheritdoc} */ public function __construct($jail, $username, $password, $hostname, $port) { $this->username = $username; @@ -24,16 +24,16 @@ public function __construct($jail, $username, $password, $hostname, $port) { } /** - * Overrides Drupal\Core\FileTransfer\FileTransfer::factory(). + * @{inheritdoc} */ - static function factory($jail, $settings) { + static function create($jail, $settings) { $username = empty($settings['username']) ? '' : $settings['username']; $password = empty($settings['password']) ? '' : $settings['password']; $hostname = empty($settings['advanced']['hostname']) ? 'localhost' : $settings['advanced']['hostname']; $port = empty($settings['advanced']['port']) ? 21 : $settings['advanced']['port']; if (function_exists('ftp_connect')) { - $class = 'Drupal\Core\FileTransfer\FTPExtension'; + $class = 'Drupal\Core\FileTransfer\Plugin\FileTransfer\FTPExtension'; } else { throw new FileTransferException('No FTP backend available.'); @@ -43,7 +43,7 @@ static function factory($jail, $settings) { } /** - * Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm(). + * @{inheritdoc} */ public function getSettingsForm() { $form = parent::getSettingsForm(); diff --git a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php b/core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/FtpExtension.php similarity index 90% rename from core/lib/Drupal/Core/FileTransfer/FTPExtension.php rename to core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/FtpExtension.php index f87293b..c85afa7 100644 --- a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php +++ b/core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/FtpExtension.php @@ -2,15 +2,25 @@ /** * @file - * Definition of Drupal\Core\FileTransfer\FTPExtension. + * Definition of Drupal\Core\FileTransfer\FtpExtension. */ -namespace Drupal\Core\FileTransfer; +namespace Drupal\Core\FileTransfer\Plugin\FileTransfer; + +use Drupal\Core\FileTransfer\FileTransferException; +use Drupal\Core\FileTransfer\Ftp; +use Drupal\Core\FileTransfer\ChmodInterface; /** * Defines a file transfer class using the PHP FTP extension. + * + * @FileTransfer( + * id = "ftp", + * title = @Translation("FTP"), + * weight = 0 + * ) */ -class FTPExtension extends FTP implements ChmodInterface { +class FtpExtension extends Ftp implements ChmodInterface { /** * Implements Drupal\Core\FileTransfer\FileTransfer::connect(). diff --git a/core/lib/Drupal/Core/FileTransfer/Local.php b/core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/Local.php similarity index 89% rename from core/lib/Drupal/Core/FileTransfer/Local.php rename to core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/Local.php index a0973be..1082065 100644 --- a/core/lib/Drupal/Core/FileTransfer/Local.php +++ b/core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/Local.php @@ -2,15 +2,21 @@ /** * @file - * Definition of Drupal\Core\FileTransfer\Local. + * Contains \Drupal\Core\FileTransfer\Plugin\FileTransfer\Local. */ -namespace Drupal\Core\FileTransfer; +namespace Drupal\Core\FileTransfer\Plugin\FileTransfer; + +use Drupal\Core\FileTransfer\ChmodInterface; +use Drupal\Core\FileTransfer\FileTransferBase; +use Drupal\Core\FileTransfer\FileTransferException; +use RecursiveIteratorIterator; +use RecursiveDirectoryIterator; /** * Defines the local connection class for copying files as the httpd user. */ -class Local extends FileTransfer implements ChmodInterface { +class Local extends FileTransferBase implements ChmodInterface { /** * Implements Drupal\Core\FileTransfer\FileTransfer::connect(). diff --git a/core/lib/Drupal/Core/FileTransfer/SSH.php b/core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/Ssh.php similarity index 80% rename from core/lib/Drupal/Core/FileTransfer/SSH.php rename to core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/Ssh.php index 82edcda..bc71528 100644 --- a/core/lib/Drupal/Core/FileTransfer/SSH.php +++ b/core/lib/Drupal/Core/FileTransfer/Plugin/FileTransfer/Ssh.php @@ -5,15 +5,25 @@ * Definition of Drupal\Core\FileTransfer\SSH. */ -namespace Drupal\Core\FileTransfer; +namespace Drupal\Core\FileTransfer\Plugin\FileTransfer; + +use Drupal\Core\FileTransfer\FileTransferException; +use Drupal\Core\FileTransfer\FileTransferBase; +use Drupal\Core\FileTransfer\ChmodInterface; /** * The SSH connection class for the update module. + * + * @FileTransfer( + * id = "ssh", + * title = @Translation("SSH"), + * weight = 20 + * ) */ -class SSH extends FileTransfer implements ChmodInterface { +class Ssh extends FileTransferBase implements ChmodInterface { /** - * Overrides Drupal\Core\FileTransfer\FileTransfer::__construct(). + * @{inheritdoc} */ function __construct($jail, $username, $password, $hostname = "localhost", $port = 22) { $this->username = $username; @@ -24,7 +34,7 @@ function __construct($jail, $username, $password, $hostname = "localhost", $port } /** - * Implements Drupal\Core\FileTransfer\FileTransfer::connect(). + * @{inheritdoc} */ function connect() { $this->connection = @ssh2_connect($this->hostname, $this->port); @@ -37,18 +47,18 @@ function connect() { } /** - * Overrides Drupal\Core\FileTransfer\FileTransfer::factory(). + * @{inheritdoc} */ - static function factory($jail, $settings) { + static function create($jail, $settings) { $username = empty($settings['username']) ? '' : $settings['username']; $password = empty($settings['password']) ? '' : $settings['password']; $hostname = empty($settings['advanced']['hostname']) ? 'localhost' : $settings['advanced']['hostname']; $port = empty($settings['advanced']['port']) ? 22 : $settings['advanced']['port']; - return new SSH($jail, $username, $password, $hostname, $port); + return new Ssh($jail, $username, $password, $hostname, $port); } /** - * Implements Drupal\Core\FileTransfer\FileTransfer::copyFileJailed(). + * @{inheritdoc} */ protected function copyFileJailed($source, $destination) { if (!@ssh2_scp_send($this->connection, $source, $destination)) { @@ -57,7 +67,7 @@ protected function copyFileJailed($source, $destination) { } /** - * Implements Drupal\Core\FileTransfer\FileTransfer::copyDirectoryJailed(). + * @{inheritdoc} */ protected function copyDirectoryJailed($source, $destination) { if (@!ssh2_exec($this->connection, 'cp -Rp ' . escapeshellarg($source) . ' ' . escapeshellarg($destination))) { @@ -66,7 +76,7 @@ protected function copyDirectoryJailed($source, $destination) { } /** - * Implements Drupal\Core\FileTransfer\FileTransfer::createDirectoryJailed(). + * @{inheritdoc} */ protected function createDirectoryJailed($directory) { if (@!ssh2_exec($this->connection, 'mkdir ' . escapeshellarg($directory))) { @@ -75,7 +85,7 @@ protected function createDirectoryJailed($directory) { } /** - * Implements Drupal\Core\FileTransfer\FileTransfer::removeDirectoryJailed(). + * @{inheritdoc} */ protected function removeDirectoryJailed($directory) { if (@!ssh2_exec($this->connection, 'rm -Rf ' . escapeshellarg($directory))) { @@ -84,7 +94,7 @@ protected function removeDirectoryJailed($directory) { } /** - * Implements Drupal\Core\FileTransfer\FileTransfer::removeFileJailed(). + * @{inheritdoc} */ protected function removeFileJailed($destination) { if (!@ssh2_exec($this->connection, 'rm ' . escapeshellarg($destination))) { @@ -113,7 +123,7 @@ public function isDirectory($path) { } /** - * Implements Drupal\Core\FileTransfer\FileTransfer::isFile(). + * @{inheritdoc} */ public function isFile($path) { $file = escapeshellarg($path); @@ -130,7 +140,7 @@ public function isFile($path) { } /** - * Implements Drupal\Core\FileTransfer\ChmodInterface::chmodJailed(). + * @{inheritdoc} */ function chmodJailed($path, $mode, $recursive) { $cmd = sprintf("chmod %s%o %s", $recursive ? '-R ' : '', $mode, escapeshellarg($path)); @@ -140,7 +150,7 @@ function chmodJailed($path, $mode, $recursive) { } /** - * Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm(). + * @{inheritdoc} */ public function getSettingsForm() { $form = parent::getSettingsForm(); diff --git a/core/modules/system/lib/Drupal/system/Tests/FileTransfer/TestFileTransfer.php b/core/modules/system/lib/Drupal/system/Tests/FileTransfer/TestFileTransfer.php index 92e736f..2055b98 100644 --- a/core/modules/system/lib/Drupal/system/Tests/FileTransfer/TestFileTransfer.php +++ b/core/modules/system/lib/Drupal/system/Tests/FileTransfer/TestFileTransfer.php @@ -7,13 +7,13 @@ namespace Drupal\system\Tests\FileTransfer; -use Drupal\Core\FileTransfer\FileTransfer; +use Drupal\Core\FileTransfer\FileTransferBase; use Drupal\Core\FileTransfer\FileTransferException; /** * Mock FileTransfer object for test case. */ -class TestFileTransfer extends FileTransfer { +class TestFileTransfer extends FileTransferBase { protected $host = NULL; protected $username = NULL; protected $password = NULL; @@ -24,45 +24,75 @@ class TestFileTransfer extends FileTransfer { */ public $shouldIsDirectoryReturnTrue = FALSE; + /** + * @(inheritdoc) + */ function __construct($jail, $username, $password, $hostname = 'localhost', $port = 9999) { parent::__construct($jail, $username, $password, $hostname, $port); } - static function factory($jail, $settings) { + /** + * @(inheritdoc) + */ + static function create($jail, $settings) { return new TestFileTransfer($jail, $settings['username'], $settings['password'], $settings['hostname'], $settings['port']); } + /** + * @(inheritdoc) + */ function connect() { $this->connection = new MockTestConnection(); $this->connection->connectionString = 'test://' . urlencode($this->username) . ':' . urlencode($this->password) . "@$this->host:$this->port/"; } + /** + * @(inheritdoc) + */ function copyFileJailed($source, $destination) { $this->connection->run("copyFile $source $destination"); } + /** + * @(inheritdoc) + */ protected function removeDirectoryJailed($directory) { $this->connection->run("rmdir $directory"); } + /** + * @(inheritdoc) + */ function createDirectoryJailed($directory) { $this->connection->run("mkdir $directory"); } + /** + * @(inheritdoc) + */ function removeFileJailed($destination) { if (!ftp_delete($this->connection, $item)) { throw new FileTransferException('Unable to remove to file @file.', NULL, array('@file' => $item)); } } + /** + * @(inheritdoc) + */ function isDirectory($path) { return $this->shouldIsDirectoryReturnTrue; } + /** + * @(inheritdoc) + */ function isFile($path) { return FALSE; } + /** + * @(inheritdoc) + */ function chmodJailed($path, $mode, $recursive) { return; } diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 54e04a3..9f0f99e 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -3085,57 +3085,14 @@ function hook_countries_alter(&$countries) { } /** - * Register information about FileTransfer classes provided by a module. - * - * The FileTransfer class allows transferring files over a specific type of - * connection. Core provides classes for FTP and SSH. Contributed modules are - * free to extend the FileTransfer base class to add other connection types, - * and if these classes are registered via hook_filetransfer_info(), those - * connection types will be available to site administrators using the Update - * manager when they are redirected to the authorize.php script to authorize - * the file operations. - * - * @return array - * Nested array of information about FileTransfer classes. Each key is a - * FileTransfer type (not human readable, used for form elements and - * variable names, etc), and the values are subarrays that define properties - * of that type. The keys in each subarray are: - * - 'title': Required. The human-readable name of the connection type. - * - 'class': Required. The name of the FileTransfer class. The constructor - * will always be passed the full path to the root of the site that should - * be used to restrict where file transfer operations can occur (the $jail) - * and an array of settings values returned by the settings form. - * - 'file': Required. The include file containing the FileTransfer class. - * This should be a separate .inc file, not just the .module file, so that - * the minimum possible code is loaded when authorize.php is running. - * - 'file path': Optional. The directory (relative to the Drupal root) - * where the include file lives. If not defined, defaults to the base - * directory of the module implementing the hook. - * - 'weight': Optional. Integer weight used for sorting connection types on - * the authorize.php form. - * - * @see \Drupal\Core\FileTransfer\FileTransfer - * @see authorize.php - * @see hook_filetransfer_info_alter() - * @see drupal_get_filetransfer_info() - */ -function hook_filetransfer_info() { - $info['sftp'] = array( - 'title' => t('SFTP (Secure FTP)'), - 'class' => 'Drupal\Core\FileTransfer\SFTP', - 'weight' => 10, - ); - return $info; -} - -/** * Alter the FileTransfer class registry. * * @param array $filetransfer_info * Reference to a nested array containing information about the FileTransfer * class registry. * - * @see hook_filetransfer_info() + * @see \Drupal\Core\FileTransfer\FileTransferManager + * @see Drupal\Core\Annotation\FileTransfer */ function hook_filetransfer_info_alter(&$filetransfer_info) { // Remove the FTP option entirely. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 1657f9f..c8f607f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2228,7 +2228,7 @@ function system_authorized_init($callback, $file, $arguments = array(), $page_ti // First, figure out what file transfer backends the site supports, and put // all of those in the SESSION so that authorize.php has access to all of // them via the class autoloader, even without a full bootstrap. - $_SESSION['authorize_filetransfer_info'] = drupal_get_filetransfer_info(); + $_SESSION['authorize_filetransfer_info'] = Drupal::service('plugin.manager.filetransfer')->getDefinitions(); // Now, define the callback to invoke. $_SESSION['authorize_operation'] = array( @@ -2315,30 +2315,18 @@ function system_updater_info() { } /** - * Implements hook_filetransfer_info(). + * Implements hook_filetransfer_info_alter(). */ -function system_filetransfer_info() { - $backends = array(); - +function system_filetransfer_info_alter(&$backends) { // This is the default, will be available on most systems. - if (function_exists('ftp_connect')) { - $backends['ftp'] = array( - 'title' => t('FTP'), - 'class' => 'Drupal\Core\FileTransfer\FTP', - 'weight' => 0, - ); + if (!function_exists('ftp_connect')) { + unset($backends['ftp']); } - // SSH2 lib connection is only available if the proper PHP extension is // installed. - if (function_exists('ssh2_connect')) { - $backends['ssh'] = array( - 'title' => t('SSH'), - 'class' => 'Drupal\Core\FileTransfer\SSH', - 'weight' => 20, - ); + if (!function_exists('ssh2_connect')) { + unset($backends['ssh']); } - return $backends; } /** diff --git a/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/MockFileTransfer.php b/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Plugin/FileTransfer/MockFileTransfer.php similarity index 47% rename from core/modules/system/tests/modules/system_test/lib/Drupal/system_test/MockFileTransfer.php rename to core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Plugin/FileTransfer/MockFileTransfer.php index 900e0be..65a4539 100644 --- a/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/MockFileTransfer.php +++ b/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Plugin/FileTransfer/MockFileTransfer.php @@ -2,24 +2,30 @@ /** * @file - * Definition of Drupal\system_test\MockFileTransfer. + * Contains \Drupal\system_test\Plugin\FileTransfer\MockFileTransfer. */ -namespace Drupal\system_test; +namespace Drupal\system_test\Plugin\FileTransfer; /** * Mock FileTransfer object to test the settings form functionality. + * + * @FileTransfer( + * id = "system_test", + * title = @Translation("System Test FileTransfer"), + * weight = -10 + * ) */ class MockFileTransfer { /** - * Returns a Drupal\system_test\MockFileTransfer object. + * Returns a MockFileTransfer object. * - * @return \Drupal\system_test\MockFileTransfer - * A new Drupal\system_test\MockFileTransfer object. + * @return \Drupal\system_test\Plugin\FileTransfer\MockFileTransfer + * A new Drupal\system_test\Plugin\FileTransfer\MockFileTransfer object. */ - public static function factory() { - return new MockFileTransfer; + public static function create() { + return new static(); } /** diff --git a/core/modules/system/tests/modules/system_test/system_test.module b/core/modules/system/tests/modules/system_test/system_test.module index 1eda491..1faba37 100644 --- a/core/modules/system/tests/modules/system_test/system_test.module +++ b/core/modules/system/tests/modules/system_test/system_test.module @@ -160,19 +160,6 @@ function _system_test_second_shutdown_function($arg1, $arg2) { } /** - * Implements hook_filetransfer_info(). - */ -function system_test_filetransfer_info() { - return array( - 'system_test' => array( - 'title' => t('System Test FileTransfer'), - 'class' => 'Drupal\system_test\MockFileTransfer', - 'weight' => -10, - ), - ); -} - -/** * Page callback to initialize authorize.php during testing. * * @see system_authorized_init(). diff --git a/core/modules/update/tests/modules/update_test/lib/Drupal/update_test/MockFileTransfer.php b/core/modules/update/tests/modules/update_test/lib/Drupal/update_test/Plugin/FileTransfer/MockFileTransfer.php similarity index 48% rename from core/modules/update/tests/modules/update_test/lib/Drupal/update_test/MockFileTransfer.php rename to core/modules/update/tests/modules/update_test/lib/Drupal/update_test/Plugin/FileTransfer/MockFileTransfer.php index b47fd6b..813ae47 100644 --- a/core/modules/update/tests/modules/update_test/lib/Drupal/update_test/MockFileTransfer.php +++ b/core/modules/update/tests/modules/update_test/lib/Drupal/update_test/Plugin/FileTransfer/MockFileTransfer.php @@ -2,24 +2,30 @@ /** * @file - * Definition of Drupal\update_test\MockFileTransfer. + * Contains \Drupal\update_test\Plugin\FileTransfer\MockFileTransfer. */ -namespace Drupal\update_test; +namespace Drupal\update_test\Plugin\FileTransfer; /** * Mocks a FileTransfer object to test the settings form functionality. + * + * @FileTransfer( + * id = "update_test", + * title = @Translation("Update Test FileTransfer"), + * weight = -20 + * ) */ class MockFileTransfer { /** * Returns a Drupal\update_test\MockFileTransfer object. * - * @return \Drupal\update_test\MockFileTransfer - * A new Drupal\update_test\MockFileTransfer object. + * @return \Drupal\update_test\Plugin\FileTransfer\MockFileTransfer + * A new Drupal\update_test\Plugin\FileTransfer\MockFileTransfer object. */ - public static function factory() { - return new FileTransfer; + public static function create() { + return new static(); } /** @@ -27,7 +33,7 @@ public static function factory() { */ public function getSettingsForm() { $form = array(); - $form['udpate_test_username'] = array( + $form['update_test_username'] = array( '#type' => 'textfield', '#title' => t('Update Test Username'), ); diff --git a/core/modules/update/tests/modules/update_test/update_test.module b/core/modules/update/tests/modules/update_test/update_test.module index 249ad83..0bd9da3 100644 --- a/core/modules/update/tests/modules/update_test/update_test.module +++ b/core/modules/update/tests/modules/update_test/update_test.module @@ -129,17 +129,11 @@ function update_test_archiver_info_alter(&$definitions) { } /** - * Implements hook_filetransfer_info(). + * Page callback: Displays an Error 503 (Service unavailable) page. + * + * @see update_test_menu() */ -function update_test_filetransfer_info() { - // Define a mock file transfer method, to ensure that there will always be - // at least one method available in the user interface (regardless of the - // environment in which the update manager tests are run). - return array( - 'system_test' => array( - 'title' => t('Update Test FileTransfer'), - 'class' => 'Drupal\update_test\MockFileTransfer', - 'weight' => -20, - ), - ); +function update_callback_service_unavailable() { + drupal_add_http_header('Status', '503 Service unavailable'); + print "503 Service Temporarily Unavailable"; } diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index 19c0dc1..3a6bdac 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -37,7 +37,7 @@ */ use Drupal\Core\Updater\Updater; -use Drupal\Core\FileTransfer\Local; +use Drupal\Core\FileTransfer\Plugin\FileTransfer\Local; use Symfony\Component\HttpFoundation\RedirectResponse; /** @@ -588,7 +588,7 @@ function _update_manager_check_backends(&$form, $operation) { '#suffix' => '

', ); - $available_backends = drupal_get_filetransfer_info(); + $available_backends = Drupal::service('plugin.manager.filetransfer')->getDefinitions(); if (empty($available_backends)) { if ($operation == 'update') { $form['available_backends']['#markup'] = t('Your server does not support updating modules and themes from this interface. Instead, update modules and themes by uploading the new versions directly to the server, as described in the handbook.', array('@handbook_url' => 'http://drupal.org/getting-started/install-contrib'));