Add PPFrame::getTTL() and setTTL()
[lhc/web/wiklou.git] / includes / parser / Preprocessor.php
index aeacd2e..dd5fc4f 100644 (file)
@@ -28,7 +28,7 @@ interface Preprocessor {
        /**
         * Create a new preprocessor object based on an initialised Parser object
         *
-        * @param $parser Parser
+        * @param Parser $parser
         */
        function __construct( $parser );
 
@@ -40,26 +40,28 @@ interface Preprocessor {
        function newFrame();
 
        /**
-        * Create a new custom frame for programmatic use of parameter replacement as used in some extensions
+        * Create a new custom frame for programmatic use of parameter replacement
+        * as used in some extensions.
         *
-        * @param $args array
+        * @param array $args
         *
         * @return PPFrame
         */
        function newCustomFrame( $args );
 
        /**
-        * Create a new custom node for programmatic use of parameter replacement as used in some extensions
+        * Create a new custom node for programmatic use of parameter replacement
+        * as used in some extensions.
         *
-        * @param $values
+        * @param array $values
         */
        function newPartNodeArray( $values );
 
        /**
         * Preprocess text to a PPNode
         *
-        * @param $text
-        * @param $flags
+        * @param string $text
+        * @param int $flags
         *
         * @return PPNode
         */
@@ -84,14 +86,19 @@ interface PPFrame {
        /**
         * Create a child frame
         *
-        * @param array $args
-        * @param Title $title
+        * @param array|bool $args
+        * @param bool|Title $title
         * @param int $indexOffset A number subtracted from the index attributes of the arguments
         *
         * @return PPFrame
         */
        function newChild( $args = false, $title = false, $indexOffset = 0 );
 
+       /**
+        * Expand a document tree node, caching the result on its parent with the given key
+        */
+       function cachedExpand( $key, $root, $flags = 0 );
+
        /**
         * Expand a document tree node
         */
@@ -148,8 +155,7 @@ interface PPFrame {
        /**
         * Returns true if the infinite loop check is OK, false if a loop is detected
         *
-        * @param $title
-        *
+        * @param Title $title
         * @return bool
         */
        function loopCheck( $title );
@@ -159,6 +165,55 @@ interface PPFrame {
         */
        function isTemplate();
 
+       /**
+        * Set the "volatile" flag.
+        *
+        * Note that this is somewhat of a "hack" in order to make extensions
+        * with side effects (such as Cite) work with the PHP parser. New
+        * extensions should be written in a way that they do not need this
+        * function, because other parsers (such as Parsoid) are not guaranteed
+        * to respect it, and it may be removed in the future.
+        *
+        * @param bool $flag
+        */
+       function setVolatile( $flag = true );
+
+       /**
+        * Get the "volatile" flag.
+        *
+        * Callers should avoid caching the result of an expansion if it has the
+        * volatile flag set.
+        *
+        * @see self::setVolatile()
+        * @return bool
+        */
+       function isVolatile();
+
+       /**
+        * Get the TTL of the frame's output.
+        *
+        * This is the maximum amount of time, in seconds, that this frame's
+        * output should be cached for. A value of null indicates that no
+        * maximum has been specified.
+        *
+        * Note that this TTL only applies to caching frames as parts of pages.
+        * It is not relevant to caching the entire rendered output of a page.
+        *
+        * @return int|null
+        */
+       function getTTL();
+
+       /**
+        * Set the TTL of the output of this frame and all of its ancestors.
+        * Has no effect if the new TTL is greater than the one already set.
+        * Note that it is the caller's responsibility to change the cache
+        * expiry of the page as a whole, if such behavior is desired.
+        *
+        * @see self::getTTL()
+        * @param int $ttl
+        */
+       function setTTL( $ttl );
+
        /**
         * Get a title of frame
         *