Per comments on code review, use JSON instead of PHP serialization for Abuse Filter...
authorAndrew Garrett <werdna@users.mediawiki.org>
Tue, 2 Jun 2009 12:59:05 +0000 (12:59 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Tue, 2 Jun 2009 12:59:05 +0000 (12:59 +0000)
includes/GlobalFunctions.php

index 26b75bf..41d4a6f 100644 (file)
@@ -3127,3 +3127,17 @@ function wfArrayInsertAfter( $array, $insert, $after ) {
        
        return $output;
 }
+
+/* Recursively converts the parameter (an object) to an array with the same data */
+function wfObjectToArray( $object, $recursive = true ) {
+       $array = array();
+       foreach ( get_object_vars($object) as $key => $value ) {
+               if ( is_object($value) && $recursive ) {
+                       $value = wfObjectToArray( $value );
+               }
+               
+               $array[$key] = $value;
+       }
+       
+       return $array;
+}