Cicalese has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358364 )
Change subject: Initial commit. ...................................................................... Initial commit. Change-Id: I55698ed4028c6d6cca3cc531bf75ec1b267a69d8 --- A CODE_OF_CONDUCT.md A COPYING A Gruntfile.js A extension.json A i18n/en.json A i18n/qqq.json A includes/CreateUserPageHooks.php A package.json 8 files changed, 134 insertions(+), 0 deletions(-) Approvals: Cicalese: Looks good to me, approved jenkins-bot: Verified diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..d8e5d08 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1 @@ +The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Code_of_Conduct). diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5eb4ac0 --- /dev/null +++ b/COPYING @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 The MITRE Corporation + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..a45071e --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,21 @@ +/*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/**', + '!vendor/**' + ] + } + } ); + + grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] ); + grunt.registerTask( 'default', 'test' ); +}; diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..4cb4a59 --- /dev/null +++ b/extension.json @@ -0,0 +1,28 @@ +{ + "name": "CreateUserPage", + "version": "1.0", + "author": [ + "[https://www.mediawiki.org/wiki/User:Cindy.cicalese Cindy Cicalese]" + ], + "url": "https://www.mediawiki.org/wiki/Extension:Create_User_Page", + "descriptionmsg": "createuserpage-desc", + "license-name": "MIT", + "type": "other", + "MessagesDirs": { + "CreateUserPage": [ + "i18n" + ] + }, + "AutoloadClasses": { + "CreateUserPageHooks": "includes/CreateUserPageHooks.php" + }, + "Hooks": { + "UserLoginComplete": [ + "CreateUserPageHooks::checkForUserPage" + ] + }, + "config": { + "CreateUserPage_PageContent": "{{User}}" + }, + "manifest_version": 1 +} diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..a9ad1a1 --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "cicalese" + ] + }, + "createuserpage-desc": "Create user page for a user if it does not exist when the user logs in." +} diff --git a/i18n/qqq.json b/i18n/qqq.json new file mode 100644 index 0000000..7124385 --- /dev/null +++ b/i18n/qqq.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "cicalese" + ] + }, + "createuserpage-desc": "{{desc|name=Create User Page|url=https://www.mediawiki.org/wiki/Extension:Create_User_Page}}" +} diff --git a/includes/CreateUserPageHooks.php b/includes/CreateUserPageHooks.php new file mode 100755 index 0000000..d29a223 --- /dev/null +++ b/includes/CreateUserPageHooks.php @@ -0,0 +1,36 @@ +<?php + +/* + * Copyright (c) 2017 The MITRE Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +class CreateUserPageHooks { + + public static function checkForUserPage( &$user, &$inject_html ) { + $title = Title::newFromText( 'User:' . $user->mName ); + if ( !is_null( $title ) && !$title->exists() ) { + $page = new WikiPage( $title ); + $page->doEdit( $GLOBALS['wgCreateUserPage_PageContent'], + 'create user page', EDIT_NEW); + } + return true; + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..bcf5b13 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "private": true, + "scripts": { + "test": "grunt test" + }, + "devDependencies": { + "grunt": "1.0.1", + "grunt-banana-checker": "0.5.0", + "grunt-jsonlint": "1.1.0" + } +} -- To view, visit https://gerrit.wikimedia.org/r/358364 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I55698ed4028c6d6cca3cc531bf75ec1b267a69d8 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CreateUserPage Gerrit-Branch: master Gerrit-Owner: Cicalese <[email protected]> Gerrit-Reviewer: Cicalese <[email protected]> Gerrit-Reviewer: Siebrand <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
