Commit b911f721 authored by webchick's avatar webchick

Issue #2195183 by cleaver, sandykadam, elgordogrande, jhodgdon, joachim, Eda,...

Issue #2195183 by cleaver, sandykadam, elgordogrande, jhodgdon, joachim, Eda, hussainweb: document Batch API callbacks as callback implementations
parent c3425bd2
......@@ -1844,7 +1844,9 @@ function install_finished(&$install_state) {
}
/**
* Batch callback for batch installation of modules.
* Implements callback_batch_operation().
*
* Performs batch installation of modules.
*/
function _install_module_batch($module, $module_name, &$context) {
// Install and enable the module right away, so that the module will be
......
......@@ -150,6 +150,8 @@ function update_set_schema($module, $schema_version) {
}
/**
* Implements callback_batch_operation().
*
* Performs one update and stores the results for display on the results page.
*
* If an update function completes successfully, it should return a message
......
......@@ -15,7 +15,7 @@
require_once __DIR__ . '/locale.translation.inc';
/**
* Batch operation callback: Check status of a remote and local po file.
* Implements callback_batch_operation().
*
* Checks the presence and creation time po translation files in located at
* remote server location and local file system.
......@@ -83,7 +83,9 @@ function locale_translation_batch_status_check($project, $langcode, array $optio
}
/**
* Batch finished callback: Set result message.
* Implements callback_batch_finished().
*
* Set result message.
*
* @param bool $success
* TRUE if batch successfully completed.
......@@ -119,7 +121,7 @@ function locale_translation_batch_status_finished($success, $results) {
}
/**
* Batch operation: Download a remote translation file.
* Implements callback_batch_operation().
*
* Downloads a remote gettext file into the translations directory. When
* successfully the translation status is updated.
......@@ -150,7 +152,7 @@ function locale_translation_batch_fetch_download($project, $langcode, &$context)
}
/**
* Batch process: Import translation file.
* Implements callback_batch_operation().
*
* Imports a gettext file from the translation directory. When successfully the
* translation status is updated.
......@@ -199,7 +201,9 @@ function locale_translation_batch_fetch_import($project, $langcode, $options, &$
}
/**
* Batch finished callback: Set result message.
* Implements callback_batch_finished().
*
* Set result message.
*
* @param bool $success
* TRUE if batch successfully completed.
......
......@@ -165,7 +165,9 @@ function locale_translate_batch_build(array $files, array $options) {
}
/**
* Perform interface translation import as a batch step.
* Implements callback_batch_operation().
*
* Perform interface translation import.
*
* @param object $file
* A file object of the gettext file to be imported. The file object must
......@@ -262,7 +264,9 @@ function locale_translate_batch_import($file, array $options, array &$context) {
}
/**
* Batch callback: Save data of imported files.
* Implements callback_batch_operation().
*
* Save data of imported files.
*
* @param array $context
* Contains a list of imported files.
......@@ -285,6 +289,8 @@ function locale_translate_batch_import_save(array $context) {
}
/**
* Implements callback_batch_operation().
*
* Refreshs translations after importing strings.
*
* @param array $context
......@@ -346,6 +352,8 @@ function locale_translate_batch_refresh(array &$context) {
}
/**
* Implements callback_batch_finished().
*
* Finished callback of system page locale import batch.
*
* @param bool $success
......@@ -581,7 +589,9 @@ function locale_config_batch_build(array $names, array $langcodes, array $option
}
/**
* Performs configuration translation refresh as a batch step.
* Implements callback_batch_operation().
*
* Performs configuration translation refresh.
*
* @param array $names
* An array of names of configuration objects to update.
......@@ -605,6 +615,8 @@ function locale_config_batch_refresh_name(array $names, array $langcodes, array
}
/**
* Implements callback_batch_finished().
*
* Finishes callback of system page locale import batch.
*
* @param bool $success
......
......@@ -95,6 +95,8 @@ function _node_mass_update_helper(NodeInterface $node, array $updates, $langcode
}
/**
* Implements callback_batch_operation().
*
* Executes a batch operation for node_mass_update().
*
* @param array $nodes
......@@ -143,6 +145,8 @@ function _node_mass_update_batch_process(array $nodes, array $updates, $load, $r
}
/**
* Implements callback_batch_finished().
*
* Reports the 'finished' status of batch operation for node_mass_update().
*
* @param bool $success
......
......@@ -1179,6 +1179,8 @@ function node_access_rebuild($batch_mode = FALSE) {
}
/**
* Implements callback_batch_operation().
*
* Performs batch operation for node_access_rebuild().
*
* This is a multistep operation: we go through all nodes by packs of 20. The
......@@ -1223,6 +1225,8 @@ function _node_access_rebuild_batch_operation(&$context) {
}
/**
* Implements callback_batch_finished().
*
* Performs post-processing for node_access_rebuild().
*
* @param bool $success
......
......@@ -297,7 +297,7 @@ function simpletest_phpunit_command() {
}
/**
* Batch operation callback.
* Implements callback_batch_operation().
*/
function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
simpletest_classloader_register();
......@@ -361,6 +361,9 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
$context['finished'] = 1 - $size / $max;
}
/**
* Implements callback_batch_finished().
*/
function _simpletest_batch_finished($success, $results, $operations, $elapsed) {
if ($success) {
drupal_set_message(t('The test run finished in @elapsed.', array('@elapsed' => $elapsed)));
......
......@@ -8,6 +8,8 @@
use Drupal\Component\Utility\SafeMarkup;
/**
* Implements callback_batch_operation().
*
* Performs a simple batch operation.
*/
function _batch_test_callback_1($id, $sleep, &$context) {
......@@ -21,6 +23,8 @@ function _batch_test_callback_1($id, $sleep, &$context) {
}
/**
* Implements callback_batch_operation().
*
* Performs a multistep batch operation.
*/
function _batch_test_callback_2($start, $total, $sleep, &$context) {
......@@ -54,7 +58,7 @@ function _batch_test_callback_2($start, $total, $sleep, &$context) {
}
/**
* Performs a simple batch operation.
* Implements callback_batch_operation().
*/
function _batch_test_callback_5($id, $sleep, &$context) {
// No-op, but ensure the batch take a couple iterations.
......@@ -69,6 +73,8 @@ function _batch_test_callback_5($id, $sleep, &$context) {
}
/**
* Implements callback_batch_operation().
*
* Performs a batch operation setting up its own batch.
*/
function _batch_test_nested_batch_callback() {
......@@ -100,6 +106,8 @@ function _batch_test_finished_helper($batch_id, $success, $results, $operations)
}
/**
* Implements callback_batch_finished().
*
* Triggers 'finished' callback for batch 0.
*/
function _batch_test_finished_0($success, $results, $operations) {
......@@ -107,6 +115,8 @@ function _batch_test_finished_0($success, $results, $operations) {
}
/**
* Implements callback_batch_finished().
*
* Triggers 'finished' callback for batch 1.
*/
function _batch_test_finished_1($success, $results, $operations) {
......@@ -114,6 +124,8 @@ function _batch_test_finished_1($success, $results, $operations) {
}
/**
* Implements callback_batch_finished().
*
* Triggers 'finished' callback for batch 2.
*/
function _batch_test_finished_2($success, $results, $operations) {
......@@ -121,6 +133,8 @@ function _batch_test_finished_2($success, $results, $operations) {
}
/**
* Implements callback_batch_finished().
*
* Triggers 'finished' callback for batch 3.
*/
function _batch_test_finished_3($success, $results, $operations) {
......@@ -128,6 +142,8 @@ function _batch_test_finished_3($success, $results, $operations) {
}
/**
* Implements callback_batch_finished().
*
* Triggers 'finished' callback for batch 4.
*/
function _batch_test_finished_4($success, $results, $operations) {
......@@ -135,6 +151,8 @@ function _batch_test_finished_4($success, $results, $operations) {
}
/**
* Implements callback_batch_finished().
*
* Triggers 'finished' callback for batch 5.
*/
function _batch_test_finished_5($success, $results, $operations) {
......
......@@ -154,7 +154,9 @@ function _batch_test_batch_5() {
}
/**
* Tests the progress page theme by performing a batch callback.
* Implements callback_batch_operation().
*
* Tests the progress page theme.
*/
function _batch_test_theme_callback() {
// Because drupalGet() steps through the full progressive batch before
......
......@@ -102,7 +102,9 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l
}
/**
* Batch callback: Copies project to its proper place when authorized to do so.
* Implements callback_batch_operation().
*
* Copies project to its proper place when authorized to do so.
*
* @param string $project
* The canonical short name of the project being installed.
......@@ -240,7 +242,9 @@ function update_authorize_update_batch_finished($success, $results) {
}
/**
* Batch callback: Performs actions when the authorized install batch is done.
* Implements callback_batch_finished().
*
* Performs actions when the authorized install batch is done.
*
* This processes the results and stashes them into SESSION such that
* authorize.php will render a report. Also responsible for putting the site
......
......@@ -224,7 +224,9 @@ function update_manager_file_get($url) {
}
/**
* Batch callback: Downloads, unpacks, and verifies a project.
* Implements callback_batch_operation().
*
* Downloads, unpacks, and verifies a project.
*
* This function assumes that the provided URL points to a file archive of some
* sort. The URL can have any scheme that we have a file stream wrapper to
......
......@@ -786,7 +786,9 @@ function user_cancel($edit, $uid, $method) {
}
/**
* Last batch processing step for cancelling a user account.
* Implements callback_batch_operation().
*
* Last step for cancelling a user account.
*
* Since batch and session API require a valid user account, the actual
* cancellation of a user account needs to happen last.
......@@ -833,6 +835,8 @@ function _user_cancel($edit, $account, $method) {
}
/**
* Implements callback_batch_finished().
*
* Finished batch processing callback for cancelling a user account.
*
* @see user_cancel()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment