http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96585

Revision: 96585
Author:   nikerabbit
Date:     2011-09-08 16:59:19 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
Switch JSON to (un)serialize

Modified Paths:
--------------
    trunk/phase3/includes/logging/LogEntry.php

Modified: trunk/phase3/includes/logging/LogEntry.php
===================================================================
--- trunk/phase3/includes/logging/LogEntry.php  2011-09-08 16:45:38 UTC (rev 
96584)
+++ trunk/phase3/includes/logging/LogEntry.php  2011-09-08 16:59:19 UTC (rev 
96585)
@@ -203,13 +203,21 @@
        public function getParameters() {
                if ( !isset( $this->params ) ) {
                        $blob = $this->getRawParameters();
-                       $params = FormatJson::decode( $blob, true /* array */ );
-                       if ( $params !== null ) {
+                       wfSuppressWarnings();
+                       $params = unserialize( $blob );
+                       wfRestoreWarnings();
+                       if ( $params !== false ) {
                                $this->params = $params;
                                $this->legacy = false;
                        } else {
-                               $this->params = explode( "\n", $blob );
-                               $this->legacy = true;
+                               $params = FormatJson::decode( $blob, true /* 
array */ );
+                               if ( $params !== null ) {
+                                       $this->params = $params;
+                                       $this->legacy = false;
+                               } else {
+                                       $this->params = explode( "\n", $blob );
+                                       $this->legacy = true;
+                               }
                        }
                }
                return $this->params;
@@ -319,7 +327,7 @@
        }
 
        /**
-        * Set extra log parameters.
+        * Set extra log parameters. 
         * You can pass params to the log action message
         * by prefixing the keys with a number and colon.
         * The numbering should start with number 4, the
@@ -380,7 +388,7 @@
                        'log_title' => $this->getTarget()->getDBkey(),
                        'log_page' => $this->getTarget()->getArticleId(),
                        'log_comment' => $this->getComment(),
-                       'log_params' => FormatJson::encode( (array) 
$this->getParameters() ),
+                       'log_params' => serialize( (array) 
$this->getParameters() ),
                );
                $dbw->insert( 'logging', $data, __METHOD__ );
                $this->id = !is_null( $id ) ? $id : $dbw->insertId();
@@ -414,7 +422,7 @@
                        $this->getSubtype(),
                        $this->getTarget(),
                        $this->getComment(),
-                       FormatJson::encode( (array) $this->getParameters() ),
+                       serialize( (array) $this->getParameters() ),
                        $newId
                );
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to