The offload module allows site admins to prune older data from sites with heavy workloads in order to maintain performance without having to lose the historical data. It achieves this result by allowing a non-web back-office to automatically replicate historical data to a back office database, then remove the replicated data from the historical table within Drupal.

'); break; } return $ret; } /* * Implementation of hook_menu(). */ function offload_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array( 'path' => 'admin/settings/offload', 'title' => t('History off-load '), 'callback' => 'drupal_get_form', 'callback arguments' => array('offload_settings'), 'access' => user_access(OFFLOADPERM), ); } return $items; } function offload_perm() { return array ( OFFLOADPERM, ); } function offload_settings() { $ar1 = variable_get(OFFLOADVARTABLES, array( array('accesslog', 'aid', NULL)) /* table name, id, highest key offloaded */ ); $ar2 = array(); foreach ($ar1 as $table) { $ar2[] = "{$table[0]} ({$table[1]} = {$table[2]})"; } $form[OFFLOADVARIP] = array( '#type' => 'textfield', '#title' => t('Client IP address'), '#default_value' => variable_get(OFFLOADVARIP, '127.0.0.1'), '#description' => t('The single IP address allowed to use the offload module as a client. Be warned that, in shared hosting situations, the default 127.0.0.1 may not be safe'), ); $form['info']= array( '#type' => 'fieldset', '#title' => t('Tables configured for offload'), '#description' => t('In future versions, this will be settable. For now the list is hardcoded'), ); $form['info']['tables'] = array( '#type' => 'markup', '#value' => theme('item_list', $ar2), ); $form['advanced'] = array( '#type' => 'fieldset', '#title' => t('Advanced information'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['advanced']['version'] = array( '#type' => 'markup', '#description' => 'CVS Version', '#value' => OFFLOADVERSION, '#prefix' => '

', '#suffix' => '

CVS Version
', ); return system_settings_form($form); } function offload_xmlrpc() { return array( 'offload.info' => 'offload_info', 'offload.login' => 'offload_authenticate', 'offload.table_status' => 'offload_table_status', ); } function offload_info() { return t('Offload module is alive'); } function offload_authenticate($name, $pass) { $ret = user_authenticate($name, $pass); return $ret; } function offload_table_status($ar_tables) { global $db_prefix; $sq = 'SHOW TABLE STATUS'; $q = db_query($sq); $len = strlen($db_prefix); while ($row = db_fetch_array($q)) { if (strncmp($row['Name'], $db_prefix, $len) !== 0) continue; $name = substr($row['Name'], $len); if (array_key_exists($name, $ar_tables)) { $ar_tables[$name]['remote'] = $row['Rows']; } } return $ar_tables; }