1 installer.manager.inc installer_manager_local_transfers_allowed()

Determines if file transfers will be performed locally.

If the server is configured such that webserver-created files have the same owner as the configuration directory where new code will eventually be installed, the update manager can transfer files entirely locally, without changing their ownership (in other words, without prompting the user for FTP, SSH or other credentials).

This server configuration is an inherent security weakness because it allows a malicious webserver process to append arbitrary PHP code and then execute it. However, it is supported here because it is a common configuration on shared hosting, and there is nothing Backdrop can do to prevent it.

Return value

TRUE if local file transfers are allowed on this server, or FALSE if not.:

See also




Related topics


core/modules/installer/installer.manager.inc, line 1147
Administrative screens and processing functions of the Installer module.


function installer_manager_local_transfers_allowed() {
  // Compare the owner of a webserver-created temporary file to the owner of
  // the configuration directory to determine if local transfers will be
  // allowed.
  $temporary_file = backdrop_tempnam('temporary://', 'update_');
  $local_transfers_allowed = fileowner($temporary_file) === fileowner(conf_path());

  // Clean up. If this fails, we can ignore it (since this is just a temporary
  // file anyway).

  return $local_transfers_allowed;