r71028 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71027‎ | r71028 | r71029 >
Date:14:09, 13 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Work on update detection
Modified paths:
  • /trunk/extensions/Deployment/includes/DistributionRepository.php (modified) (history)
  • /trunk/extensions/Deployment/includes/PackageDescriptor.php (modified) (history)
  • /trunk/extensions/Deployment/includes/PackageDescriptorProcessor.php (modified) (history)
  • /trunk/extensions/Deployment/includes/PackageRepository.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/includes/PackageDescriptor.php
@@ -2,7 +2,6 @@
33
44 /**
55 * File holding the PackageDescriptor class.
6 - * Partly based on DeployDescriptor from Ontoprises Deployment Framework.
76 *
87 * @file PackageDescriptor.php
98 * @ingroup Deployment
@@ -18,7 +17,6 @@
1918 * Package description class.
2019 *
2120 * @author Jeroen De Dauw
22 - * @author Kai Kühn
2321 */
2422 class PackageDescriptor {
2523
Index: trunk/extensions/Deployment/includes/PackageDescriptorProcessor.php
@@ -2,7 +2,6 @@
33
44 /**
55 * File holding the PackageDescriptorProcessor class.
6 - * Partly based on DeployDescriptorProcessor from Ontoprises Deployment Framework.
76 *
87 * @file PackageDescriptorProcessor.php
98 * @ingroup Deployment
Index: trunk/extensions/Deployment/includes/PackageRepository.php
@@ -47,6 +47,41 @@
4848 public abstract function findExtenions( $filterType, $filterValue );
4949
5050 /**
 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+ /**
5186 * Constructor.
5287 *
5388 * @param $location String
Index: trunk/extensions/Deployment/includes/DistributionRepository.php
@@ -51,6 +51,9 @@
5252
5353 // TODO: use $wgRepositoryPackageStates
5454
 55+ $filterType = urlencode( $filterType );
 56+ $filterValue = urlencode( $filterValue );
 57+
5558 $response = Http::get(
5659 "$this->location?format=json&action=query&list=extensions&dstfilter=$filterType&dstvalue=$filterValue",
5760 'default',
@@ -66,4 +69,56 @@
6770 return $extensions;
6871 }
6972
 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+
70125 }
\ No newline at end of file

Status & tagging log