function apps_install_downloads in Apps 7
Move modules from there temp location in to the drupal tree.
Taken from update_manager_update_ready_form_submit we are using apps_run_install instead of update_authorize_run_update
@TODO: Get the install to work when we do not own sites OPIC-377
2 calls to apps_install_downloads()
- apps_app_install in ./
apps.pages.inc - Callback for app install TODO: check to see the app is install able and then install TODO: should goto config page but pass on the current destination NOTE: it is expected that this page would be called with a drupal desination set
- apps_app_update in ./
apps.pages.inc - Callback for app update.
File
- ./
apps.installer.inc, line 209 - installer.inc hold all of the function used to download apps and thier deps
Code
function apps_install_downloads() {
module_load_include("inc", "update", "update.manager");
if (!empty($_SESSION['update_manager_update_projects'])) {
// Make sure the Updater registry is loaded.
drupal_get_updaters();
$updates = array();
$project_types = $_SESSION['update_manager_update_projects'];
foreach ($project_types as $type => $projects) {
$directory = apps_extract_directory($type);
foreach ($projects as $project => $url) {
$project_location = $directory . '/' . $project;
try {
$updater = Updater::factory($project_location);
} catch (Exception $e) {
drupal_set_message(t('Error installing @project: @message', array(
'@project' => $project,
'@message' => $e
->getMessage(),
)), 'error');
return FALSE;
}
$project_real_location = drupal_realpath($project_location);
$updates[] = array(
'project' => $project,
'updater_name' => get_class($updater),
'local_url' => $project_real_location,
);
}
}
// If the owner of the last directory we extracted is the same as the
// owner of our configuration directory (e.g. sites/default) where we're
// trying to install the code, there's no need to prompt for FTP/SSH
// credentials. Instead, we instantiate a FileTransferLocal and invoke
// update_authorize_run_update() directly.
if (apps_installer_has_write_access()) {
module_load_include('inc', 'update', 'update.authorize');
$filetransfer = new FileTransferLocal(DRUPAL_ROOT);
// This is our change.
apps_run_install($filetransfer, $updates);
unset($_SESSION['update_manager_update_projects']);
}
else {
// Set the $_SESSION variables so that authorize form knows what to do
// after authorization.
system_authorized_init('apps_run_install', drupal_get_path('module', 'apps') . '/apps.installer.inc', array(
$updates,
), t('Update manager'));
// Get the authorize form.
require_once DRUPAL_ROOT . '/includes/authorize.inc';
return drupal_get_form('authorize_filetransfer_form');
}
}
}