diff --git a/restws.install b/restws.install index 8c3872abedac3d4b63378a640a59fd8f11aec649..75784df57373481a578766fe638d9efce1af12e8 100644 --- a/restws.install +++ b/restws.install @@ -12,3 +12,10 @@ function restws_update_7001() { cache_clear_all(NULL, 'cache_page'); } + +/** + * Empty update to force a cache clear. + */ +function restws_update_7002() { + +} diff --git a/restws.module b/restws.module index 37812baf18637ab750ebf567cf3d741c4dab6df3..eb91d596290a99f19cfac92b44d6b29b62f69ac7 100644 --- a/restws.module +++ b/restws.module @@ -265,7 +265,7 @@ function restws_menu_alter(&$items) { else { $items[$menu_path] = array( 'page callback' => 'restws_page_callback', - 'page arguments' => array($resource), + 'page arguments' => array($resource, 'drupal_not_found'), 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); @@ -284,7 +284,7 @@ function restws_menu_alter(&$items) { else { $items[$menu_path] = array( 'page callback' => 'restws_page_callback', - 'page arguments' => array($resource), + 'page arguments' => array($resource, 'drupal_not_found'), 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); @@ -305,7 +305,7 @@ function restws_menu_alter(&$items) { else { $items["$menu_path.$format"] = array( 'page callback' => 'restws_page_callback', - 'page arguments' => array($resource), + 'page arguments' => array($resource, 'drupal_not_found'), 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); @@ -316,8 +316,17 @@ function restws_menu_alter(&$items) { /** * Menu page callback. + * + * @param string $resource + * The name of the resource. + * @param string $page_callback + * The page callback to pass through when the request is not handled by this + * module. If no other pre-existing callback is used, 'drupal_not_found' + * should be passed explicitly. + * @param mixed $arg1,... + * Further arguments that are passed through to the given page callback. */ -function restws_page_callback($resource, $page_callback = NULL) { +function restws_page_callback($resource, $page_callback) { // Determine the position of the resource and resource id in the path. $resource_info = restws_get_resource_info($resource); $resource_pos = isset($resource_info['menu_path']) ? count(explode('/', $resource_info['menu_path'])) - 1 : 0; @@ -419,12 +428,9 @@ function restws_page_callback($resource, $page_callback = NULL) { // @todo: Determine human readable URIs and redirect, if there is no // page callback. - if (isset($page_callback)) { - // Further page callback arguments have been appended to our arguments. - $args = func_get_args(); - return call_user_func_array($page_callback, array_slice($args, 2)); - } - restws_terminate_request('404 Not Found'); + // Fall back to the passed $page_callback and pass through more arguments. + $args = func_get_args(); + return call_user_func_array($page_callback, array_slice($args, 2)); } /**