From 5ab3ae037114f1dcdce23a3d7b8ce064837197d6 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 27 Feb 2018 15:55:34 -0800 Subject: [PATCH] User: Remove ::setCookie/etc., deprecated in 1.27 Change-Id: I6b37ffd957cdeba79037dadd36f50e0a0b89e5f5 --- RELEASE-NOTES-1.31 | 6 ++++ includes/user/User.php | 70 ------------------------------------------ 2 files changed, 6 insertions(+), 70 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 78d24f3638..0c4bc680ef 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -269,6 +269,12 @@ changes to languages because of Phabricator reports. * The DeferredStringifier class is deprecated, use Message::listParam() instead. * The type string for the parameter $lang of DateFormatter::getInstance is deprecated. +* In User, the cookie-related methods which were wrappers for the functions on the response + object, and were deprecated in 1.27, have been removed: + * ::setCookie() + * ::clearCookie() + * ::setExtendedLoginCookie() + Note that User::setCookies() remains, and is not deprecated. * The global functions wfProfileIn and wfProfileOut, deprecated in 1.25, have been removed. == Compatibility == diff --git a/includes/user/User.php b/includes/user/User.php index 3102cfcf10..ab791b4caa 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -4052,76 +4052,6 @@ class User implements IDBAccessObject, UserIdentity { } } - /** - * Set a cookie on the user's client. Wrapper for - * WebResponse::setCookie - * @deprecated since 1.27 - * @param string $name Name of the cookie to set - * @param string $value Value to set - * @param int $exp Expiration time, as a UNIX time value; - * if 0 or not specified, use the default $wgCookieExpiration - * @param bool $secure - * true: Force setting the secure attribute when setting the cookie - * false: Force NOT setting the secure attribute when setting the cookie - * null (default): Use the default ($wgCookieSecure) to set the secure attribute - * @param array $params Array of options sent passed to WebResponse::setcookie() - * @param WebRequest|null $request WebRequest object to use; $wgRequest will be used if null - * is passed. - */ - protected function setCookie( - $name, $value, $exp = 0, $secure = null, $params = [], $request = null - ) { - wfDeprecated( __METHOD__, '1.27' ); - if ( $request === null ) { - $request = $this->getRequest(); - } - $params['secure'] = $secure; - $request->response()->setCookie( $name, $value, $exp, $params ); - } - - /** - * Clear a cookie on the user's client - * @deprecated since 1.27 - * @param string $name Name of the cookie to clear - * @param bool $secure - * true: Force setting the secure attribute when setting the cookie - * false: Force NOT setting the secure attribute when setting the cookie - * null (default): Use the default ($wgCookieSecure) to set the secure attribute - * @param array $params Array of options sent passed to WebResponse::setcookie() - */ - protected function clearCookie( $name, $secure = null, $params = [] ) { - wfDeprecated( __METHOD__, '1.27' ); - $this->setCookie( $name, '', time() - 86400, $secure, $params ); - } - - /** - * Set an extended login cookie on the user's client. The expiry of the cookie - * is controlled by the $wgExtendedLoginCookieExpiration configuration - * variable. - * - * @see User::setCookie - * - * @deprecated since 1.27 - * @param string $name Name of the cookie to set - * @param string $value Value to set - * @param bool $secure - * true: Force setting the secure attribute when setting the cookie - * false: Force NOT setting the secure attribute when setting the cookie - * null (default): Use the default ($wgCookieSecure) to set the secure attribute - */ - protected function setExtendedLoginCookie( $name, $value, $secure ) { - global $wgExtendedLoginCookieExpiration, $wgCookieExpiration; - - wfDeprecated( __METHOD__, '1.27' ); - - $exp = time(); - $exp += $wgExtendedLoginCookieExpiration !== null - ? $wgExtendedLoginCookieExpiration - : $wgCookieExpiration; - - $this->setCookie( $name, $value, $exp, $secure ); - } - /** * Persist this user's session (e.g. set cookies) * -- 2.20.1