Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

API CHANGE Static functions Director::redirect(), Director::redirectB…

…ack(),

Director::set_status_code(), Director::get_status_code() and
Director::redirected_to() are now deprecated. Use Controller->redirect(),
Controller->redirectBack(), Controller->getResponse()->setStatusCode(),
Controller->getResponse()->getStatusCode() and
Controller->redirectedTo() respectively.
  • Loading branch information...
commit f7f67d90a59d637496a75bc86966b0d02bdd92de 1 parent 4267c03
@halkyon halkyon authored
Showing with 9 additions and 2 deletions.
  1. +1 −2  control/Controller.php
  2. +8 −0 control/Director.php
View
3  control/Controller.php
@@ -434,8 +434,7 @@ function popCurrent() {
}
/**
- * Redirct to the given URL.
- * It is generally recommended to call Director::redirect() rather than calling this function directly.
+ * Redirect to the given URL.
*/
function redirect($url, $code=302) {
if(!$this->response) $this->response = new SS_HTTPResponse();
View
8 control/Director.php
@@ -397,33 +397,41 @@ static function protocol() {
/**
* Redirect to another page.
+ * @deprecated 2.5 Use Controller->redirect()
* - $url can be an absolute URL
* - or it can be a URL relative to the "site base"
* - if it is just a word without an slashes, then it redirects to another action on the current controller.
*/
static function redirect($url, $code=302) {
+ Deprecation::notice('2.5', 'Use Controller->redirect() instead.');
Controller::curr()->redirect($url, $code);
}
/**
* Tests whether a redirection has been requested.
+ * @deprecated 2.5 Use Controller->redirectedTo() instead
* @return string If redirect() has been called, it will return the URL redirected to. Otherwise, it will return null;
*/
static function redirected_to() {
+ Deprecation::notice('2.5', 'Use Controller->redirectedTo() instead.');
return Controller::curr()->redirectedTo();
}
/**
* Sets the HTTP status code
+ * @deprecated 2.5 Use Controller->getResponse()->setStatusCode() instead
*/
static function set_status_code($code) {
+ Deprecation::notice('2.5', 'Use Controller->getResponse()->setStatusCode() instead');
return Controller::curr()->getResponse()->setStatusCode($code);
}
/**
* Returns the current HTTP status code
+ * @deprecated 2.5 Use Controller->getResponse()->getStatusCode() instead
*/
static function get_status_code() {
+ Deprecation::notice('2.5', 'Use Controller->getResponse()->getStatusCode() instead');
return Controller::curr()->getResponse()->getStatusCode();
}
Please sign in to comment.
Something went wrong with that request. Please try again.