* Repository class for interaction with repositories provided by
* the Distirbution extension and the MediaWiki API.
*
- * @since 0.1
+ * @since 1.17
*
* @ingroup Deployment
*
*
* @param $location String: path to the api of the MediaWiki install providing the repository.
*
- * @since 0.1
+ * @since 1.17
*/
public function __construct( $location ) {
parent::__construct( $location );
/**
* @see PackageRepository::findExtenions
*
- * @since 0.1
+ * @since 1.17
*
* @param $filterType String
* @param $filterValue String
/**
* @see PackageRepository::extensionHasUpdate
*
- * @since 0.1
+ * @since 1.17
*/
public function extensionHasUpdate( $extensionName, $currentVersion ) {
global $wgRepositoryPackageStates;
/**
* @see PackageRepository::coreHasUpdate
*
- * @since 0.1
+ * @since 1.17
*/
public function coreHasUpdate( $currentVersion ) {
global $wgRepositoryPackageStates;
$currentVersion = urlencode( $currentVersion );
- $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
+ $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
$response = Http::get(
"$this->location?format=json&action=updates&mediawiki=$currentVersion&state=$states",
return false;
}
+ /**
+ * @see PackageRepository::coreHasUpdate
+ *
+ * @since 1.17
+ */
+ public function getLatestCoreVersion() {
+ // TODO: use $states
+ //global $wgRepositoryPackageStates;
+ //$states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
+
+ $response = Http::get(
+ "$this->location?format=json&action=mwreleases",
+ 'default',
+ array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
+ );
+
+ if ( $response === false ) {
+ return false;
+ }
+
+ $response = FormatJson::decode( $response );
+
+ $current = false;
+
+ if ( property_exists( $response, 'mwreleases' ) ) {
+ foreach ( $response->mwreleases as $release ) {
+ if ( property_exists( $release, 'current' ) && property_exists( $release, 'version') ) {
+ $current = $release->version;
+ }
+ }
+ }
+
+ return $current;
+ }
+
/**
* @see PackageRepository::installationHasUpdates
*
- * @since 0.1
+ * @since 1.17
*/
public function installationHasUpdates( $coreVersion, array $extensions ) {
global $wgRepositoryPackageStates;