Provide new, unsaved revision to PST to fix magic words.
[lhc/web/wiklou.git] / includes / parser / ParserCache.php
index 8a7fca6..43c72b1 100644 (file)
@@ -291,10 +291,20 @@ class ParserCache {
         * @param ParserOutput $parserOutput
         * @param WikiPage $page
         * @param ParserOptions $popts
-        * @param string $cacheTime Time when the cache was generated
-        * @param int $revId Revision ID that was parsed
+        * @param string|null $cacheTime TS_MW timestamp when the cache was generated
+        * @param int|null $revId Revision ID that was parsed
         */
-       public function save( $parserOutput, $page, $popts, $cacheTime = null, $revId = null ) {
+       public function save(
+               ParserOutput $parserOutput,
+               $page,
+               $popts,
+               $cacheTime = null,
+               $revId = null
+       ) {
+               if ( !$parserOutput->hasText() ) {
+                       throw new InvalidArgumentException( 'Attempt to cache a ParserOutput with no text set!' );
+               }
+
                $expire = $parserOutput->getCacheExpiry();
                if ( $expire > 0 && !$this->mMemc instanceof EmptyBagOStuff ) {
                        $cacheTime = $cacheTime ?: wfTimestampNow();