Merge "Allow adding arbitrary properties to OutputPage"
authorDemon <chadh@wikimedia.org>
Fri, 22 Feb 2013 15:41:43 +0000 (15:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 22 Feb 2013 15:41:43 +0000 (15:41 +0000)
1  2 
includes/OutputPage.php

diff --combined includes/OutputPage.php
@@@ -248,6 -248,11 +248,11 @@@ class OutputPage extends ContextSource 
         */
        private $mRedirectedFrom = null;
  
+       /**
+        * Additional key => value data
+        */
+       private $mProperties = array();
        /**
         * Constructor for OutputPage. This should not be called directly.
         * Instead a new RequestContext should be created and it will implicitly create
                return $this->mArticleBodyOnly;
        }
  
+       /**
+        * Set an additional output property
+        * @since 1.21
+        *
+        * @param string $name
+        * @param mixed $value
+        */
+       public function setProperty( $name, $value ) {
+               $this->mProperties[$name] = $value;
+       }
+       /**
+        * Get an additional output property
+        * @since 1.21
+        *
+        * @param $name
+        * @return mixed: Property value or null if not found
+        */
+       public function getProperty( $name ) {
+               if ( isset( $this->mProperties[$name] ) ) {
+                       return $this->mProperties[$name];
+               } else {
+                       return null;
+               }
+       }
        /**
         * checkLastModified tells the client to use the client-cached page if
         * possible. If successful, the OutputPage is disabled so that
                                        wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", false );
                                        # start with a shorter timeout for initial testing
                                        # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
 -                                      $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"');
 +                                      $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
                                        $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
                                } else {
                                        # We'll purge the proxy cache for anons explicitly, but require end user agents