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

Revision: 90771
Author:   salvatoreingala
Date:     2011-06-25 15:42:42 +0000 (Sat, 25 Jun 2011)
Log Message:
-----------
Small improvement in GadgetHooks::userSaveOptions; also added profiling to it

Modified Paths:
--------------
    branches/salvatoreingala/Gadgets/backend/GadgetHooks.php

Modified: branches/salvatoreingala/Gadgets/backend/GadgetHooks.php
===================================================================
--- branches/salvatoreingala/Gadgets/backend/GadgetHooks.php    2011-06-25 
15:12:26 UTC (rev 90770)
+++ branches/salvatoreingala/Gadgets/backend/GadgetHooks.php    2011-06-25 
15:42:42 UTC (rev 90771)
@@ -228,10 +228,13 @@
                        return true;
                }
                
+               wfProfileIn( __METHOD__ );
+               
                //Reinsert gadget-*-config options, so they can be saved back
                $gadgets = Gadget::loadList();
                
                if ( !$gadgets ) {
+                       wfProfileOut( __METHOD__ );
                        return true;
                }
                
@@ -247,10 +250,14 @@
                                        }
                                }
                                
-                               $options["gadget-{$gadget->getName()}-config"] 
= serialize( $prefs );
+                               //Only save it if at least one preference 
differs from default
+                               if ( !empty( $prefs ) ) {
+                                       
$options["gadget-{$gadget->getName()}-config"] = serialize( $prefs );
+                               }
                        }
                }
                
+               wfProfileOut( __METHOD__ );
                return true;
        }
 


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

Reply via email to