summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-04-30 16:27:02 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-04-30 16:27:02 +0000
commit9d692bc28904566692d4de298bd40cc24f43da48 (patch)
treee1bde215e7b09aa82ba8611f0caf3b4799537fb7
parent9332e835da1fdf517ffb9306a6664dc4342edff0 (diff)
downloadbrdo-9d692bc28904566692d4de298bd40cc24f43da48.tar.gz
brdo-9d692bc28904566692d4de298bd40cc24f43da48.tar.bz2
#605270 by jhodgdon, dww, heyrocker: Fixed Document new update manager hooks.
-rw-r--r--modules/system/system.api.php60
-rw-r--r--modules/update/update.api.php23
2 files changed, 83 insertions, 0 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index b292d3fee..dd1c801cc 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -3789,6 +3789,66 @@ function hook_token_info_alter(&$data) {
);
}
+
+/**
+ * Provide information on Updaters (classes that can update Drupal).
+ *
+ * An Updater is a class that knows how to update various parts of the Drupal
+ * file system, for example to update modules that have newer releases, or to
+ * install a new theme.
+ *
+ * @return
+ * An associative array of information about the updater(s) being provided.
+ * This array is keyed by a unique identifier for each updater, and the
+ * values are subarrays that can contain the following keys:
+ * - class: The name of the PHP class which implements this updater.
+ * - name: Human-readable name of this updater.
+ * - weight: Controls what order the Updater classes are consulted to decide
+ * which one should handle a given task. When an update task is being run,
+ * the system will loop through all the Updater classes defined in this
+ * registry in weight order and let each class respond to the task and
+ * decide if each Updater wants to handle the task. In general, this
+ * doesn't matter, but if you need to override an existing Updater, make
+ * sure your Updater has a lighter weight so that it comes first.
+ *
+ * @see drupal_get_updaters()
+ * @see hook_updater_info_alter()
+ */
+function hook_updater_info() {
+ return array(
+ 'module' => array(
+ 'class' => 'ModuleUpdater',
+ 'name' => t('Update modules'),
+ 'weight' => 0,
+ ),
+ 'theme' => array(
+ 'class' => 'ThemeUpdater',
+ 'name' => t('Update themes'),
+ 'weight' => 0,
+ ),
+ );
+}
+
+/**
+ * Alter the Updater information array.
+ *
+ * An Updater is a class that knows how to update various parts of the Drupal
+ * file system, for example to update modules that have newer releases, or to
+ * install a new theme.
+ *
+ * @param array $updaters
+ * Associative array of updaters as defined through hook_updater_info().
+ * Alter this array directly.
+ *
+ * @see drupal_get_updaters()
+ * @see hook_updater_info()
+ */
+function hook_updater_info_alter(&$updaters) {
+ // Adjust weight so that the theme Updater gets a chance to handle a given
+ // update task before module updaters.
+ $updaters['theme']['weight'] = -1;
+}
+
/**
* Alter the default country list.
*
diff --git a/modules/update/update.api.php b/modules/update/update.api.php
index f28b6c0bf..b02b22300 100644
--- a/modules/update/update.api.php
+++ b/modules/update/update.api.php
@@ -105,5 +105,28 @@ function hook_update_status_alter(&$projects) {
}
/**
+ * Verify an archive after it has been downloaded and extracted.
+ *
+ * @param string $project
+ * The short name of the project that has been downloaded.
+ * @param string $archive_file
+ * The filename of the unextracted archive.
+ * @param string $directory
+ * The directory that the archive was extracted into.
+ *
+ * @return
+ * If there is a problem, return any non-null value. If there is no problem,
+ * don't return anything (null).
+ *
+ * @see update_manager_archive_verify()
+ */
+function hook_verify_update_archive($project, $archive_file, $directory) {
+ if (!file_exists($directory)) {
+ return TRUE;
+ }
+ // Add other checks on the archive integrity here.
+}
+
+/**
* @} End of "addtogroup hooks".
*/