r70537 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70536‎ | r70537 | r70538 >
Date:04:07, 6 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
New extension, see https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Extension:Distribution
Contains some initial code, far from finished though. Feedback on the SQL would be appreciated.
Modified paths:
  • /trunk/extensions/Distribution (added) (history)
  • /trunk/extensions/Distribution/Distribution.i18n.php (added) (history)
  • /trunk/extensions/Distribution/Distribution.php (added) (history)
  • /trunk/extensions/Distribution/api (added) (history)
  • /trunk/extensions/Distribution/api/ApiQueryExtensions.php (added) (history)
  • /trunk/extensions/Distribution/distribution.sql (added) (history)
  • /trunk/extensions/Distribution/maintenance (added) (history)
  • /trunk/extensions/Distribution/maintenance/getSvnMetadata.php (added) (history)

Diff [purge]

Index: trunk/extensions/Distribution/maintenance/getSvnMetadata.php
@@ -0,0 +1,51 @@
 2+<?php
 3+
 4+/**
 5+ * This script scrapes the WMF SVN repo for package meta-data and stores it
 6+ * so it can be queried via the API.
 7+ *
 8+ * Usage:
 9+ * no parameters
 10+ *
 11+ * This program is free software; you can redistribute it and/or modify
 12+ * it under the terms of the GNU General Public License as published by
 13+ * the Free Software Foundation; either version 2 of the License, or
 14+ * (at your option) any later version.
 15+ *
 16+ * This program is distributed in the hope that it will be useful,
 17+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 19+ * GNU General Public License for more details.
 20+ *
 21+ * You should have received a copy of the GNU General Public License along
 22+ * with this program; if not, write to the Free Software Foundation, Inc.,
 23+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 24+ * http://www.gnu.org/copyleft/gpl.html
 25+ *
 26+ * @author Jeroen De Dauw
 27+ * @author Yaron Koren
 28+ * @ingroup Maintenance
 29+ */
 30+
 31+require_once( dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
 32+
 33+class GetSvnMetadata extends Maintenance {
 34+
 35+ public function __construct() {
 36+ parent::__construct();
 37+
 38+ $this->mDescription = "Scrapes the WMF SVN repo for package meta-data and stores it so it can be queried via the API.";
 39+ }
 40+
 41+ public function execute() {
 42+ $dbr = wfGetDB( DB_SLAVE );
 43+
 44+ // TODO
 45+
 46+ $this->output( "..." );
 47+ }
 48+
 49+}
 50+
 51+$maintClass = "GetSvnMetadata";
 52+require_once( DO_MAINTENANCE );
\ No newline at end of file
Property changes on: trunk/extensions/Distribution/maintenance/getSvnMetadata.php
___________________________________________________________________
Added: svn:eol-style
153 + native
Index: trunk/extensions/Distribution/Distribution.i18n.php
@@ -0,0 +1,20 @@
 2+<?php
 3+
 4+/**
 5+ * Internationalization file for the Distribution extension.
 6+ *
 7+ * @file Distribution.i18n.php
 8+ * @ingroup Distribution
 9+ *
 10+ * @author Jeroen De Dauw
 11+ */
 12+
 13+$messages = array();
 14+
 15+/** English
 16+ * @author Jeroen De Dauw
 17+ */
 18+$messages['en'] = array(
 19+ // General
 20+ 'distribution-desc' => 'Extension that serves as a package distribution system for MediaWiki and extensions.',
 21+);
Property changes on: trunk/extensions/Distribution/Distribution.i18n.php
___________________________________________________________________
Added: svn:eol-style
122 + native
Index: trunk/extensions/Distribution/Distribution.php
@@ -0,0 +1,63 @@
 2+<?php
 3+
 4+/**
 5+ * Initialization file for the Distribution extension.
 6+ * Extension documentation: http://www.mediawiki.org/wiki/Extension:Distribution
 7+ *
 8+ * @file Distribution.php
 9+ * @ingroup Distribution
 10+ *
 11+ * @author Jeroen De Dauw
 12+ */
 13+
 14+if ( !defined( 'MEDIAWIKI' ) ) {
 15+ die( 'Not an entry point.' );
 16+}
 17+
 18+define( 'Distribution_VERSION', '0.0.0' );
 19+
 20+// Register the initialization function.
 21+$wgExtensionFunctions[] = 'efDistributionSetup';
 22+
 23+// Register the internationalization file.
 24+$wgExtensionMessagesFiles['Distribution'] = dirname( __FILE__ ) . '/Distribution.i18n.php';
 25+
 26+$wgHooks['LoadExtensionSchemaUpdates'][] = 'efDistributionSchemaUpdate';
 27+
 28+/**
 29+ * Initialization function for the Distribution extension.
 30+ */
 31+function efDistributionSetup() {
 32+ global $wgExtensionCredits;
 33+
 34+ $wgExtensionCredits['other'][] = array(
 35+ 'path' => __FILE__,
 36+ 'name' => 'Distribution',
 37+ 'version' => Distribution_VERSION,
 38+ 'author' => '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]',
 39+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Distribution',
 40+ 'descriptionmsg' => 'distribution-desc',
 41+ );
 42+
 43+}
 44+
 45+function efDistributionSchemaUpdate() {
 46+ global $wgExtNewTables;
 47+
 48+ $wgExtNewTables[] = array(
 49+ 'distribution_packages',
 50+ dirname( __FILE__ ) . '/distribution.sql'
 51+ );
 52+
 53+ $wgExtNewTables[] = array(
 54+ 'distribution_units',
 55+ dirname( __FILE__ ) . '/distribution.sql'
 56+ );
 57+
 58+ $wgExtNewTables[] = array(
 59+ 'distribution_unit_versions',
 60+ dirname( __FILE__ ) . '/distribution.sql'
 61+ );
 62+
 63+ return true;
 64+}
\ No newline at end of file
Property changes on: trunk/extensions/Distribution/Distribution.php
___________________________________________________________________
Added: svn:eol-style
165 + native
Index: trunk/extensions/Distribution/api/ApiQueryExtensions.php
@@ -0,0 +1,102 @@
 2+<?php
 3+/**
 4+ * API extension for Distribution that allows for the querieng of extensions in the repository.
 5+ *
 6+ * @file ApiQueryExtensions.php
 7+ * @ingroup Distribution
 8+ *
 9+ * @author Jeroen De Dauw
 10+ *
 11+ * This program is free software; you can redistribute it and/or modify
 12+ * it under the terms of the GNU General Public License as published by
 13+ * the Free Software Foundation; either version 2 of the License, or
 14+ * (at your option) any later version.
 15+ *
 16+ * This program is distributed in the hope that it will be useful,
 17+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 19+ * GNU General Public License for more details.
 20+ *
 21+ * You should have received a copy of the GNU General Public License along
 22+ * with this program; if not, write to the Free Software Foundation, Inc.,
 23+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 24+ * http://www.gnu.org/copyleft/gpl.html
 25+ */
 26+
 27+/**
 28+ * API class for the querieng of extensions in the repository.
 29+ *
 30+ * @ingroup Distribution
 31+ */
 32+class ApiQueryExtensions extends ApiQueryBase {
 33+ public function __construct( $main, $action ) {
 34+ parent :: __construct( $main, $action, 'dst' );
 35+ }
 36+
 37+ /**
 38+ * @since 0.1
 39+ */
 40+ public function execute() {
 41+ // Get the requests parameters.
 42+ $params = $this->extractRequestParams();
 43+
 44+ // TODO
 45+ }
 46+
 47+ /**
 48+ * @see includes/api/ApiBase#getAllowedParams()
 49+ *
 50+ * @since 0.1
 51+ */
 52+ public function getAllowedParams() {
 53+ return array (
 54+ );
 55+ }
 56+
 57+ /**
 58+ * @see includes/api/ApiBase#getParamDescription()
 59+ *
 60+ * @since 0.1
 61+ */
 62+ public function getParamDescription() {
 63+ return array (
 64+ );
 65+ }
 66+
 67+ /**
 68+ * @see includes/api/ApiBase#getDescription()
 69+ *
 70+ * @since 0.1
 71+ */
 72+ public function getDescription() {
 73+ return '';
 74+ }
 75+
 76+ /**
 77+ * @see includes/api/ApiBase#getPossibleErrors()
 78+ *
 79+ * @since 0.1
 80+ */
 81+ public function getPossibleErrors() {
 82+ return array_merge( parent::getPossibleErrors(), array(
 83+ ) );
 84+ }
 85+
 86+ /**
 87+ * @see includes/api/ApiBase#getExamples()
 88+ *
 89+ * @since 0.1
 90+ */
 91+ protected function getExamples() {
 92+ return array (
 93+ );
 94+ }
 95+
 96+ /**
 97+ * @since 0.1
 98+ */
 99+ public function getVersion() {
 100+ return __CLASS__ . '';
 101+ }
 102+
 103+}
\ No newline at end of file
Property changes on: trunk/extensions/Distribution/api/ApiQueryExtensions.php
___________________________________________________________________
Added: svn:eol-style
1104 + native
Index: trunk/extensions/Distribution/distribution.sql
@@ -0,0 +1,43 @@
 2+-- MySQL version of the database schema for the Distribution extension.
 3+
 4+-- Packages can contain multiple units, either pointing to the units themselves,
 5+-- which will get the latest version, or a specific version.
 6+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/distribution_packages (
 7+ package_id INT(8) unsigned NOT NULL auto_increment PRIMARY KEY
 8+ --need to figure out how to best link units/versions here,
 9+ --this (aka package functionality) is not needed in the initial version though.
 10+) /*$wgDBTableOptions*/;
 11+
 12+-- Units are individual extensions, or mw core. They contain data non-specific to
 13+-- the different versions, as this is stored in distribution_unit_versions.
 14+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/distribution_units (
 15+ unit_id INT(8) unsigned NOT NULL auto_increment PRIMARY KEY,
 16+ unit_name VARCHAR(255) NOT NULL,
 17+ -- Latest stable release.
 18+ unit_current INT(8) unsigned NOT NULL
 19+ -- early adoptor stuff can be here
 20+) /*$wgDBTableOptions*/;
 21+
 22+CREATE UNIQUE INDEX unit_name ON /*$wgDBprefix*/distribution_units (unit_name);
 23+
 24+-- Specific versions of units.
 25+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/distribution_unit_versions (
 26+ version_id INT(8) unsigned NOT NULL auto_increment PRIMARY KEY,
 27+ --might want to have this as int to compare?
 28+ version_nr VARCHAR(20) NOT NULL,
 29+
 30+ unit_id INT(8) unsigned NOT NULL,
 31+ FOREIGN KEY (unit_id) REFERENCES /*$wgDBprefix*/distribution_units(unit_id),
 32+
 33+ --enum with release status (alpha, beta, rc, supported, deprecated, ...)
 34+ version_status TINYINT unsigned NOT NULL,
 35+
 36+ version_desc BLOB NOT NULL,
 37+ --work with an extra table to be able to filter on authors?
 38+ version_authors BLOB NOT NULL,
 39+ version_url VARCHAR(255) NULL
 40+ --... more stuff be here, but let's not bother for an initial version.
 41+
 42+ --dependency info
 43+ --compatibility info
 44+) /*$wgDBTableOptions*/;
\ No newline at end of file
Property changes on: trunk/extensions/Distribution/distribution.sql
___________________________________________________________________
Added: svn:eol-style
145 + native

Status & tagging log