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

Revision: 96660
Author:   catrope
Date:     2011-09-09 14:06:45 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
RL2: When Gadget definition: pages are imported, we need to update the DB too. 
Fixed in a terrible way; this code really needs refactoring

Modified Paths:
--------------
    branches/RL2/extensions/Gadgets/GadgetHooks.php
    branches/RL2/extensions/Gadgets/Gadgets.php

Modified: branches/RL2/extensions/Gadgets/GadgetHooks.php
===================================================================
--- branches/RL2/extensions/Gadgets/GadgetHooks.php     2011-09-09 12:49:40 UTC 
(rev 96659)
+++ branches/RL2/extensions/Gadgets/GadgetHooks.php     2011-09-09 14:06:45 UTC 
(rev 96660)
@@ -118,6 +118,14 @@
                // but we do't care, see similar comment in 
articleSaveComplete()
                return true;
        }
+       
+       public static function gadgetDefinitionImport( $title, $origTitle, 
$revCount, $sRevCount, $pageInfo ) {
+               // HACK: AAAAAAARGH. Should fix this duplication properly
+               // Logic is the same as in gadgetDefinitionUndelete() and that 
function only uses the $title parameter
+               // Shit, shit, shit, this is ugly
+               self::gadgetDefinitionUndelete( $title, true, '' );
+               return true;
+       }
 
        /**
         * ArticleDeleteComplete hook handler.

Modified: branches/RL2/extensions/Gadgets/Gadgets.php
===================================================================
--- branches/RL2/extensions/Gadgets/Gadgets.php 2011-09-09 12:49:40 UTC (rev 
96659)
+++ branches/RL2/extensions/Gadgets/Gadgets.php 2011-09-09 14:06:45 UTC (rev 
96660)
@@ -92,6 +92,7 @@
        'gadgets-definition-delete'
 ) );
 
+$wgHooks['AfterImportPage'][]               = 
'GadgetHooks::gadgetDefinitionImport';
 $wgHooks['ArticleDeleteComplete'][]         = 
'GadgetHooks::gadgetDefinitionDelete';
 $wgHooks['ArticleDeleteComplete'][]         = 'GadgetHooks::cssJsPageDelete';
 $wgHooks['ArticleSaveComplete'][]           = 
'GadgetHooks::gadgetDefinitionSave';


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

Reply via email to