Index: trunk/extensions/Deployment/includes/PackageDescriptor.php |
— | — | @@ -2,7 +2,6 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * File holding the PackageDescriptor class. |
6 | | - * Partly based on DeployDescriptor from Ontoprises Deployment Framework. |
7 | 6 | * |
8 | 7 | * @file PackageDescriptor.php |
9 | 8 | * @ingroup Deployment |
— | — | @@ -18,7 +17,6 @@ |
19 | 18 | * Package description class. |
20 | 19 | * |
21 | 20 | * @author Jeroen De Dauw |
22 | | - * @author Kai Kühn |
23 | 21 | */ |
24 | 22 | class PackageDescriptor { |
25 | 23 | |
Index: trunk/extensions/Deployment/includes/PackageDescriptorProcessor.php |
— | — | @@ -2,7 +2,6 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * File holding the PackageDescriptorProcessor class. |
6 | | - * Partly based on DeployDescriptorProcessor from Ontoprises Deployment Framework. |
7 | 6 | * |
8 | 7 | * @file PackageDescriptorProcessor.php |
9 | 8 | * @ingroup Deployment |
Index: trunk/extensions/Deployment/includes/PackageRepository.php |
— | — | @@ -47,6 +47,41 @@ |
48 | 48 | public abstract function findExtenions( $filterType, $filterValue ); |
49 | 49 | |
50 | 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 | + /** |
51 | 86 | * Constructor. |
52 | 87 | * |
53 | 88 | * @param $location String |
Index: trunk/extensions/Deployment/includes/DistributionRepository.php |
— | — | @@ -51,6 +51,9 @@ |
52 | 52 | |
53 | 53 | // TODO: use $wgRepositoryPackageStates |
54 | 54 | |
| 55 | + $filterType = urlencode( $filterType ); |
| 56 | + $filterValue = urlencode( $filterValue ); |
| 57 | + |
55 | 58 | $response = Http::get( |
56 | 59 | "$this->location?format=json&action=query&list=extensions&dstfilter=$filterType&dstvalue=$filterValue", |
57 | 60 | 'default', |
— | — | @@ -66,4 +69,56 @@ |
67 | 70 | return $extensions; |
68 | 71 | } |
69 | 72 | |
| 73 | + /** |
| 74 | + * @see PackageRepository::extensionHasUpdate |
| 75 | + * |
| 76 | + * @since 0.1 |
| 77 | + */ |
| 78 | + public function extensionHasUpdate( $extensionName, $currentVersion ) { |
| 79 | + global $wgRepositoryPackageStates; |
| 80 | + |
| 81 | + // TODO: use $wgRepositoryPackageStates |
| 82 | + |
| 83 | + $extensionName = urlencode( $extensionName ); |
| 84 | + $currentVersion = urlencode( $currentVersion ); |
| 85 | + |
| 86 | + $response = Http::get( |
| 87 | + "$this->location?format=json&action=updates&extensions=$extensionName;$currentVersion", |
| 88 | + 'default', |
| 89 | + array( 'sslVerifyHost' => true, 'sslVerifyCert' => true ) |
| 90 | + ); |
| 91 | + |
| 92 | + if ( $response === false ) { |
| 93 | + return false; |
| 94 | + } |
| 95 | + |
| 96 | + $extensionsWithUpdates = FormatJson::decode( $response )->extensions; |
| 97 | + |
| 98 | + if ( !property_exists( $extensionsWithUpdates, $extensionName ) ) { |
| 99 | + return false; |
| 100 | + } |
| 101 | + |
| 102 | + return $extensionsWithUpdates->$extensionName; |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * @see PackageRepository::coreHasUpdate |
| 107 | + * |
| 108 | + * @since 0.1 |
| 109 | + */ |
| 110 | + public function coreHasUpdate( $currentVersion ) { |
| 111 | + // TODO |
| 112 | + return false; |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * @see PackageRepository::installationHasUpdates |
| 117 | + * |
| 118 | + * @since 0.1 |
| 119 | + */ |
| 120 | + public function installationHasUpdates( $coreVersion, array $extensions ) { |
| 121 | + // TODO |
| 122 | + return false; |
| 123 | + } |
| 124 | + |
70 | 125 | } |
\ No newline at end of file |