forked from nakal/BugzillaReports
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBugzillaReports.php
104 lines (91 loc) · 3.33 KB
/
BugzillaReports.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* See README for installation and usage
*/
/**
* Copyright (C) 2008 - Ian Homer & bemoko
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*/
if ( !defined( 'MEDIAWIKI' ) and !defined('BUGZILLAREPORTS') ) {
die('This file is a MediaWiki extension, it is not a valid entry point' );
}
if ( !method_exists('ParserOutput','addHeadItem') ) {
die('Sorry, but your MediaWiki version is too old for BugzillaReports, please upgrade to the latest MediaWiki version.' );
}
$wgBugzillaReportsIncludes = dirname(__FILE__) . '/';
#
# Set up autoloading
#
$wgAutoloadClasses['BMWExtension']=
$wgBugzillaReportsIncludes."BMWExtension.php";
$wgAutoloadClasses['BSQLQuery']=
$wgBugzillaReportsIncludes."BSQLQuery.php";
$wgAutoloadClasses['BugzillaQuery']=
$wgBugzillaReportsIncludes."BugzillaQuery.php";
$wgAutoloadClasses['BMysqlConnector']=
$wgBugzillaReportsIncludes."BMysqlConnector.php";
$wgAutoloadClasses['BPGConnector']=
$wgBugzillaReportsIncludes."BPGConnector.php";
$wgAutoloadClasses['BugzillaReport']=
$wgBugzillaReportsIncludes."BugzillaReport.php";
$wgAutoloadClasses['BugzillaQueryRenderer']=
$wgBugzillaReportsIncludes."BugzillaQueryRenderer.php";
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'BugzillaReports',
'version' => '1.2',
'url' => 'https://github.com/nakal/mediawiki-bugzillareports',
'author' => '[https://github.com/nakal Martin Sugioarto]',
'description' => 'Integrates [https://www.bugzilla.org/ Bugzilla] bug tracker tabular summaries in Wiki pages'
);
//Avoid unstubbing $wgParser too early on modern (1.12+) MW versions, as per r35980
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
$wgHooks['ParserFirstCallInit'][] = 'efBugzillaReportsSetup';
} else {
$wgExtensionFunctions[] = 'efBugzillaReportsSetup';
}
$wgExtensionMessagesFiles['BugzillaReports'] = $wgBugzillaReportsIncludes.
'/BugzillaReports.i18n.php';
$wgHooks['LanguageGetMagic'][] = 'efBugzillaReportsMagic';
$bzScriptPath = $wgScriptPath . '/extensions/BugzillaReports';
/**
* Register the function hook
*/
function efBugzillaReportsSetup() {
global $wgParser;
$efBugzillaReportsHookStub = new BugzillaReportsHookStub;
$wgParser->setFunctionHook( 'bugzilla',
array(&$efBugzillaReportsHookStub,'efBugzillaReportsRender') );
return true;
}
/**
* Register the magic word
*/
function efBugzillaReportsMagic( &$magicWords, $langCode = "en" ) {
$magicWords['bugzilla'] = array( 0, 'bugzilla' );
return true;
}
class BugzillaReportsHookStub {
/**
* Call to render the bugzilla report
*/
function efBugzillaReportsRender( &$parser) {
$bugzillaReport = new BugzillaReport( $parser );
$args = func_get_args();
array_shift( $args );
return $bugzillaReport->render($args);
}
}
?>