Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/389544 )
Change subject: Archive the Moodle extension ...................................................................... Archive the Moodle extension Empty the repo to avoid search results on old code. Bug: T178765 Change-Id: I199756534b1bb93319d113206f32de82e6101e63 --- A ARCHIVED D CODE_OF_CONDUCT.md D Gruntfile.js D Moodle.php D MoodleWS.alias.php D MoodleWS.body.php D MoodleWS.i18n.php D MoodleWS.php D SpecialMoodleWS.php D i18n/ast.json D i18n/be-tarask.json D i18n/de.json D i18n/en.json D i18n/es.json D i18n/fr.json D i18n/gl.json D i18n/lb.json D i18n/mk.json D i18n/nb.json D i18n/pt-br.json D i18n/pt.json D i18n/qqq.json D i18n/roa-tara.json D i18n/ru.json D i18n/sv.json D i18n/uk.json D i18n/zh-hans.json D moodleusers.sql D package.json 29 files changed, 2 insertions(+), 545 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Moodle refs/changes/44/389544/1 diff --git a/ARCHIVED b/ARCHIVED new file mode 100644 index 0000000..fc0b1f9 --- /dev/null +++ b/ARCHIVED @@ -0,0 +1,2 @@ +This extension is unmaintained and has been archived. +See <https://phabricator.wikimedia.org/T178765> for more information. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index d8e5d08..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1 +0,0 @@ -The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Code_of_Conduct). diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 7756e75..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,20 +0,0 @@ -/*jshint node:true */ -module.exports = function ( grunt ) { - grunt.loadNpmTasks( 'grunt-jsonlint' ); - grunt.loadNpmTasks( 'grunt-banana-checker' ); - - grunt.initConfig( { - banana: { - all: 'i18n/' - }, - jsonlint: { - all: [ - '**/*.json', - '!node_modules/**' - ] - } - } ); - - grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] ); - grunt.registerTask( 'default', 'test' ); -}; diff --git a/Moodle.php b/Moodle.php deleted file mode 100644 index 24dcf4c..0000000 --- a/Moodle.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php - -// Some globals for later config -$wgMoodleWSInstance = 'localhost/moodle/'; -$wgMoodleWSToken = '695a8fecb18fb61c2a8bef28080830de'; -$wgMoodleWSServiceShortname = 'moodle_mobile_app'; - -// Autoload -$wgAutoloadClasses['MoodleWS'] = __DIR__ . '/MoodleWS.body.php'; -$wgAutoloadClasses[ 'SpecialMoodleWS' ] = __DIR__ . '/SpecialMoodleWS.php'; # Location of the SpecialMoodleWS class (Tell MediaWiki to load this file) - -$wgMessagesDirs['MoodleWS'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles[ 'MoodleWS' ] = __DIR__ . '/MoodleWS.i18n.php'; # Location of a messages file (Tell MediaWiki to load this file) - -$wgExtensionMessagesFiles[ 'MoodleWSAlias' ] = __DIR__ . '/MoodleWS.alias.php'; # Location of an aliases file (Tell MediaWiki to load this file) -$wgSpecialPages[ 'MoodleWS' ] = 'SpecialMoodleWS'; # Tell MediaWiki about the new special page and its class name - -/* Complex loading -$wgMyExtensionIncludes = __DIR__ . '/includes'; - -## Special page class -$wgAutoloadClasses['SpecialMyExtension'] - = $wgMyExtensionIncludes . '/SpecialMyExtension.php'; - -## Tag class -$wgAutoloadClasses['TagMyExtension'] - = $wgMyExtensionIncludes . '/TagMyExtension.php'; -*/ - -// For permissions not yet used -$wgAvailableRights[] = 'viewgrades'; -$wgGroupPermissions['user']['viewgrades'] = true; - - -// Register -$wgExtensionCredits['specialpage'][] = array( - 'path' => __FILE__, - 'name' => 'Moodle', - 'author' => 'Clancer', - 'url' => 'https://www.mediawiki.org/wiki/Extension:Moodle', - 'descriptionmsg' => 'moodle-desc', - 'version' => '0.2.0', - ); - -$wgHooks['ParserFirstCallInit'][] = 'wfMoodleParserInit'; -// $wgHooks['LoadExtensionSchemaUpdates'][] = 'MoodleWS::setupSchema'; -/*$wgHooks['LoadExtensionSchemaUpdates'][] = 'fnMyHook'; -function fnMyHook( DatabaseUpdater $updater ) { - $updater->addExtensionTable( 'moodleusers', - dirname( __FILE__ ) . '/moodleusers.sql', true ); - return true; -}*/ - -// Hook our callback function into the parser -function wfMoodleParserInit( Parser $parser ) { - // When the parser sees the <sample> tag, it executes - // the wfSampleRender function (see below) - $parser->setHook( 'sample', 'wfSampleRender' ); - // Always return true from this function. The return value does not denote - // success or otherwise have meaning - it just must always be true. - return true; -} - -// Execute -function wfSampleRender( $input, array $args, Parser $parser, PPFrame $frame ) { - $parser->disableCache(); - - global $wgMoodleWSInstance; - - // $output = $parser->recursiveTagParse( $text, $frame ); - // return '<div class="wonderful">' . $output . '</div>'; - - $attr = array(); - // This time, make a list of attributes and their values, - // and dump them, along with the user input - foreach ( $args as $name => $value ) - $attr[] = '<strong>' . htmlspecialchars( $name ) . '</strong> = ' . htmlspecialchars( $value ); - return implode( '<br />', $attr ) . "\n\n" . htmlspecialchars( $input ) . $wgMoodleWSInstance; - -// The following lines can be used to get the variable values directly: -// $to = $args['to'] ; -// $email = $args['email'] ; - -} diff --git a/MoodleWS.alias.php b/MoodleWS.alias.php deleted file mode 100644 index c866df0..0000000 --- a/MoodleWS.alias.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Aliases for myextension - * - * @file - * @ingroup Extensions - */ - -$specialPageAliases = array(); - -/** English - * @author Clancer - */ -$specialPageAliases['en'] = array( - 'MoodleWS' => array( 'Moodle Grades' ), -); diff --git a/MoodleWS.body.php b/MoodleWS.body.php deleted file mode 100644 index 758092e..0000000 --- a/MoodleWS.body.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -# move stuff here soon -class MoodleWS { - public static function setupSchema( DatabaseUpdater $updater ) { - $updater->addExtensionTable( 'moodleusers', "/moodleusers.sql" ); - - - $file = 'people.txt'; - // Open the file to get existing content - $current = file_get_contents( $file ); - // Append a new person to the file - $current .= "John Smith\n"; - // Write the contents back to the file - file_put_contents( $file, $current ); - - - return true; - } -} diff --git a/MoodleWS.i18n.php b/MoodleWS.i18n.php deleted file mode 100644 index 311887e..0000000 --- a/MoodleWS.i18n.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/** - * This is a backwards-compatibility shim, generated by: - * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php - * - * Beginning with MediaWiki 1.23, translation strings are stored in json files, - * and the EXTENSION.i18n.php file only exists to provide compatibility with - * older releases of MediaWiki. For more information about this migration, see: - * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format - * - * This shim maintains compatibility back to MediaWiki 1.17. - */ -$messages = array(); -if ( !function_exists( 'wfJsonI18nShimf0b5d70a261ff9c5' ) ) { - function wfJsonI18nShimf0b5d70a261ff9c5( $cache, $code, &$cachedData ) { - $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); - foreach ( $codeSequence as $csCode ) { - $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json"; - if ( is_readable( $fileName ) ) { - $data = FormatJson::decode( file_get_contents( $fileName ), true ); - foreach ( array_keys( $data ) as $key ) { - if ( $key === '' || $key[0] === '@' ) { - unset( $data[$key] ); - } - } - $cachedData['messages'] = array_merge( $data, $cachedData['messages'] ); - } - - $cachedData['deps'][] = new FileDependency( $fileName ); - } - return true; - } - - $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShimf0b5d70a261ff9c5'; -} diff --git a/MoodleWS.php b/MoodleWS.php deleted file mode 100644 index 35adcc9..0000000 --- a/MoodleWS.php +++ /dev/null @@ -1,4 +0,0 @@ -<?php - -// This entry point has moved to Moodle.php -require_once( __DIR__ . '/Moodle.php' ); diff --git a/SpecialMoodleWS.php b/SpecialMoodleWS.php deleted file mode 100644 index dc4a376..0000000 --- a/SpecialMoodleWS.php +++ /dev/null @@ -1,209 +0,0 @@ -<?php -# reference: http://www.mediawiki.org/wiki/Extension:PageSecurity/Create_the_database_tables shows can ask user to create own tables -# reference: http://www.mediawiki.org/wiki/Extension:GetUserName shows how to get username from user objects, also magic word extension - -# notes: - # the queries probably need sanitising as the user is asked to enter their moodle details when setting up grades access - # in addition their mediawiki usernae is also used in the original select query - # - # there is a function to return to main page instead of the hack used in cancel but cant remember it -class SpecialMoodleWS extends SpecialPage { - function __construct() { - # parent::__construct( 'MoodleWS' ); - # To implement permissions (wont show up in specialpages list) for this page - parent::__construct( 'MoodleWS', 'viewgrades' ); - } - - public function doesWrites() { - return true; - } - - # WIP - # will get sanitised username and password from post - function newMoodleUser () { - global $wgUser; - - $dbw = wfGetDB( DB_MASTER ); - # Do queries - $res = $dbw->insert( - 'moodleusers', - array( 'moodle_id' => '****', - 'mediawiki_id' => $wgUser->getID() - ), - __METHOD__, - array() - ); - # function insert( $table, $a, $fname = 'Database::insert', $options = array() ); - } - - function execute( $par ) { - # execute permission implementation (will give restriction error on direct url access) - if ( !$this->userCanExecute( $this->getUser() ) ) { - $this->displayRestrictionError(); - return; - } - - global $wgMoodleWSInstance; - global $wgMoodleWSToken; - global $wgMoodleWSServiceShortname; - global $wgUser; - - $request = $this->getRequest(); - $output = $this->getOutput(); - $this->setHeaders(); - - # Handle Cancel - if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) { - $titleObj = Title::newMainPage(); - $query = $request->getVal( 'returntoquery' ); - $this->getOutput()->redirect( $titleObj->getFullURL( $query ) ); - return; - } - - ## WIP - # To avoid potential database delay the form should post the moodle user data to be used initially - # this should also allow a one time login check to validate the information before associating the user - # and the moodle user in the database - if ( $request->wasPosted() ) { - # perform moodle login check (needs to get username and password from post) - $url = "http://" . $wgMoodleWSInstance . "login/token.php?username=*****&password=******&service=" . $wgMoodleWSServiceShortname; - - $content = Http::request( 'POST', $url, $params ); - $obj2 = json_decode( $content, true ); - if ( is_null( $obj2['error'] ) ) { - $wikitext = 'Hello world!' . $content . $url; - $this->newMoodleUser(); - } else { - $wikitext = 'uh oh' . $obj2['error'] . $url; - } - $output->addWikiText( $wikitext ); - - # new moodle user - - # query display grades as normal with user info - } else { - - # WIP - # Get relevant information for getting grades via Moodle Web Service - $dbr = wfGetDB( DB_SLAVE ); - $res = $dbr->select( - 'moodleusers', # $table - array( 'moodle_id', 'mediawiki_id' ), # $vars (columns of the table) - 'mediawiki_id = ' . $wgUser->getID(), # $conds - __METHOD__, # $fname = 'Database::select', - array() # $options = array() - ); - # Test Output - $found = false; - foreach ( $res as $row ) { - if ( !is_null( $row->moodle_id ) ) { - $output->addWikiText( "current id: " . $wgUser->getID() . " from database: " . $row->mediawiki_id . " moodle: " . $row->moodle_id ); - $found = true; - } - } - if ( $found ) { - - # If Found user (WIP) - # This currently needs two modifications to a core installation of moodle - # the first is to get a userid from a username - # the second is to be able to get grades from a course - # I am currently working on my own implementation of these that can be added - # to webservices it will be documented soon - /*$functionname = 'core_user_get_users_by_id';#'core_course_get_courses'; - - - # Test call to outside using info set in localsettings.php - # Will later use name from table to get grades - $getparam = "&userids[]=2"; - $url = "http://" . $wgMoodleWSInstance . "webservice/rest/server.php?wstoken=" . $wgMoodleWSToken . '&wsfunction='.$functionname . $getparam; - $req = MWHttpRequest::factory ($url, $options=null); - $status = $req->execute(); - $content = $req->getContent(); - $wikitext = $wgUser->getID() . 'Hello world!' . $content . $url; - $output->addWikiText( $wikitext ); - */ - } else { - # Else allow user to link their moodle account - $this->showRegisterForm(); - } - } - } - - # WIP - # Needs Messages - # Uses structure taken from: SpecialChangePassword.php - function showRegisterForm() { - global $wgUser; - - $prettyFields = array( - array( 'wpName', 'username', 'text', $wgUser->getName() ), - array( 'Moodle Name', 'moodleusername', 'input', null ), - array( 'Moodle Password', 'moodlepassword', 'password', null ), - ); - - $this->getOutput()->addHTML( - Xml::fieldset( $this->msg( 'resetpass_header' )->text() ) . - Xml::openElement( 'form', - array( - 'method' => 'post', - 'action' => $this->getPageTitle()->getLocalURL(), - 'id' => 'mw-resetpass-form' ) ) . "\n" . - # $hiddenFieldsStr . - # $this->msg( 'resetpass_text' )->parseAsBlock() . "\n" . - Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" . - $this->pretty( $prettyFields ) . "\n" . - # $rememberMe . - "<tr>\n" . - "<td></td>\n" . - '<td class="mw-input">' . - Xml::submitButton( $this->msg( 'moodlews-register' )->text() ) . - Xml::submitButton( $this->msg( 'resetpass-submit-cancel' )->text(), array( 'name' => 'wpCancel' ) ) . - "</td>\n" . - "</tr>\n" . - Xml::closeElement( 'table' ) . - Xml::closeElement( 'form' ) . - Xml::closeElement( 'fieldset' ) . "\n" - ); - } - - /** - * pretty function used in SpecialChangePassword, adapted to autofocus Moodle Name - * @param $fields array - * @return string - */ - function pretty( $fields ) { - $out = ''; - foreach ( $fields as $list ) { - list( $name, $label, $type, $value ) = $list; - if ( $type == 'text' ) { - $field = htmlspecialchars( $value ); - } else { - $attribs = array( 'id' => $name ); - if ( $name == 'Moodle Name' ) { - $attribs[] = 'autofocus'; - } - $field = Html::input( $name, $value, $type, $attribs ); - } - $out .= "<tr>\n"; - $out .= "\t<td class='mw-label'>"; - - if ( $type != 'text' ) { - $out .= Xml::label( $this->msg( $label )->text(), $name ); - } else { - $out .= $this->msg( $label )->escaped(); - } - - $out .= "</td>\n"; - $out .= "\t<td class='mw-input'>"; - $out .= $field; - $out .= "</td>\n"; - $out .= "</tr>"; - } - - return $out; - } - - protected function getGroupName() { - return 'other'; - } -} diff --git a/i18n/ast.json b/i18n/ast.json deleted file mode 100644 index ed82019..0000000 --- a/i18n/ast.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Xuacu" - ] - }, - "moodle-desc": "Integración con Moodle" -} diff --git a/i18n/be-tarask.json b/i18n/be-tarask.json deleted file mode 100644 index f329fe0..0000000 --- a/i18n/be-tarask.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Red Winged Duck" - ] - }, - "moodle-desc": "Moodle-інтэграцыя" -} diff --git a/i18n/de.json b/i18n/de.json deleted file mode 100644 index f901cb8..0000000 --- a/i18n/de.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Metalhead64" - ] - }, - "moodle-desc": "Moodle-Integration" -} diff --git a/i18n/en.json b/i18n/en.json deleted file mode 100644 index f06d3a9..0000000 --- a/i18n/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "@metadata": { - "authors": [] - }, - "moodle-desc": "Moodle integration" -} diff --git a/i18n/es.json b/i18n/es.json deleted file mode 100644 index 460ef08..0000000 --- a/i18n/es.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Macofe" - ] - }, - "moodle-desc": "Integración con Moodle" -} diff --git a/i18n/fr.json b/i18n/fr.json deleted file mode 100644 index d1774ea..0000000 --- a/i18n/fr.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Gomoko" - ] - }, - "moodle-desc": "Intégration de Moodle" -} diff --git a/i18n/gl.json b/i18n/gl.json deleted file mode 100644 index cb62829..0000000 --- a/i18n/gl.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Elisardojm" - ] - }, - "moodle-desc": "Integración de Moodle" -} diff --git a/i18n/lb.json b/i18n/lb.json deleted file mode 100644 index 465951a..0000000 --- a/i18n/lb.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Robby" - ] - }, - "moodle-desc": "Moodle-Integratioun" -} diff --git a/i18n/mk.json b/i18n/mk.json deleted file mode 100644 index d7c4e09..0000000 --- a/i18n/mk.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Bjankuloski06" - ] - }, - "moodle-desc": "Вградување на Moodle" -} diff --git a/i18n/nb.json b/i18n/nb.json deleted file mode 100644 index 3e7f008..0000000 --- a/i18n/nb.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Jon Harald Søby" - ] - }, - "moodle-desc": "Moodle-integrering" -} diff --git a/i18n/pt-br.json b/i18n/pt-br.json deleted file mode 100644 index 003bcb1..0000000 --- a/i18n/pt-br.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Felipe L. Ewald" - ] - }, - "moodle-desc": "Integração com Moodle" -} diff --git a/i18n/pt.json b/i18n/pt.json deleted file mode 100644 index 058265a..0000000 --- a/i18n/pt.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Hamilton Abreu" - ] - }, - "moodle-desc": "Integração com Moodle" -} diff --git a/i18n/qqq.json b/i18n/qqq.json deleted file mode 100644 index 31e658a..0000000 --- a/i18n/qqq.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "@metadata": [], - "moodle-desc": "{{desc|name=Moodle|url=https://www.mediawiki.org/wiki/Extension:Moodle}}" -} diff --git a/i18n/roa-tara.json b/i18n/roa-tara.json deleted file mode 100644 index 15b1e77..0000000 --- a/i18n/roa-tara.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Joetaras" - ] - }, - "moodle-desc": "'Ndegrazzione de Moodle" -} diff --git a/i18n/ru.json b/i18n/ru.json deleted file mode 100644 index 97f2732..0000000 --- a/i18n/ru.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Facenapalm" - ] - }, - "moodle-desc": "Интеграция с Moodle." -} diff --git a/i18n/sv.json b/i18n/sv.json deleted file mode 100644 index 97fea84..0000000 --- a/i18n/sv.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "WikiPhoenix" - ] - }, - "moodle-desc": "Moodle-integrering" -} diff --git a/i18n/uk.json b/i18n/uk.json deleted file mode 100644 index 9674a4a..0000000 --- a/i18n/uk.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Piramidion" - ] - }, - "moodle-desc": "Інтеграція Moodle" -} diff --git a/i18n/zh-hans.json b/i18n/zh-hans.json deleted file mode 100644 index 1f23bb9..0000000 --- a/i18n/zh-hans.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Liuxinyu970226" - ] - }, - "moodle-desc": "Moodle集成" -} diff --git a/moodleusers.sql b/moodleusers.sql deleted file mode 100644 index a7d98b6..0000000 --- a/moodleusers.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE /*$wgDBprefix*/moodleusers ( - -- ID of moodle user associated with mediawiki account - moodle_id int(10) unsigned NOT NULL, - -- ID of mediawiki user associated with moodle account - mediawiki_id varchar(255) binary NOT NULL, - - PRIMARY KEY mediawiki_id (mediawiki_id) -) /*$wgDBTableOptions*/; diff --git a/package.json b/package.json deleted file mode 100644 index 88a5f50..0000000 --- a/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "private": true, - "scripts": { - "test": "grunt test" - }, - "devDependencies": { - "grunt": "1.0.1", - "grunt-banana-checker": "0.5.0", - "grunt-jsonlint": "1.0.7" - } -} -- To view, visit https://gerrit.wikimedia.org/r/389544 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I199756534b1bb93319d113206f32de82e6101e63 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Moodle Gerrit-Branch: master Gerrit-Owner: Umherirrender <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
