summaryrefslogtreecommitdiff
path: root/modules/update/update.api.php
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-06-05 01:04:11 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-06-05 01:04:11 +0000
commitc86883271aa54d12b3e0d377fcca4473a3ea077c (patch)
tree391aa4d4bfcd1bd6739bcc65da5730a074848f6a /modules/update/update.api.php
parentaba81ab9ddebb1ec20f5348d011ee714a1912941 (diff)
downloadbrdo-c86883271aa54d12b3e0d377fcca4473a3ea077c.tar.gz
brdo-c86883271aa54d12b3e0d377fcca4473a3ea077c.tar.bz2
#445748 by dww and Dave Reid: Add a hook_update_projects_alter() for modules that wish to do modify data in update status module.
Diffstat (limited to 'modules/update/update.api.php')
-rw-r--r--modules/update/update.api.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/modules/update/update.api.php b/modules/update/update.api.php
index 07a2278bb..a7dd3f698 100644
--- a/modules/update/update.api.php
+++ b/modules/update/update.api.php
@@ -12,6 +12,70 @@
*/
/**
+ * Alter the list of projects before fetching data and comparing versions.
+ *
+ * Most modules will never need to implement this hook. It is for advanced
+ * interaction with the update status module: mere mortals need not apply.
+ * The primary use-case for this hook is to add projects to the list, for
+ * example, to provide update status data on disabled modules and themes. A
+ * contributed module might want to hide projects from the list, for example,
+ * if there is a site-specific module that doesn't have any official releases,
+ * that module could remove itself from this list to avoid "No available
+ * releases found" warnings on the available updates report. In rare cases, a
+ * module might want to alter the data associated with a project already in
+ * the list.
+ *
+ * @param $projects
+ * Reference to an array of the projects installed on the system. This
+ * includes all the metadata documented in the comments below for each
+ * project (either module or theme) that is currently enabled. The array is
+ * initially populated inside update_get_projects() with the help of
+ * _update_process_info_list(), so look there for examples of how to
+ * populate the array with real values.
+ *
+ * @see update_get_projects()
+ * @see _update_process_info_list()
+ */
+function hook_update_projects_alter(&$projects) {
+ // Hide a site-specific module from the list.
+ unset($projects['site_specific_module']);
+
+ // Add a disabled module to the list.
+ // The key for the array should be the machine-readable project "short name".
+ $projects['disabled_project_name'] = array(
+ // Machine-readable project short name (same as the array key above).
+ 'name' => 'disabled_project_name',
+ // Array of values from the main .info file for this project.
+ 'info' => array(
+ 'name' => 'Some disabled module',
+ 'description' => 'A module not enabled on the site that you want to see in the available updates report.',
+ 'version' => '7.x-1.0',
+ 'core' => '7.x',
+ // The maximum file change time (the "ctime" returned by the filectime()
+ // PHP method) for all of the .info files included in this project.
+ '_info_file_ctime' => 1243888165,
+ ),
+ // The date stamp when the project was released, if known. If the disabled
+ // project was an officially packaged release from drupal.org, this will
+ // be included in the .info file as the 'datestamp' field. This only
+ // really matters for development snapshot releases that are regenerated,
+ // so it can be left undefined or set to 0 in most cases.
+ 'datestamp' => 1243888185,
+ // Any modules (or themes) included in this project. Keyed by machine-
+ // readable "short name", value is the human-readable project name printed
+ // in the UI.
+ 'includes' => array(
+ 'disabled_project' => 'Disabled module',
+ 'disabled_project_helper' => 'Disabled module helper module',
+ 'disabled_project_foo' => 'Disabled module foo add-on module',
+ ),
+ // Does this project contain a 'module', 'theme', 'disabled-module', or
+ // 'disabled-theme'?
+ 'project_type' => 'disabled-module',
+ );
+}
+
+/**
* Alter the information about available updates for projects.
*
* @param $projects