- Patch #1329410 by Gábor Hojtsy, Sutharsan, dww: Extend update data collection to support localization update.
parent
bac3ed7764
commit
d4cf91211f
|
@ -29,11 +29,11 @@
|
||||||
* includes all the metadata documented in the comments below for each
|
* includes all the metadata documented in the comments below for each
|
||||||
* project (either module or theme) that is currently enabled. The array is
|
* project (either module or theme) that is currently enabled. The array is
|
||||||
* initially populated inside update_get_projects() with the help of
|
* initially populated inside update_get_projects() with the help of
|
||||||
* _update_process_info_list(), so look there for examples of how to
|
* update_process_info_list(), so look there for examples of how to
|
||||||
* populate the array with real values.
|
* populate the array with real values.
|
||||||
*
|
*
|
||||||
* @see update_get_projects()
|
* @see update_get_projects()
|
||||||
* @see _update_process_info_list()
|
* @see update_process_info_list()
|
||||||
*/
|
*/
|
||||||
function hook_update_projects_alter(&$projects) {
|
function hook_update_projects_alter(&$projects) {
|
||||||
// Hide a site-specific module from the list.
|
// Hide a site-specific module from the list.
|
||||||
|
|
|
@ -37,11 +37,11 @@ function update_get_projects() {
|
||||||
// Still empty, so we have to rebuild the cache.
|
// Still empty, so we have to rebuild the cache.
|
||||||
$module_data = system_rebuild_module_data();
|
$module_data = system_rebuild_module_data();
|
||||||
$theme_data = system_rebuild_theme_data();
|
$theme_data = system_rebuild_theme_data();
|
||||||
_update_process_info_list($projects, $module_data, 'module', TRUE);
|
update_process_info_list($projects, $module_data, 'module', TRUE);
|
||||||
_update_process_info_list($projects, $theme_data, 'theme', TRUE);
|
update_process_info_list($projects, $theme_data, 'theme', TRUE);
|
||||||
if (variable_get('update_check_disabled', FALSE)) {
|
if (variable_get('update_check_disabled', FALSE)) {
|
||||||
_update_process_info_list($projects, $module_data, 'module', FALSE);
|
update_process_info_list($projects, $module_data, 'module', FALSE);
|
||||||
_update_process_info_list($projects, $theme_data, 'theme', FALSE);
|
update_process_info_list($projects, $theme_data, 'theme', FALSE);
|
||||||
}
|
}
|
||||||
// Allow other modules to alter projects before fetching and comparing.
|
// Allow other modules to alter projects before fetching and comparing.
|
||||||
drupal_alter('update_projects', $projects);
|
drupal_alter('update_projects', $projects);
|
||||||
|
@ -75,10 +75,12 @@ function update_get_projects() {
|
||||||
* @param $status
|
* @param $status
|
||||||
* Boolean that controls what status (enabled or disabled) to process out of
|
* Boolean that controls what status (enabled or disabled) to process out of
|
||||||
* the $list and add to the $projects array.
|
* the $list and add to the $projects array.
|
||||||
|
* @param $additional_whitelist
|
||||||
|
* Array of additional elements to be collected from the .info file.
|
||||||
*
|
*
|
||||||
* @see update_get_projects()
|
* @see update_get_projects()
|
||||||
*/
|
*/
|
||||||
function _update_process_info_list(&$projects, $list, $project_type, $status) {
|
function update_process_info_list(&$projects, $list, $project_type, $status, $additional_whitelist = array()) {
|
||||||
foreach ($list as $file) {
|
foreach ($list as $file) {
|
||||||
// A disabled base theme of an enabled sub-theme still has all of its code
|
// A disabled base theme of an enabled sub-theme still has all of its code
|
||||||
// run by the sub-theme, so we include it in our "enabled" projects list.
|
// run by the sub-theme, so we include it in our "enabled" projects list.
|
||||||
|
@ -175,7 +177,7 @@ function _update_process_info_list(&$projects, $list, $project_type, $status) {
|
||||||
'name' => $project_name,
|
'name' => $project_name,
|
||||||
// Only save attributes from the .info file we care about so we do not
|
// Only save attributes from the .info file we care about so we do not
|
||||||
// bloat our RAM usage needlessly.
|
// bloat our RAM usage needlessly.
|
||||||
'info' => update_filter_project_info($file->info),
|
'info' => update_filter_project_info($file->info, $additional_whitelist),
|
||||||
'datestamp' => $file->info['datestamp'],
|
'datestamp' => $file->info['datestamp'],
|
||||||
'includes' => array($file->name => $file->info['name']),
|
'includes' => array($file->name => $file->info['name']),
|
||||||
'project_type' => $project_display_type,
|
'project_type' => $project_display_type,
|
||||||
|
@ -768,13 +770,15 @@ function update_project_cache($cid) {
|
||||||
*
|
*
|
||||||
* @param array $info
|
* @param array $info
|
||||||
* Array of .info file data as returned by drupal_parse_info_file().
|
* Array of .info file data as returned by drupal_parse_info_file().
|
||||||
|
* @param $additional_whitelist
|
||||||
|
* Array of additional elements to be collected from the .info file.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* Array of .info file data we need for the Update manager.
|
* Array of .info file data we need for the Update manager.
|
||||||
*
|
*
|
||||||
* @see _update_process_info_list()
|
* @see update_process_info_list()
|
||||||
*/
|
*/
|
||||||
function update_filter_project_info($info) {
|
function update_filter_project_info($info, $additional_whitelist = array()) {
|
||||||
$whitelist = array(
|
$whitelist = array(
|
||||||
'_info_file_ctime',
|
'_info_file_ctime',
|
||||||
'datestamp',
|
'datestamp',
|
||||||
|
@ -785,5 +789,6 @@ function update_filter_project_info($info) {
|
||||||
'project status url',
|
'project status url',
|
||||||
'version',
|
'version',
|
||||||
);
|
);
|
||||||
|
$whitelist = array_merge($whitelist, $additional_whitelist);
|
||||||
return array_intersect_key($info, drupal_map_assoc($whitelist));
|
return array_intersect_key($info, drupal_map_assoc($whitelist));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue