You are here

对非节点的内容进行索引:hook_update_index()(4)

g089h515r806 的头像
Submitted by g089h515r806 on 星期四, 2009-08-20 15:06

 

register_shutdown_function()分配了一个函数,在为一个请求执行完PHP脚本以后将执行这个函数。因为在索引完所有的内容以前,PHP可能会终止运行,所以使用这个函数来追踪最后索引项目的ID。
 
/**
 * Shutdown function to make sure we remember the last element processed.
 */
function legacysearch_update_shutdown() {
    global $last_change, $last_id;
 
    if ($last_change && $last_id) {
        variable_set('legacysearch_cron_last', $last_change);
        variable_set('legacysearch_cron_last_id', $last_id);
    }
}

老葛的Drupal培训班 Think in Drupal

Drupal版本:

评论