http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71108
Revision: 71108 Author: jeroendedauw Date: 2010-08-15 09:41:02 +0000 (Sun, 15 Aug 2010) Log Message: ----------- Follow up to r71107 Modified Paths: -------------- trunk/extensions/Deployment/Deployment.php Removed Paths: ------------- trunk/extensions/Deployment/includes/DistributionRepository.php trunk/extensions/Deployment/includes/PackageRepository.php Modified: trunk/extensions/Deployment/Deployment.php =================================================================== --- trunk/extensions/Deployment/Deployment.php 2010-08-15 09:40:16 UTC (rev 71107) +++ trunk/extensions/Deployment/Deployment.php 2010-08-15 09:41:02 UTC (rev 71108) @@ -25,8 +25,6 @@ $wgExtensionMessagesFiles['Deployment'] = dirname( __FILE__ ) . '/Deployment.i18n.php'; // Load classes. -$wgAutoloadClasses['PackageRepository'] = dirname( __FILE__ ) . '/includes/PackageRepository.php'; -$wgAutoloadClasses['DistributionRepository'] = dirname( __FILE__ ) . '/includes/DistributionRepository.php'; $wgAutoloadClasses['ExtensionInfo'] = dirname( __FILE__ ) . '/includes/ExtensionInfo.php'; // Load and register Special:Dashboard. Deleted: trunk/extensions/Deployment/includes/DistributionRepository.php =================================================================== --- trunk/extensions/Deployment/includes/DistributionRepository.php 2010-08-15 09:40:16 UTC (rev 71107) +++ trunk/extensions/Deployment/includes/DistributionRepository.php 2010-08-15 09:41:02 UTC (rev 71108) @@ -1,186 +0,0 @@ -<?php - -/** - * File holding the DistributionRepository class. - * - * @file DistributionRepository.php - * @ingroup Deployment - * - * @author Jeroen De Dauw - */ - -if ( !defined( 'MEDIAWIKI' ) ) { - die( 'Not an entry point.' ); -} - -/** - * Repository class for interaction with repositories provided by - * the Distirbution extension and the MediaWiki API. - * - * @since 0.1 - * - * @ingroup Deployment - * - * @author Jeroen De Dauw - */ -class DistributionRepository extends PackageRepository { - - /** - * Constructor. - * - * @param $location String: path to the api of the MediaWiki install providing the repository. - * - * @since 0.1 - */ - public function __construct( $location ) { - parent::__construct( $location ); - } - - /** - * @see PackageRepository::findExtenions - * - * @since 0.1 - * - * @param $filterType String - * @param $filterValue String - * - * @return array - */ - public function findExtenions( $filterType, $filterValue ) { - global $wgRepositoryPackageStates; - - $filterType = urlencode( $filterType ); - $filterValue = urlencode( $filterValue ); - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); - - $response = Http::get( - "$this->location?format=json&action=query&list=extensions&dstfilter=$filterType&dstvalue=$filterValue&dststate=$states", - 'default', - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) - ); - - $extensions = array(); - - if ( $response !== false ) { - $response = FormatJson::decode( $response ); - - if ( property_exists( $response, 'query' ) && property_exists( $response->query, 'extensions' ) ) { - $extensions = $response->query->extensions; - } - } - - return $extensions; - } - - /** - * @see PackageRepository::extensionHasUpdate - * - * @since 0.1 - */ - public function extensionHasUpdate( $extensionName, $currentVersion ) { - global $wgRepositoryPackageStates; - - $extensionName = urlencode( $extensionName ); - $currentVersion = urlencode( $currentVersion ); - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); - - $response = Http::get( - "$this->location?format=json&action=updates&extensions=$extensionName;$currentVersion&state=$states", - 'default', - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) - ); - - if ( $response === false ) { - return false; - } - - $response = FormatJson::decode( $response ); - - if ( property_exists( $response, 'extensions' ) && property_exists( $response->extensions, $extensionName ) ) { - return $response->extensions->$extensionName; - } - - return false; - } - - /** - * @see PackageRepository::coreHasUpdate - * - * @since 0.1 - */ - public function coreHasUpdate( $currentVersion ) { - global $wgRepositoryPackageStates; - - $currentVersion = urlencode( $currentVersion ); - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); - - $response = Http::get( - "$this->location?format=json&action=updates&mediawiki=$currentVersion&state=$states", - 'default', - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) - ); - - if ( $response === false ) { - return false; - } - - $response = FormatJson::decode( $response ); - - if ( property_exists( $response, 'mediawiki' ) ) { - return $response->mediawiki; - } - - return false; - } - - /** - * @see PackageRepository::installationHasUpdates - * - * @since 0.1 - */ - public function installationHasUpdates( $coreVersion, array $extensions ) { - global $wgRepositoryPackageStates; - - $coreVersion = urlencode( $coreVersion ); - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) ); - - $extensionParams = array(); - - if ( count( $extensions ) > 0 ) { - foreach ( $extensions as $extensionName => $extensionVersion ) { - $extensionParams[] = urlencode( $extensionName ) . ';' . urlencode( $extensionVersion ); - } - - $extensionParams = '&extensions=' . urlencode( implode( '|', $extensionParams ) ); - } - - $response = Http::get( - "$this->location?format=json&action=updates&mediawiki=$coreVersion{$extensionParams}&state=$states", - 'default', - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) - ); - - if ( $response === false ) { - return false; - } - - $response = FormatJson::decode( $response ); - - $updates = array(); - - if ( property_exists( $response, 'mediawiki' ) ) { - $updates['MediaWiki'] = $response->mediawiki; - } - - if ( property_exists( $response, 'extensions' ) ) { - foreach ( $extensions as $extensionName => $extensionVersion ) { - if ( property_exists( $response->extensions, $extensionName ) ) { - $updates[$extensionName] = $response->extensions->$extensionName; - } - } - } - - return count( $updates ) > 0 ? $updates : false; - } - -} \ No newline at end of file Deleted: trunk/extensions/Deployment/includes/PackageRepository.php =================================================================== --- trunk/extensions/Deployment/includes/PackageRepository.php 2010-08-15 09:40:16 UTC (rev 71107) +++ trunk/extensions/Deployment/includes/PackageRepository.php 2010-08-15 09:41:02 UTC (rev 71108) @@ -1,95 +0,0 @@ -<?php - -/** - * File holding the PackageRepository class. - * - * @file PackageRepository.php - * @ingroup Deployment - * - * @author Jeroen De Dauw - */ - -if ( !defined( 'MEDIAWIKI' ) ) { - die( 'Not an entry point.' ); -} - -/** - * Base repository class. Deriving classes handle interaction with - * package repositories of the type they support. - * - * @since 0.1 - * - * @ingroup Deployment - * - * @author Jeroen De Dauw - */ -abstract class PackageRepository { - - /** - * Base location of the repository. - * - * @since 0.1 - * - * @var string - */ - protected $location; - - /** - * Returns a list of extensions matching the search criteria. - * - * @since 0.1 - * - * @param $filterType String - * @param $filterValue String - * - * @return array - */ - public abstract function findExtenions( $filterType, $filterValue ); - - /** - * Checks if newer versions of an extension are available. - * - * @since 0.1 - * - * @param $extensionName String - * @param $currentVersion String - * - * @return Mixed: false when there is no update, object with info when there is. - */ - public abstract function extensionHasUpdate( $extensionName, $currentVersion ); - - /** - * Checks if newer versions of MediaWiki is available. - * - * @since 0.1 - * - * @param $currentVersion String - * - * @return Mixed: false when there is no update, object with info when there is. - */ - public abstract function coreHasUpdate( $currentVersion ); - - /** - * Checks if there are any updates for this MediaWiki installation and extensions. - * - * @since 0.1 - * - * @param $coreVersion String - * @param $extensions Array - * - * @return Mixed: false when there is are updates, array with obecjts with info when there are. - */ - public abstract function installationHasUpdates( $coreVersion, array $extensions ); - - /** - * Constructor. - * - * @param $location String - * - * @since 0.1 - */ - public function __construct( $location ) { - $this->location = $location; - } - -} \ No newline at end of file _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs