update.manager.inc

Version 1.17 (checked in on 2010/02/01 at 07:17:59 by webchick)

Administrative screens and processing functions for the update manager. This allows site administrators with the 'administer software updates' permission to either upgrade existing projects, or download and install new ones, so long as the killswitch setting ('allow_authorize_operations') is still TRUE.

To install new code, the administrator is prompted for either the URL of an archive file, or to directly upload the archive file. The archive is loaded into a temporary location, extracted, and verified. If everything is successful, the user is redirected to authorize.php to type in their file transfer credentials and authorize the installation to proceed with elevated privileges, such that the extracted files can be copied out of the temporary location and into the live web root.

Updating existing code is a more elaborate process. The first step is a selection form where the user is presented with a table of installed projects that are missing newer releases. The user selects which projects they wish to upgrade, and presses the "Download updates" button to continue. This sets up a batch to fetch all the selected releases, and redirects to admin/update/download to display the batch progress bar as it runs. Each batch operation is responsible for downloading a single file, extracting the archive, and verifying the contents. If there are any errors, the user is redirected back to the first page with the error messages. If all downloads were extacted and verified, the user is instead redirected to admin/update/ready, a landing page which reminds them to backup their database and asks if they want to put the site offline during the upgrade. Once the user presses the "Install updates" button, they are redirected to authorize.php to supply their web root file access credentials. The authorized operation (which lives in update.authorize.inc) sets up a batch to copy each extracted update from the temporary location into the live web root.

Functions

NameDescription
theme_update_manager_update_formTheme the first page in the update manager wizard to select projects.
update_manager_archive_extractUnpack a downloaded archive file.
update_manager_archive_verifyVerify an archive after it has been downloaded and extracted.
update_manager_batch_project_getBatch operation: download, unpack, and verify a project.
update_manager_download_batch_finishedBatch callback invoked when the download batch is completed.
update_manager_file_getCopies a file from $url to the temporary directory for updates.
update_manager_install_formBuild the form for the update manager page to install new projects.
update_manager_install_form_submitHandle form submission when installing new projects via the update manager.
update_manager_install_form_validateValidate the form for installing a new project via the update manager.
update_manager_update_formBuild the form for the update manager page to update existing projects.
update_manager_update_form_submitSubmit function for the main update form.
update_manager_update_form_validateValidation callback to ensure that at least one project is selected.
update_manager_update_ready_formBuild the form when the site is ready to update (after downloading).
update_manager_update_ready_form_submitSubmit handler for the form to confirm that an update should continue.
_update_manager_extract_directoryReturn the directory where update archive files should be extracted.