summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries2012-06-02 19:41:40 (GMT)
committerDries2012-06-02 19:41:40 (GMT)
commit356aa34d9db3d48caf0b8de6c3ab471bc6ca57d4 (patch)
tree3b4b4cf85f42dd174b3f9abdadb73894950d32e1
parentb9133016385eeacc21cd57aa21281e0d337793d6 (diff)
- Patch #1587850 by pfrenssen, chrisdolby: replace drupal_not_found() with throw NotFoundHttpException.
-rw-r--r--core/includes/common.inc15
-rw-r--r--core/includes/file.inc2
-rw-r--r--core/modules/book/book.pages.inc5
-rw-r--r--core/modules/comment/comment.admin.inc3
-rw-r--r--core/modules/comment/comment.module3
-rw-r--r--core/modules/comment/comment.pages.inc3
-rw-r--r--core/modules/contact/contact.pages.inc5
-rw-r--r--core/modules/language/language.admin.inc5
-rw-r--r--core/modules/locale/locale.pages.inc4
-rw-r--r--core/modules/openid/tests/openid_test.module3
-rw-r--r--core/modules/search/search.module5
-rw-r--r--core/modules/statistics/statistics.admin.inc6
-rw-r--r--core/modules/statistics/statistics.pages.inc12
-rw-r--r--core/modules/user/user.module3
14 files changed, 36 insertions, 38 deletions
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 29f1ef1..3706049 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -699,18 +699,6 @@ function drupal_site_offline() {
}
/**
- * Delivers a "page not found" error to the browser.
- *
- * Page callback functions wanting to report a "page not found" message should
- * return MENU_NOT_FOUND instead of calling drupal_not_found(). However,
- * functions that are invoked in contexts where that return value might not
- * bubble up to menu_execute_active_handler() should call drupal_not_found().
- */
-function drupal_not_found() {
- throw new NotFoundHttpException();
-}
-
-/**
* Delivers an "access denied" error to the browser.
*
* Page callback functions wanting to report an "access denied" message should
@@ -2354,8 +2342,7 @@ function l($text, $path, array $options = array()) {
* Delivers a page callback result to the browser in the appropriate format.
*
* This function is most commonly called by menu_execute_active_handler(), but
- * can also be called by error conditions such as drupal_not_found(),
- * drupal_access_denied(), and drupal_site_offline().
+ * can also be called by error conditions such as drupal_site_offline().
*
* When a user requests a page, index.php calls menu_execute_active_handler(),
* which calls the 'page callback' function registered in hook_menu(). The page
diff --git a/core/includes/file.inc b/core/includes/file.inc
index f6cab86..d6d8470 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1997,7 +1997,7 @@ function file_transfer($uri, $headers) {
* modules returned headers the download will start with the returned headers.
* If a module returns -1 drupal_access_denied() will be returned. If the file
* exists but no modules responded drupal_access_denied() will be returned.
- * If the file does not exist drupal_not_found() will be returned.
+ * If the file does not exist a NotFoundHttpException will be thrown.
*
* @see hook_file_download()
* @see system_menu()
diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc
index aedde16..c00fb6f 100644
--- a/core/modules/book/book.pages.inc
+++ b/core/modules/book/book.pages.inc
@@ -6,6 +6,7 @@
*/
use Drupal\node\Node;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Page callback: Prints a listing of all books.
@@ -53,7 +54,7 @@ function book_export($type, $nid) {
}
else {
drupal_set_message(t('Unknown export format.'));
- drupal_not_found();
+ throw new NotFoundHttpException();
}
}
@@ -84,7 +85,7 @@ function book_export_html($nid) {
return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
- drupal_not_found();
+ throw new NotFoundHttpException();
}
}
else {
diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc
index 9eabe13..4329492 100644
--- a/core/modules/comment/comment.admin.inc
+++ b/core/modules/comment/comment.admin.inc
@@ -6,6 +6,7 @@
*/
use Drupal\comment\Comment;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Page callback: Presents an administrative comment listing.
@@ -260,7 +261,7 @@ function comment_confirm_delete_page($cid) {
if ($comment = comment_load($cid)) {
return drupal_get_form('comment_confirm_delete', $comment);
}
- drupal_not_found();
+ throw new NotFoundHttpException();
}
/**
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 58ea4a6..4fa8fee 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -10,6 +10,7 @@
*/
use Drupal\node\Node;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Comment is awaiting approval.
@@ -506,7 +507,7 @@ function comment_permalink($cid) {
$_GET['page'] = $page;
return menu_execute_active_handler('node/' . $node->nid, FALSE);
}
- drupal_not_found();
+ throw new NotFoundHttpException();
}
/**
diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc
index 2986d13..39b8a24 100644
--- a/core/modules/comment/comment.pages.inc
+++ b/core/modules/comment/comment.pages.inc
@@ -6,6 +6,7 @@
*/
use Drupal\node\Node;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Form constructor for the comment reply form.
@@ -122,5 +123,5 @@ function comment_approve($cid) {
drupal_set_message(t('Comment approved.'));
drupal_goto('node/' . $comment->nid);
}
- drupal_not_found();
+ throw new NotFoundHttpException();
}
diff --git a/core/modules/contact/contact.pages.inc b/core/modules/contact/contact.pages.inc
index bf096a7..a1c2926 100644
--- a/core/modules/contact/contact.pages.inc
+++ b/core/modules/contact/contact.pages.inc
@@ -5,6 +5,8 @@
* Page callbacks for the Contact module.
*/
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
/**
* Form constructor for the site-wide contact form.
*
@@ -41,8 +43,7 @@ function contact_site_form($form, &$form_state) {
drupal_set_message(t('The contact form has not been configured. <a href="@add">Add one or more categories</a> to the form.', array('@add' => url('admin/structure/contact/add'))), 'error');
}
else {
- drupal_not_found();
- drupal_exit();
+ throw new NotFoundHttpException();
}
}
diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc
index c124b9e..8fe85be 100644
--- a/core/modules/language/language.admin.inc
+++ b/core/modules/language/language.admin.inc
@@ -5,6 +5,8 @@
* Administration functions for language.module.
*/
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
/**
* User interface for the language overview screen.
*/
@@ -375,8 +377,7 @@ function language_admin_delete_form($form, &$form_state, $language) {
$languages = language_list();
if (!isset($languages[$langcode])) {
- drupal_not_found();
- drupal_exit();
+ throw new NotFoundHttpException();
}
else {
$form['langcode'] = array('#type' => 'value', '#value' => $langcode);
diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc
index 8f26052..3b2d2ab 100644
--- a/core/modules/locale/locale.pages.inc
+++ b/core/modules/locale/locale.pages.inc
@@ -5,6 +5,8 @@
* Interface translation summary, editing and deletion user interfaces.
*/
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
/**
* String search screen.
*/
@@ -511,7 +513,7 @@ function locale_translate_delete_page($lid) {
return drupal_get_form('locale_translate_delete_form', $source);
}
else {
- return drupal_not_found();
+ throw new NotFoundHttpException();
}
}
diff --git a/core/modules/openid/tests/openid_test.module b/core/modules/openid/tests/openid_test.module
index 4481818..89f3ddf 100644
--- a/core/modules/openid/tests/openid_test.module
+++ b/core/modules/openid/tests/openid_test.module
@@ -22,6 +22,7 @@
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Implements hook_menu().
@@ -98,7 +99,7 @@ function openid_test_yadis_xrds() {
// that the XRI has been properly encoded. The "+" sign in the _xrd_r query
// parameter is decoded to a space by PHP.
if (arg(3) == 'xri' && (arg(4) != '@example*résumé;%25' || $_GET['_xrd_r'] != 'application/xrds xml')) {
- drupal_not_found();
+ throw new NotFoundHttpException();
}
$output = '<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)" xmlns:openid="http://openid.net/xmlns/1.0">
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index 1ad7a85..f567dae 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -1034,9 +1034,8 @@ function search_box($form, &$form_state, $form_id) {
*/
function search_box_form_submit($form, &$form_state) {
// The search form relies on control of the redirect destination for its
- // functionality, so we override any static destination set in the request,
- // for example by drupal_access_denied() or drupal_not_found()
- // (see http://drupal.org/node/292565).
+ // functionality, so we override any static destination set in the request.
+ // See http://drupal.org/node/292565.
if (isset($_GET['destination'])) {
unset($_GET['destination']);
}
diff --git a/core/modules/statistics/statistics.admin.inc b/core/modules/statistics/statistics.admin.inc
index 87ae6a5..ea608a4 100644
--- a/core/modules/statistics/statistics.admin.inc
+++ b/core/modules/statistics/statistics.admin.inc
@@ -5,6 +5,8 @@
* Admin page callbacks for the Statistics module.
*/
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
/**
* Page callback: Displays the "recent hits" page.
*
@@ -225,7 +227,7 @@ function statistics_top_referrers() {
*
* @return array
* A render array containing page access statistics. If information for the
- * page was not found, drupal_not_found() is called.
+ * page was not found, a NotFoundHttpException is thrown.
*/
function statistics_access_log($aid) {
$access = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = :aid', array(':aid' => $aid))->fetch();
@@ -264,7 +266,7 @@ function statistics_access_log($aid) {
return $build;
}
else {
- drupal_not_found();
+ throw new NotFoundHttpException();
}
}
diff --git a/core/modules/statistics/statistics.pages.inc b/core/modules/statistics/statistics.pages.inc
index 1b776d1..586189a 100644
--- a/core/modules/statistics/statistics.pages.inc
+++ b/core/modules/statistics/statistics.pages.inc
@@ -5,13 +5,14 @@
* User page callbacks for the Statistics module.
*/
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
/**
* Page callback: Displays statistics for a node.
*
* @return array
* A render array containing node statistics. If information for the node was
- * not found, this will deliver a page not found error via
- * drupal_not_found().
+ * not found, this will throw a NotFoundHttpException.
*
* @see statistics_menu()
*/
@@ -58,7 +59,7 @@ function statistics_node_tracker() {
return $build;
}
else {
- drupal_not_found();
+ throw new NotFoundHttpException();
}
}
@@ -67,8 +68,7 @@ function statistics_node_tracker() {
*
* @return array
* A render array containing user statistics. If information for the user was
- * not found, this will deliver a page not found error via
- * drupal_not_found().
+ * not found, this will throw a NotFoundHttpException.
*
* @see statistics_menu()
*/
@@ -106,6 +106,6 @@ function statistics_user_tracker() {
return $build;
}
else {
- drupal_not_found();
+ throw new NotFoundHttpException();
}
}
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 09ef3f5..519500e 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -1,6 +1,7 @@
<?php
use Drupal\Core\Database\Query\SelectInterface;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @file
@@ -2333,7 +2334,7 @@ function user_view_page($account) {
}
// An administrator may try to view a non-existent account,
// so we give them a 404 (versus a 403 for non-admins).
- drupal_not_found();
+ throw new NotFoundHttpException();
}
/**