Made loadFromFileCache() always disable $wgOut regardless of whether compression...
[lhc/web/wiklou.git] / includes / Title.php
index e034867..b5f9db4 100644 (file)
@@ -260,7 +260,8 @@ class Title {
         * Load Title object fields from a DB row.
         * If false is given, the title will be treated as non-existing.
         *
-        * @param $row Object|false database row
+        * @param $row Object|bool database row
+        * @return void
         */
        public function loadFromRow( $row ) {
                if ( $row ) { // page found
@@ -1218,8 +1219,18 @@ class Title {
 
        /**
         * Helper to fix up the get{Local,Full,Link,Canonical}URL args
+        * get{Canonical,Full,Link,Local}URL methods accepted an optional
+        * second argument named variant. This was deprecated in favor
+        * of passing an array of option with a "variant" key
+        * Once $query2 is removed for good, this helper can be dropped
+        * andthe wfArrayToCGI moved to getLocalURL();
+        *
+        * @since 1.19 (r105919)
         */
-       private static function fixUrlQueryArgs( $query, $query2 ) {
+       private static function fixUrlQueryArgs( $query, $query2 = false ) {
+               if( $query2 !== false ) {
+                       wfDeprecated( "Title::get{Canonical,Full,Link,Local} method called with a second parameter is deprecated. Add your parameter to an array passed as the first parameter.", "1.19" );
+               }
                if ( is_array( $query ) ) {
                        $query = wfArrayToCGI( $query );
                }
@@ -1281,6 +1292,9 @@ class Title {
         *   be an array. If a string is passed it will be interpreted as a deprecated
         *   variant argument and urlencoded into a variant= argument.
         *   This second query argument will be added to the $query
+        *   The second parameter is deprecated since 1.19. Pass it as a key,value
+        *   pair in the first parameter array instead.
+        *
         * @return String the URL
         */
        public function getLocalURL( $query = '', $query2 = false ) {
@@ -2006,9 +2020,8 @@ class Title {
                        $name = $this->getPrefixedText();
                        $dbName = $this->getPrefixedDBKey();
 
-                       // Check with and without underscores
+                       // Check for explicit whitelisting with and without underscores
                        if ( in_array( $name, $wgWhitelistRead, true ) || in_array( $dbName, $wgWhitelistRead, true ) ) {
-                               # Check for explicit whitelisting
                                $whitelisted = true;
                        } elseif ( $this->getNamespace() == NS_MAIN ) {
                                # Old settings might have the title prefixed with
@@ -4150,7 +4163,21 @@ class Title {
         * @return Bool
         */
        public function isKnown() {
-               return $this->isAlwaysKnown() || $this->exists();
+               $isKnown = null;
+               
+               /**
+                * Allows overriding default behaviour for determining if a page exists.
+                * If $isKnown is kept as null, regular checks happen. If it's
+                * a boolean, this value is returned by the isKnown method.
+                * 
+                * @since 1.20
+                * 
+                * @param Title $title
+                * @param boolean|null $isKnown
+                */
+               wfRunHooks( 'TitleIsKnown', array( $this, &$isKnown ) );
+               
+               return is_null( $isKnown ) ? ( $this->isAlwaysKnown() || $this->exists() ) : $isKnown;
        }
 
        /**