_update_create_fetch_task
function _update_create_fetch_task
_update_create_fetch_task($project)
Adds a task to the queue for fetching release history data for a project.
We only create a new fetch task if there's no task already in the queue for this particular project (based on 'fetch_task::' entries in the {cache_update} table).
Parameters
$project: Associative array of information about a project as created by update_get_projects(), including keys such as 'name' (short name), and the 'info' array with data from a .info file for the project.
See also
File
- modules/update/update.fetch.inc, line 243
- Code required only when fetching information about available updates.
Code
function _update_create_fetch_task($project) { $fetch_tasks = &drupal_static(__FUNCTION__, array()); if (empty($fetch_tasks)) { $fetch_tasks = _update_get_cache_multiple('fetch_task'); } $cid = 'fetch_task::' . $project['name']; if (empty($fetch_tasks[$cid])) { $queue = DrupalQueue::get('update_fetch_tasks'); $queue->createItem($project); // Due to race conditions, it is possible that another process already // inserted a row into the {cache_update} table and the following query will // throw an exception. // @todo: Remove the need for the manual check by relying on a queue that // enforces unique items. try { db_insert('cache_update') ->fields(array( 'cid' => $cid, 'created' => REQUEST_TIME, )) ->execute(); } catch (Exception $e) { // The exception can be ignored safely. } $fetch_tasks[$cid] = REQUEST_TIME; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!update!update.fetch.inc/function/_update_create_fetch_task/7.x