Index: trunk/extensions/Deployment/Deployment.php |
— | — | @@ -25,8 +25,6 @@ |
26 | 26 | $wgExtensionMessagesFiles['Deployment'] = dirname( __FILE__ ) . '/Deployment.i18n.php'; |
27 | 27 | |
28 | 28 | // Load classes. |
29 | | -$wgAutoloadClasses['PackageRepository'] = dirname( __FILE__ ) . '/includes/PackageRepository.php'; |
30 | | -$wgAutoloadClasses['DistributionRepository'] = dirname( __FILE__ ) . '/includes/DistributionRepository.php'; |
31 | 29 | $wgAutoloadClasses['ExtensionInfo'] = dirname( __FILE__ ) . '/includes/ExtensionInfo.php'; |
32 | 30 | |
33 | 31 | // Load and register Special:Dashboard. |
Index: trunk/extensions/Deployment/includes/PackageRepository.php |
— | — | @@ -1,95 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * File holding the PackageRepository class. |
6 | | - * |
7 | | - * @file PackageRepository.php |
8 | | - * @ingroup Deployment |
9 | | - * |
10 | | - * @author Jeroen De Dauw |
11 | | - */ |
12 | | - |
13 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
14 | | - die( 'Not an entry point.' ); |
15 | | -} |
16 | | - |
17 | | -/** |
18 | | - * Base repository class. Deriving classes handle interaction with |
19 | | - * package repositories of the type they support. |
20 | | - * |
21 | | - * @since 0.1 |
22 | | - * |
23 | | - * @ingroup Deployment |
24 | | - * |
25 | | - * @author Jeroen De Dauw |
26 | | - */ |
27 | | -abstract class PackageRepository { |
28 | | - |
29 | | - /** |
30 | | - * Base location of the repository. |
31 | | - * |
32 | | - * @since 0.1 |
33 | | - * |
34 | | - * @var string |
35 | | - */ |
36 | | - protected $location; |
37 | | - |
38 | | - /** |
39 | | - * Returns a list of extensions matching the search criteria. |
40 | | - * |
41 | | - * @since 0.1 |
42 | | - * |
43 | | - * @param $filterType String |
44 | | - * @param $filterValue String |
45 | | - * |
46 | | - * @return array |
47 | | - */ |
48 | | - public abstract function findExtenions( $filterType, $filterValue ); |
49 | | - |
50 | | - /** |
51 | | - * Checks if newer versions of an extension are available. |
52 | | - * |
53 | | - * @since 0.1 |
54 | | - * |
55 | | - * @param $extensionName String |
56 | | - * @param $currentVersion String |
57 | | - * |
58 | | - * @return Mixed: false when there is no update, object with info when there is. |
59 | | - */ |
60 | | - public abstract function extensionHasUpdate( $extensionName, $currentVersion ); |
61 | | - |
62 | | - /** |
63 | | - * Checks if newer versions of MediaWiki is available. |
64 | | - * |
65 | | - * @since 0.1 |
66 | | - * |
67 | | - * @param $currentVersion String |
68 | | - * |
69 | | - * @return Mixed: false when there is no update, object with info when there is. |
70 | | - */ |
71 | | - public abstract function coreHasUpdate( $currentVersion ); |
72 | | - |
73 | | - /** |
74 | | - * Checks if there are any updates for this MediaWiki installation and extensions. |
75 | | - * |
76 | | - * @since 0.1 |
77 | | - * |
78 | | - * @param $coreVersion String |
79 | | - * @param $extensions Array |
80 | | - * |
81 | | - * @return Mixed: false when there is are updates, array with obecjts with info when there are. |
82 | | - */ |
83 | | - public abstract function installationHasUpdates( $coreVersion, array $extensions ); |
84 | | - |
85 | | - /** |
86 | | - * Constructor. |
87 | | - * |
88 | | - * @param $location String |
89 | | - * |
90 | | - * @since 0.1 |
91 | | - */ |
92 | | - public function __construct( $location ) { |
93 | | - $this->location = $location; |
94 | | - } |
95 | | - |
96 | | -} |
\ No newline at end of file |
Index: trunk/extensions/Deployment/includes/DistributionRepository.php |
— | — | @@ -1,186 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * File holding the DistributionRepository class. |
6 | | - * |
7 | | - * @file DistributionRepository.php |
8 | | - * @ingroup Deployment |
9 | | - * |
10 | | - * @author Jeroen De Dauw |
11 | | - */ |
12 | | - |
13 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
14 | | - die( 'Not an entry point.' ); |
15 | | -} |
16 | | - |
17 | | -/** |
18 | | - * Repository class for interaction with repositories provided by |
19 | | - * the Distirbution extension and the MediaWiki API. |
20 | | - * |
21 | | - * @since 0.1 |
22 | | - * |
23 | | - * @ingroup Deployment |
24 | | - * |
25 | | - * @author Jeroen De Dauw |
26 | | - */ |
27 | | -class DistributionRepository extends PackageRepository { |
28 | | - |
29 | | - /** |
30 | | - * Constructor. |
31 | | - * |
32 | | - * @param $location String: path to the api of the MediaWiki install providing the repository. |
33 | | - * |
34 | | - * @since 0.1 |
35 | | - */ |
36 | | - public function __construct( $location ) { |
37 | | - parent::__construct( $location ); |
38 | | - } |
39 | | - |
40 | | - /** |
41 | | - * @see PackageRepository::findExtenions |
42 | | - * |
43 | | - * @since 0.1 |
44 | | - * |
45 | | - * @param $filterType String |
46 | | - * @param $filterValue String |
47 | | - * |
48 | | - * @return array |
49 | | - */ |
50 | | - public function findExtenions( $filterType, $filterValue ) { |
51 | | - global $wgRepositoryPackageStates; |
52 | | - |
53 | | - $filterType = urlencode( $filterType ); |
54 | | - $filterValue = urlencode( $filterValue ); |
55 | | - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); |
56 | | - |
57 | | - $response = Http::get( |
58 | | - "$this->location?format=json&action=query&list=extensions&dstfilter=$filterType&dstvalue=$filterValue&dststate=$states", |
59 | | - 'default', |
60 | | - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) |
61 | | - ); |
62 | | - |
63 | | - $extensions = array(); |
64 | | - |
65 | | - if ( $response !== false ) { |
66 | | - $response = FormatJson::decode( $response ); |
67 | | - |
68 | | - if ( property_exists( $response, 'query' ) && property_exists( $response->query, 'extensions' ) ) { |
69 | | - $extensions = $response->query->extensions; |
70 | | - } |
71 | | - } |
72 | | - |
73 | | - return $extensions; |
74 | | - } |
75 | | - |
76 | | - /** |
77 | | - * @see PackageRepository::extensionHasUpdate |
78 | | - * |
79 | | - * @since 0.1 |
80 | | - */ |
81 | | - public function extensionHasUpdate( $extensionName, $currentVersion ) { |
82 | | - global $wgRepositoryPackageStates; |
83 | | - |
84 | | - $extensionName = urlencode( $extensionName ); |
85 | | - $currentVersion = urlencode( $currentVersion ); |
86 | | - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); |
87 | | - |
88 | | - $response = Http::get( |
89 | | - "$this->location?format=json&action=updates&extensions=$extensionName;$currentVersion&state=$states", |
90 | | - 'default', |
91 | | - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) |
92 | | - ); |
93 | | - |
94 | | - if ( $response === false ) { |
95 | | - return false; |
96 | | - } |
97 | | - |
98 | | - $response = FormatJson::decode( $response ); |
99 | | - |
100 | | - if ( property_exists( $response, 'extensions' ) && property_exists( $response->extensions, $extensionName ) ) { |
101 | | - return $response->extensions->$extensionName; |
102 | | - } |
103 | | - |
104 | | - return false; |
105 | | - } |
106 | | - |
107 | | - /** |
108 | | - * @see PackageRepository::coreHasUpdate |
109 | | - * |
110 | | - * @since 0.1 |
111 | | - */ |
112 | | - public function coreHasUpdate( $currentVersion ) { |
113 | | - global $wgRepositoryPackageStates; |
114 | | - |
115 | | - $currentVersion = urlencode( $currentVersion ); |
116 | | - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); |
117 | | - |
118 | | - $response = Http::get( |
119 | | - "$this->location?format=json&action=updates&mediawiki=$currentVersion&state=$states", |
120 | | - 'default', |
121 | | - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) |
122 | | - ); |
123 | | - |
124 | | - if ( $response === false ) { |
125 | | - return false; |
126 | | - } |
127 | | - |
128 | | - $response = FormatJson::decode( $response ); |
129 | | - |
130 | | - if ( property_exists( $response, 'mediawiki' ) ) { |
131 | | - return $response->mediawiki; |
132 | | - } |
133 | | - |
134 | | - return false; |
135 | | - } |
136 | | - |
137 | | - /** |
138 | | - * @see PackageRepository::installationHasUpdates |
139 | | - * |
140 | | - * @since 0.1 |
141 | | - */ |
142 | | - public function installationHasUpdates( $coreVersion, array $extensions ) { |
143 | | - global $wgRepositoryPackageStates; |
144 | | - |
145 | | - $coreVersion = urlencode( $coreVersion ); |
146 | | - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); |
147 | | - |
148 | | - $extensionParams = array(); |
149 | | - |
150 | | - if ( count( $extensions ) > 0 ) { |
151 | | - foreach ( $extensions as $extensionName => $extensionVersion ) { |
152 | | - $extensionParams[] = urlencode( $extensionName ) . ';' . urlencode( $extensionVersion ); |
153 | | - } |
154 | | - |
155 | | - $extensionParams = '&extensions=' . urlencode( implode( '|', $extensionParams ) ); |
156 | | - } |
157 | | - |
158 | | - $response = Http::get( |
159 | | - "$this->location?format=json&action=updates&mediawiki=$coreVersion{$extensionParams}&state=$states", |
160 | | - 'default', |
161 | | - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) |
162 | | - ); |
163 | | - |
164 | | - if ( $response === false ) { |
165 | | - return false; |
166 | | - } |
167 | | - |
168 | | - $response = FormatJson::decode( $response ); |
169 | | - |
170 | | - $updates = array(); |
171 | | - |
172 | | - if ( property_exists( $response, 'mediawiki' ) ) { |
173 | | - $updates['MediaWiki'] = $response->mediawiki; |
174 | | - } |
175 | | - |
176 | | - if ( property_exists( $response, 'extensions' ) ) { |
177 | | - foreach ( $extensions as $extensionName => $extensionVersion ) { |
178 | | - if ( property_exists( $response->extensions, $extensionName ) ) { |
179 | | - $updates[$extensionName] = $response->extensions->$extensionName; |
180 | | - } |
181 | | - } |
182 | | - } |
183 | | - |
184 | | - return count( $updates ) > 0 ? $updates : false; |
185 | | - } |
186 | | - |
187 | | -} |
\ No newline at end of file |