r70872 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70871‎ | r70872 | r70873 >
Date:12:15, 11 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Work on communication with the repository
Modified paths:
  • /trunk/extensions/Deployment/Deployment.i18n.php (modified) (history)
  • /trunk/extensions/Deployment/Deployment.php (modified) (history)
  • /trunk/extensions/Deployment/Deployment_Settings.php (modified) (history)
  • /trunk/extensions/Deployment/includes/PackageRepository.php (modified) (history)
  • /trunk/extensions/Deployment/specials/SpecialUpdate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/specials/SpecialUpdate.php
@@ -44,10 +44,19 @@
4545
4646 // If the user is authorized, display the page, if not, show an error.
4747 if ( $this->userCanExecute( $wgUser ) ) {
48 -
 48+ $this->showCoreStatus();
 49+ $this->showExtensionStatuses();
4950 } else {
5051 $this->displayRestrictionError();
5152 }
5253 }
5354
 55+ protected function showCoreStatus() {
 56+ $repository = wfGetRepository();
 57+ }
 58+
 59+ protected function showExtensionStatuses() {
 60+ $repository = wfGetRepository();
 61+ }
 62+
5463 }
\ No newline at end of file
Index: trunk/extensions/Deployment/Deployment.i18n.php
@@ -42,7 +42,7 @@
4343 'extensions-up-to-date' => 'Your extensions are all up to date.',
4444
4545 // Special:Install
46 - 'extensions-description' => 'Extensions extend and expand the functionality of MediaWiki. You can browse and search extensions that are in the [http://www.mediawiki.org/wiki/Special:Repository MediaWiki Extension Repository] to install via this page.',
 46+ 'extensions-description' => 'Extensions extend and expand the functionality of MediaWiki. You can browse and search extensions that are in the [$1 MediaWiki Extension Repository] to install via this page.',
4747 'search-extensions' => 'Search',
4848 'search-extensions-long' => 'Search for extensions by keyword, author, or tag.',
4949 'popular-extension-tags' => 'Popular tags',
Index: trunk/extensions/Deployment/Deployment.php
@@ -65,4 +65,19 @@
6666 'descriptionmsg' => 'deployment-desc',
6767 );
6868
69 -}
\ No newline at end of file
 69+}
 70+
 71+/**
 72+ * Returns the PackageRepository object for interaction with the package repository.
 73+ *
 74+ * @return PackageRepository
 75+ */
 76+function wfGetRepository() {
 77+ global $wgRepository, $wgRepositoryApiLocation;
 78+
 79+ if ( !isset( $wgRepository ) ) {
 80+ $wgRepository = new DistributionRepository( $wgRepositoryApiLocation );
 81+ }
 82+
 83+ return $wgRepository;
 84+}
\ No newline at end of file
Index: trunk/extensions/Deployment/Deployment_Settings.php
@@ -10,4 +10,14 @@
1111 * @author Jeroen De Dauw
1212 */
1313
14 -$wgRepositoryApiLocation = 'http://www.mediawiki.org/w/api.php';
\ No newline at end of file
 14+$wgRepositoryLocation = 'http://www.mediawiki.org/wiki/Special:Repository';
 15+$wgRepositoryApiLocation = 'http://www.mediawiki.org/w/api.php';
 16+
 17+$wgRepositoryPackageStates = array(
 18+ //'dev',
 19+ //'alpha',
 20+ 'beta',
 21+ //'rc',
 22+ 'stable',
 23+ //'deprecated',
 24+);
\ No newline at end of file
Index: trunk/extensions/Deployment/includes/PackageRepository.php
@@ -13,39 +13,79 @@
1414 * Base repository class. Deriving classes handle interaction with
1515 * package repositories of the type they support.
1616 *
 17+ * @since 0.1
 18+ *
 19+ * @ingroup Deployment
 20+ *
1721 * @author Jeroen De Dauw
1822 */
1923 abstract class PackageRepository {
2024
2125 /**
 26+ * Base location of the repository.
 27+ *
 28+ * @since 0.1
 29+ *
 30+ * @var string
 31+ */
 32+ protected $location;
 33+
 34+ /**
 35+ * Returns a list of extensions matching the search criteria.
 36+ *
 37+ * @since 0.1
 38+ *
 39+ * @return array
 40+ */
 41+ public abstract function findExtenions();
 42+
 43+ /**
2244 * Constructor.
 45+ *
 46+ * @param $location String
 47+ *
 48+ * @since 0.1
2349 */
24 - public function __construct() {
25 - // TODO
 50+ public function __construct( $location ) {
 51+ $this->location = $location;
2652 }
2753
2854 }
2955
3056 /**
31 - * Class for interaction with the Ontoprise repository.
32 - * @see PackageRepository
 57+ * Repository class for interaction with repositories provided by
 58+ * the Distirbution extension and the MediaWiki API.
3359 *
 60+ * @since 0.1
 61+ *
 62+ * @ingroup Deployment
 63+ *
3464 * @author Jeroen De Dauw
35 - *
36 - * TODO: move to it's own file
3765 */
38 -class OntopriseRepository extends PackageRepository {
 66+class DistributionRepository extends PackageRepository {
3967
4068 /**
4169 * Constructor.
 70+ *
 71+ * @param $location String: path to the api of the MediaWiki install providing the repository.
 72+ *
 73+ * @since 0.1
4274 */
43 - public function __construct() {
44 - parent::__construct();
 75+ public function __construct( $location ) {
 76+ parent::__construct( $location );
 77+ }
 78+
 79+ /**
 80+ * @see PackageRepository::findExtenions
 81+ *
 82+ * @since 0.1
 83+ *
 84+ * @return array
 85+ */
 86+ public function findExtenions() {
 87+ global $wgRepositoryPackageStates;
4588
4689 // TODO
47 - }
 90+ }
4891
49 -}
50 -
51 -// TODO: if the ontoprise repository structure is acceptable for general use, rename the class,
52 -// if it's not, design a more general repository structure and create a new PackageRepository class to handle.
\ No newline at end of file
 92+}
\ No newline at end of file

Status & tagging log