You are here

function paging_update_1 in Paging 6

Same name and namespace in other branches
  1. 5 paging.install \paging_update_1()

Implementation of hook_update_N().

File

./paging.install, line 27
Installation code for Paging module.

Code

function paging_update_1() {
  $ret = array();
  if (module_exists('search')) {
    module_invoke('node', 'search', 'reset');
    module_invoke('node', 'update_index');
    node_update_shutdown();
    $status = module_invoke('node', 'search', 'status');
    $percentage = (int) min(100, 100 * ($status['total'] - $status['remaining']) / max(1, $status['total'])) . '%';
    $ret[] = array(
      'success' => TRUE,
      'query' => t('!percentage of the site has been indexed.', array(
        '!percentage' => $percentage,
      )),
    );
  }
  return $ret;
}