/** * Standard modular run function for OcCLE hooks. * * @param array The options with which the command was called * @param array The parameters with which the command was called * @param array A reference to the OcCLE filesystem object * @return array Array of stdcommand, stdhtml, stdout, and stderr responses */ function run($options, $parameters, &$occle_fs) { if (array_key_exists('h', $options) || array_key_exists('help', $options)) { return array('', do_command_help('clear_caches', array('h'), array(true)), '', ''); } else { require_code('view_modes'); $_caches = mixed(); if (array_key_exists(0, $parameters)) { $_caches = array(); $caches = explode(',', $parameters[0]); foreach ($caches as $cache) { $_caches[] = trim($cache); } } $messages = static_evaluate_tempcode(ocportal_cleanup($_caches)); if ($messages == '') { $messages = do_lang('SUCCESS'); } return array('', $messages, '', ''); } }
/** * The actualiser for emptying caches. * * @return tempcode The UI */ function do_rebuild() { $hooks = find_all_hooks('modules', 'admin_cleanup'); // Fiddle the order a bit if (array_key_exists('ocf_topics', $hooks)) { unset($hooks['ocf_topics']); $hooks['ocf_topics'] = 'sources_custom'; } if (array_key_exists('ocf', $hooks)) { unset($hooks['ocf']); $hooks['ocf'] = 'sources_custom'; } if (array_key_exists('ocf_members', $hooks)) { unset($hooks['ocf_members']); $hooks['ocf_members'] = 'sources_custom'; } $todo = array(); foreach (array_keys($hooks) as $hook) { if (post_param_integer($hook, 0) == 1) { $todo[] = $hook; } } $messages = ocportal_cleanup($todo); $messages->attach(paragraph(do_lang_tempcode('SUCCESS'))); $title = get_page_title('CLEANUP_TOOLS'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CLEANUP_TOOLS')))); breadcrumb_set_self(do_lang_tempcode('DONE')); return do_template('CLEANUP_COMPLETED_SCREEN', array('_GUID' => '598510a9ad9f01f3c0806319b32b5033', 'TITLE' => $title, 'MESSAGES' => $messages)); }