https://bugzilla.wikimedia.org/show_bug.cgi?id=47514

       Web browser: ---
            Bug ID: 47514
           Summary: Extensions should clean up after themselves in the
                    global namespace
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Keywords: easy
          Severity: normal
          Priority: Unprioritized
         Component: General/Unknown
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: s...@reedyboy.net
    Classification: Unclassified
   Mobile Platform: ---

When an extension adds a variable temporarily to the global namespace in their
entry point, they should clean up after themselves.

The biggest offender would be:

$dir = dirname(__FILE__) . '/';

When in the coded $dir isn't needed anymore, it should be unset:

unset( $dir );

The other big offender (though, some do clean it up already) is the common code
used in $wgResourceModules

e.g.

$myResourceTemplate = array(
    'localBasePath' => dirname( __FILE__ ) . '/modules',
    'remoteExtPath' => 'SVGEdit/modules',
    'group' => 'ext.svgedit',
);
$wgResourceModules += array(
    'ext.svgedit.editButton' => $myResourceTemplate + array(
        'scripts' => array(
            'ext.svgedit.editButton.js',
        ),
        'messages' => array(
            'svgedit-editbutton-edit',
            'svgedit-edit-tab',
            'svgedit-edit-tab-tooltip'
        ),
        'dependencies' => array(
            'ext.svgedit.editor'
        )
    ),
);


$myResourceTemplate should be unset when it's not needed anymore:

unset( $myResourceTemplate );


Should be a pretty easy thing to tidy up, committing would be more difficult
(with SVN it could be one bigger commit) as it needs one commit per repo that
needs cleaning up.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to