Merge "PostgreSQL: Improve dropping of foreign key constraint"
[lhc/web/wiklou.git] / includes / WebRequest.php
index 1cbdbf9..f86a454 100644 (file)
@@ -138,7 +138,7 @@ class WebRequest {
                                        );
                                }
 
-                               wfRunHooks( 'WebRequestPathInfoRouter', array( $router ) );
+                               Hooks::run( 'WebRequestPathInfoRouter', array( $router ) );
 
                                $matches = $router->parse( $path );
                        }
@@ -207,9 +207,9 @@ class WebRequest {
         * @return array
         */
        public static function detectProtocol() {
-               if ( ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ||
+               if ( ( !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) ||
                        ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
-                       $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) ) {
+                       $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) ) {
                        return 'https';
                } else {
                        return 'http';
@@ -705,21 +705,22 @@ class WebRequest {
 
        /**
         * Take an arbitrary query and rewrite the present URL to include it
+        * @deprecated Use appendQueryValue/appendQueryArray instead
         * @param string $query Query string fragment; do not include initial '?'
-        *
         * @return string
         */
        public function appendQuery( $query ) {
+               wfDeprecated( __METHOD__, '1.25' );
                return $this->appendQueryArray( wfCgiToArray( $query ) );
        }
 
        /**
         * @param string $key
         * @param string $value
-        * @param bool $onlyquery
+        * @param bool $onlyquery [deprecated]
         * @return string
         */
-       public function appendQueryValue( $key, $value, $onlyquery = false ) {
+       public function appendQueryValue( $key, $value, $onlyquery = true ) {
                return $this->appendQueryArray( array( $key => $value ), $onlyquery );
        }
 
@@ -727,16 +728,21 @@ class WebRequest {
         * Appends or replaces value of query variables.
         *
         * @param array $array Array of values to replace/add to query
-        * @param bool $onlyquery Whether to only return the query string and not the complete URL
+        * @param bool $onlyquery Whether to only return the query string and not the complete URL [deprecated]
         * @return string
         */
-       public function appendQueryArray( $array, $onlyquery = false ) {
+       public function appendQueryArray( $array, $onlyquery = true ) {
                global $wgTitle;
                $newquery = $this->getQueryValues();
                unset( $newquery['title'] );
                $newquery = array_merge( $newquery, $array );
                $query = wfArrayToCgi( $newquery );
-               return $onlyquery ? $query : $wgTitle->getLocalURL( $query );
+               if ( !$onlyquery ) {
+                       wfDeprecated( __METHOD__, '1.25' );
+                       return $wgTitle->getLocalURL( $query );
+               }
+
+               return $query;
        }
 
        /**
@@ -1112,7 +1118,7 @@ HTML;
                }
 
                # Allow extensions to improve our guess
-               wfRunHooks( 'GetIP', array( &$ip ) );
+               Hooks::run( 'GetIP', array( &$ip ) );
 
                if ( !$ip ) {
                        throw new MWException( "Unable to determine IP." );