diff --git a/100Change2017/ansible/100Change2017.yml b/100Change2017/ansible/100Change2017.yml index d733a0d3..f2e99e0c 100644 --- a/100Change2017/ansible/100Change2017.yml +++ b/100Change2017/ansible/100Change2017.yml @@ -4,16 +4,25 @@ become: true become_user: "{{ deployment_user }}" roles: - - postgres + - postgres - hosts: mediawiki become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - collection + - embed_video + - permissions + - simplesaml + - torquedataconnect + - 100Change2017 + # This should always go last, to run db updates and restart + - finishmediawiki - hosts: simplesaml become: true become_user: "{{ deployment_user }}" roles: - - simplesaml + - simplesaml diff --git a/100Change2017/ansible/inv/local/group_vars/all.tmpl b/100Change2017/ansible/inv/local/group_vars/all.tmpl index 2dfcff01..9893496f 100644 --- a/100Change2017/ansible/inv/local/group_vars/all.tmpl +++ b/100Change2017/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: 100Change2017 + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: LFC100Change2017 + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/100Change2017/ansible/inv/prod/group_vars/all/base b/100Change2017/ansible/inv/prod/group_vars/all/base index 78a2275f..11042992 100644 --- a/100Change2017/ansible/inv/prod/group_vars/all/base +++ b/100Change2017/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: 100Change2017 +torquedataconnect_sheet_name: LFC100Change2017 html_directory: /var/www/html mediawiki_install_directory: /home/deploy/100Change2017/ mediawiki_mwlib_username: mwlib diff --git a/100Change2017/ansible/roles/mediawiki/files/100Change-logo150.png b/100Change2017/ansible/roles/100Change2017/files/100Change-logo150.png similarity index 100% rename from 100Change2017/ansible/roles/mediawiki/files/100Change-logo150.png rename to 100Change2017/ansible/roles/100Change2017/files/100Change-logo150.png diff --git a/100Change2017/ansible/roles/100Change2017/tasks/main.yml b/100Change2017/ansible/roles/100Change2017/tasks/main.yml new file mode 100644 index 00000000..87794c1b --- /dev/null +++ b/100Change2017/ansible/roles/100Change2017/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: Transfer LFC Logo + copy: + src: 100Change-logo150.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/100Change-logo150.png" + +- name: Install LFC Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/100Change-logo150.png"; diff --git a/100Change2017/ansible/roles/mediawiki/files/Common.css b/100Change2017/ansible/roles/mediawiki/files/Common.css deleted file mode 100644 index e502a300..00000000 --- a/100Change2017/ansible/roles/mediawiki/files/Common.css +++ /dev/null @@ -1,13 +0,0 @@ -/* This disables some of the Special:Log inputs */ -.rootpage-Special_Log .mw-usertoollinks { - display:none; -} -.rootpage-Special_Log .comment { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLTagFilter { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLMultiSelectField { - display:none; -} diff --git a/100Change2017/ansible/roles/mediawiki/tasks/main.yml b/100Change2017/ansible/roles/mediawiki/tasks/main.yml deleted file mode 100644 index 792e3ba1..00000000 --- a/100Change2017/ansible/roles/mediawiki/tasks/main.yml +++ /dev/null @@ -1,468 +0,0 @@ ---- - -- name: Add php repository - Ubuntu - become_user: root - apt_repository: - repo: ppa:ondrej/php - when: ansible_distribution == 'Ubuntu' - -- name: install prerequisites - become_user: root - # See https://www.mediawiki.org/wiki/Manual:Installation_requirements - apt: - name: "{{ item }}" - #update_cache: yes # commented out for dev purposes - state: present - loop: - - apache2 - - curl - - git - - php - - php-apcu - - php-cli - - php-intl - - php-mbstring - - php-pgsql - - php-xml - - unzip - -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable PHP modules - become_user: root - shell: phpenmod {{ item }} - loop: - - mbstring - - mysqli - - xml - -- name: Get Composer - get_url: - url: https://getcomposer.org/installer - dest: "{{ mediawiki_install_directory }}/composer-setup.php" - checksum: "sha384:795f976fe0ebd8b75f26a6dd68f78fd3453ce79f32ecb33e7fd087d39bfeb978342fb73ac986cd4f54edd0dc902601dc" - -- name: Make wiki bin directory - file: - path: "{{ mediawiki_install_directory }}/bin" - state: directory - -- name: Install Composer locally - shell: php {{ mediawiki_install_directory }}/composer-setup.php --install-dir={{ mediawiki_install_directory }}/bin --filename=composer - -- name: Remove Composer setup script - file: - path: "{{ mediawiki_install_directory }}/composer-setup.php" - state: absent - -- name: Install Composer globally - become_user: root - shell: mv {{ mediawiki_install_directory }}/bin/composer /usr/local/bin/composer - -- name: Install MW with Composer - command: composer install --no-dev - args: - chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install PluggableAuth - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install SimpleSAML extension - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install Collection - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout ActivityLog - git: - repo: https://github.com/OpenTechStrategies/ActivityLog - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" - version: 27e9191 - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - -- name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=postgres --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=100Change2017 --scriptpath=\"/100Change2017\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"100Change2017\" \"admin\"" - args: - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" - -- name: Enable PluggableAuth - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" - block: | - wfLoadExtension( 'PluggableAuth' ); - $wgPluggableAuth_EnableAutoLogin = true; - $wgPluggableAuth_EnableLocalLogin = true; - $wgPluggableAuth_EnableLocalProperties = false; - $wgPluggableAuth_ButtonLabel = "Log In With MacArthur Okta"; - $wgInvalidUsernameCharacters = ""; - -- name: Enable SimpleSAMLphp extension - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" - block: | - wfLoadExtension( 'SimpleSAMLphp' ); - $wgSimpleSAMLphp_SyncAllGroups_LocallyManaged = ["sysop", "DecisionMakers", "LFCEvaluators"]; - $wgSimpleSAMLphp_InstallDir = '{{ simplesaml_install_directory }}/simplesamlphp-1.18.4'; - $wgSimpleSAMLphp_AuthSourceId = '{{ simplesaml_okta_metadata_name }}'; - $wgSimpleSAMLphp_RealNameAttribute = ['firstName', 'lastName']; - $wgSimpleSAMLphp_EmailAttribute = 'email'; - $wgSimpleSAMLphp_UsernameAttribute = 'username'; - $wgSimpleSAMLphp_GroupMap = [ - 'sysop' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], - 'DecisionMakers' => ['groups' => ['LFC Decision Makers']], - 'LFCEvaluators' => ['groups' => ['LFC Consultants']] - ]; - - $wgSimpleSAMLphp_SyncAllGroups_GroupNameModificationCallback = function($origGroupName){ - # Remove spaces - return preg_replace('/\s/', '', $origGroupName); - }; - $wgSimpleSAMLphp_AttributeProcessorFactories = [ - "MediaWiki\\Extension\\SimpleSAMLphp\\AttributeProcessor\\SyncAllGroups::factory" - ]; - -- name: Enable Collection - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE COLLECTION CONFIG" - block: | - require_once "$IP/extensions/Collection/Collection.php"; - $wgCollectionMWServeURL = "http://127.0.0.1:8899"; - $wgCollectionMaxArticles = 250; - $wgEnableApi = true; - $wgCollectionFormats = array( 'rl' => 'PDF',); - $wgCollectionPortletFormats = []; - $wgCollectionDisableDownloadSection = false; - $wgHooks['ApiBeforeMain'][] = function($main) { - global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; - if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { - $wgTorqueDataConnectRenderToHTML = false; - $tdcinfo = $main->getRequest()->getText("tdcinfo", false); - list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); - } - }; - $wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { - global $wgCollectionMWServeCredentials; - $group = TorqueDataConnectConfig::getValidGroup($user); - $view = TorqueDataConnectConfig::getCurrentView(); - $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; - }; - -- name: Enable TorqueDataConnect - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" - block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectWikiKey = "100Change2017"; - $wgTorqueDataConnectSheetName = "LFC100Change2017"; - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - wfLoadExtension('TorqueDataConnect'); - -- name: Set TOC depth - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMaxTocLevel = 2; - -- name: Disable Collection Warning 1 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Disable Collection Warning 2 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Remove Collection Book Text - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" - regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' - replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' - -- name: Install ActivityLog Configuration - copy: - src: ActivityLogConfiguration - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable ActivityLog - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" - block: | - wfLoadExtension('ActivityLog'); - $wgMessagesDirs['ActivityLogConfiguration'] = 'ActivityLogConfiguration/i18n'; - $wgActivityLogHooksToWatch["ArticleViewHeader"] = function ($article) { - $referrer = $_SERVER['HTTP_REFERER']; - $ourServer = "http://torque.leverforchange.org"; - - if($referrer && $ourServer == substr($referrer, 0, strlen($ourServer))) { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader-with-referrer", - $_SERVER['HTTP_REFERER'] - ); - } else { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader" - ); - } - }; - - $wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { - global $wgTitle; - return array($user, $wgTitle, "activitylog-userlogin"); - }; - - $wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { - return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); - }; - -- name: Disable MediaWiki Cache - # When the cache is enabled, on AWS, with the default setting, - # the following createAndPromote.php command fails due to cache timeout. - # The reason isn't clear, but for now, this will fix it. - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMainCacheType = CACHE_NONE; - -- name: Create mwlib user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" - -- name: Create csv2wiki user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" - -- name: Set Group Permissions - blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgGroupPermissions['*']['read'] = false; - $wgGroupPermissions['Staff']['read'] = true; - - foreach($wgGroupPermissions['sysop'] as $key => $value) { - $wgGroupPermissions['LFCTorque'][$key] = $value; - } - - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - - # Permissions that we want sysops/admins to have that - # but not for staff go here - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - foreach($wgGroupPermissions['sysop'] as $key => $value) { - $wgGroupPermissions['LFCTorqueAdmin'][$key] = $value; - } - - # Groups requested specifically by LFC. - $wgGroupPermissions['LFCResearchPartners']['read'] = true; - $wgGroupPermissions['LFCEvaluators']['read'] = true; - - # These are OTS Torque Standard Groups - $wgGroupPermissions['OutsideReviewers']['read'] = true; - $wgGroupPermissions['Staff']['read'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['read'] = true; - $wgGroupPermissions['DecisionMakers']['read'] = true; - - # Disable teamcomments for users on this wiki by default. - $wgGroupPermissions['*']['teamcomment'] = false; - $wgGroupPermissions['*']['teamcommentseeusernames'] = false; - - # Then enable teamcomments for the groups that should be leaving comments - $wgGroupPermissions['Staff']['teamcomment'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['DecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['sysop']['teamcomment'] = true; - $wgGroupPermissions['LFCResearchPartners']['teamcomment'] = true; - $wgGroupPermissions['LFCEvaluators']['teamcomment'] = true; - - # Allow some groups to see usernames - $wgGroupPermissions['Staff']['teamcommentseeusernames'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['teamcommentseeusernames'] = true; - $wgGroupPermissions['DecisionMaker']['teamcommentseeusernames'] = true; - $wgGroupPermissions['sysop']['teamcommentseeusernames'] = true; - - # Log permissions (ability to see Special:Log) - $wgAvailableRights[] = 'view-special-log'; - $wgGroupPermissions['*']['view-special-log'] = false; - $wgGroupPermissions['sysop']['view-special-log'] = true; - -- name: Disable Special:Log for groups that don't have view-special-log - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SpecialPage_initList'][] = function ( &$list ) { - global $wgUser; - - if(!$wgUser->isAllowed('view-special-log')) { - unset( $list['Log'] ); - } - return true; - }; - -- name: Create Special:Log name overrides - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTitlesOverrideMessages = [ - "picksomelogpage" => "Selection", - "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", - "simplefavoriteslog" => "Favorites", - "log-name-create" => "Page Creation", - "movelogpage" => "Page Rename", - "uploadlogpage" => "File Upload", - "dellogpage" => "Page Deletion", - "newuserlogpage" => "User Creation", - "log-name-teamcomments" => "Comments", - "torquedataconnect-apiaccesslog" => "API Accesses", - "torquedataconnect-datachangeslog" => "Data Changes", - "rightslog" => "Changes to Access Control / Permissions" - ]; - - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $logTitlesOverrideMessages; - if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { - $message = $logTitlesOverrideMessages[strtolower($title)]; - } - }; - -- name: Disable Special:Log types that aren't of interest - blockinfile: - marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; - - $wgHooks['SetupAfterCache'][] = function () { - global $wgLogTypes, $logTypesBlacklist; - foreach($logTypesBlacklist as $logType) { - unset($wgLogTypes[array_search($logType, $wgLogTypes)]); - } - - return true; - }; - -- name: Change Special:Log format slightly - blockinfile: - marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # This is a little brittle, based on how the lines are rendered by the skin currently used - # but should work for the foreseeable future. - $wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ - $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); - }; - -- name: Transfer LFC Logo - copy: - src: 100Change-logo150.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/100Change-logo150.png" - -- name: Install LFC Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/100Change-logo150.png"; - -- name: Transfer Common group css - copy: - src: Common.css - dest: "{{ mediawiki_install_directory }}/Common.css" - -- name: Install Common group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" - -- name: Remove Common group css - file: - path: "{{ mediawiki_install_directory }}/Common.css" - state: absent - -- name: Transfer htaccess - copy: - src: .htaccess - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" - -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" - -# Handle Apache changes -- name: Symlink to webserver directory - become_user: root - file: - state: link - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/100Change2017" - -- name: Set permissions on attachments directory - become_user: root - file: - path: "{{ html_directory }}/100Change2017/images/" - owner: www-data - group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted diff --git a/100Change2017/ansible/roles/simplesaml/tasks/main.yml b/100Change2017/ansible/roles/simplesaml/tasks/main.yml deleted file mode 100644 index 6c0c7fd3..00000000 --- a/100Change2017/ansible/roles/simplesaml/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Add okta account to autoconfig - lineinfile: - path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" - insertafter: '\$metadata_url_for = array\(' - line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," diff --git a/100Change2017Partners/ansible/100Change2017Partners.yml b/100Change2017Partners/ansible/100Change2017Partners.yml index 4d6ed699..6a8eb250 100644 --- a/100Change2017Partners/ansible/100Change2017Partners.yml +++ b/100Change2017Partners/ansible/100Change2017Partners.yml @@ -4,10 +4,17 @@ become: true become_user: "{{ deployment_user }}" roles: - - postgres + - postgres - hosts: mediawiki become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - embed_video + - permissions + - torquedataconnect + - 100Change2017Partners + # This should always go last, to run db updates and restart + - finishmediawiki diff --git a/100Change2017Partners/ansible/inv/local/group_vars/all.tmpl b/100Change2017Partners/ansible/inv/local/group_vars/all.tmpl index 72615ac5..06d5c269 100644 --- a/100Change2017Partners/ansible/inv/local/group_vars/all.tmpl +++ b/100Change2017Partners/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: 100Change2017Partners + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: LFC100Change2017 + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/100Change2017Partners/ansible/inv/prod/group_vars/all/base b/100Change2017Partners/ansible/inv/prod/group_vars/all/base index a253ae09..7fbf15a1 100644 --- a/100Change2017Partners/ansible/inv/prod/group_vars/all/base +++ b/100Change2017Partners/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: 100Change2017Partners +torquedataconnect_sheet_name: LFC100Change2017 html_directory: /var/www/html mediawiki_install_directory: /home/deploy/100Change2017Partners/ mediawiki_csv2wiki_username: csv2wiki diff --git a/100Change2017/ansible/roles/mediawiki/files/.htaccess b/100Change2017Partners/ansible/roles/100Change2017Partners/files/.htaccess similarity index 100% rename from 100Change2017/ansible/roles/mediawiki/files/.htaccess rename to 100Change2017Partners/ansible/roles/100Change2017Partners/files/.htaccess diff --git a/100Change2017Partners/ansible/roles/mediawiki/files/100Change-logo150.png b/100Change2017Partners/ansible/roles/100Change2017Partners/files/100Change-logo150.png similarity index 100% rename from 100Change2017Partners/ansible/roles/mediawiki/files/100Change-logo150.png rename to 100Change2017Partners/ansible/roles/100Change2017Partners/files/100Change-logo150.png diff --git a/100Change2017Partners/ansible/roles/100Change2017Partners/tasks/main.yml b/100Change2017Partners/ansible/roles/100Change2017Partners/tasks/main.yml new file mode 100644 index 00000000..87794c1b --- /dev/null +++ b/100Change2017Partners/ansible/roles/100Change2017Partners/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: Transfer LFC Logo + copy: + src: 100Change-logo150.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/100Change-logo150.png" + +- name: Install LFC Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/100Change-logo150.png"; diff --git a/100Change2017Partners/ansible/roles/postgres/tasks/main.yml b/100Change2017Partners/ansible/roles/postgres/tasks/main.yml deleted file mode 100644 index 25a6faa1..00000000 --- a/100Change2017Partners/ansible/roles/postgres/tasks/main.yml +++ /dev/null @@ -1,26 +0,0 @@ -- name: install prerequisites - become_user: root - apt: - name: "{{ item }}" - update_cache: yes - state: present - loop: - - postgresql - - python-psycopg2 - -- name: Create database user - become: true - become_user: postgres - postgresql_user: - login_password: "{{ postgres_root_password }}" - name: wikiuser - password: "{{ db_password }}" - state: present - -- name: create postgresql db - become: true - become_user: postgres - postgresql_db: - name: 100Change2017Partners - state: present - owner: wikiuser diff --git a/100Change2020/ansible/100Change2020.yml b/100Change2020/ansible/100Change2020.yml index 61ab44df..6922d232 100644 --- a/100Change2020/ansible/100Change2020.yml +++ b/100Change2020/ansible/100Change2020.yml @@ -16,4 +16,19 @@ become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - collection + - embed_video + - permissions + - simplefavorites + # PickSome has to come after collection so the left menu bar is correct + - picksome + - simplesaml + - rss + - teamcomments + - torquedataconnect + # This should come after permissions because of overrides of defaults + - 100Change2020 + # This should always go last, to run db updates and restart + - finishmediawiki diff --git a/100Change2020/ansible/inv/dev/group_vars/all/base b/100Change2020/ansible/inv/dev/group_vars/all/base index 231306bf..651ba94d 100644 --- a/100Change2020/ansible/inv/dev/group_vars/all/base +++ b/100Change2020/ansible/inv/dev/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: lfc +torquedataconnect_sheet_name: proposals html_directory: /var/www/html mediawiki_install_directory: /home/deploy/lfc/ mediawiki_mwlib_username: mwlib diff --git a/100Change2020/ansible/inv/local/group_vars/all.tmpl b/100Change2020/ansible/inv/local/group_vars/all.tmpl index 43afe044..4d36ca14 100644 --- a/100Change2020/ansible/inv/local/group_vars/all.tmpl +++ b/100Change2020/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: 100Change2020 + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: LFC100Change2020 + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/100Change2020/ansible/inv/prod/group_vars/all/base b/100Change2020/ansible/inv/prod/group_vars/all/base index af1effec..89c611da 100644 --- a/100Change2020/ansible/inv/prod/group_vars/all/base +++ b/100Change2020/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: lfc +torquedataconnect_sheet_name: proposals html_directory: /var/www/html mediawiki_install_directory: /home/deploy/lfc/ mediawiki_mwlib_username: mwlib diff --git a/100Change2020/ansible/inv/staging/group_vars/all/base b/100Change2020/ansible/inv/staging/group_vars/all/base index af1effec..89c611da 100644 --- a/100Change2020/ansible/inv/staging/group_vars/all/base +++ b/100Change2020/ansible/inv/staging/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: lfc +torquedataconnect_sheet_name: proposals html_directory: /var/www/html mediawiki_install_directory: /home/deploy/lfc/ mediawiki_mwlib_username: mwlib diff --git a/100Change2017Partners/ansible/roles/mediawiki/files/.htaccess b/100Change2020/ansible/roles/100Change2020/files/.htaccess similarity index 100% rename from 100Change2017Partners/ansible/roles/mediawiki/files/.htaccess rename to 100Change2020/ansible/roles/100Change2020/files/.htaccess diff --git a/100Change2020/ansible/roles/mediawiki/files/LeverForChange_Logo.png b/100Change2020/ansible/roles/100Change2020/files/LeverForChange_Logo.png similarity index 100% rename from 100Change2020/ansible/roles/mediawiki/files/LeverForChange_Logo.png rename to 100Change2020/ansible/roles/100Change2020/files/LeverForChange_Logo.png diff --git a/100Change2020/ansible/roles/100Change2020/tasks/main.yml b/100Change2020/ansible/roles/100Change2020/tasks/main.yml new file mode 100644 index 00000000..68b77e13 --- /dev/null +++ b/100Change2020/ansible/roles/100Change2020/tasks/main.yml @@ -0,0 +1,46 @@ +--- + +# Because the overrides MUST come after the originals (loaded from include statements) +# in LocalSettings, we delete the overrides from the file, and then re-insert them to +# ensure that they comes at the end of the LocalSettings file +- name: Clear pluggable auth override config + blockinfile: + marker: "## {mark} ANSIBLE PLUGABLE AUTH OVERRIDE CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + +- name: Clear picksome override config + blockinfile: + marker: "## {mark} ANSIBLE PICKSOME OVERRIDE CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + +# Contrary to above, THIS override needs to be set before loading the pluggable +# auth stuff, or else it overwrites the variable that may be set by the localloggin override. +- name: Override base pluggable auth config + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + insertbefore: "## BEGIN ANSIBLE PLUGGABLEAUTH/SIMPLSAML CONFIG" + marker: "## {mark} ANSIBLE PLUGABLE AUTH OVERRIDE CONFIG" + block: | + # We only potentially set to false if coming in from the web + if(array_key_exists('REQUEST_URI', $_SERVER)) { + $wgPluggableAuth_EnableLocalLogin = (substr($_SERVER['REQUEST_URI'], 0, 13) == "/lfc/api.php"); + } + +- name: Override some PickSome Variables + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE PICKSOME OVERRIDE CONFIG" + block: | + $wgPickSomeNumberOfPicks = 5; + $wgLFCPickSomeEligiblePage = "TorqueConfig:FinalistCandidates"; + +- name: Transfer LFC Logo + copy: + src: LeverForChange_Logo.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LeverForChange_Logo.png" + +- name: Install LFC Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/LeverForChange_Logo.png"; diff --git a/100Change2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json b/100Change2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json deleted file mode 100644 index 93685958..00000000 --- a/100Change2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "activitylog-articleviewheader": "$1 visited $3", - "activitylog-articlesavepage": "$1 edited $3", - "activitylog-articleviewheader-with-referrer": "$1 visited $3 (from $5)", - "activitylog-userlogin": "$1 logged in" -} diff --git a/100Change2020/ansible/roles/mediawiki/files/Common.css b/100Change2020/ansible/roles/mediawiki/files/Common.css deleted file mode 100644 index e502a300..00000000 --- a/100Change2020/ansible/roles/mediawiki/files/Common.css +++ /dev/null @@ -1,13 +0,0 @@ -/* This disables some of the Special:Log inputs */ -.rootpage-Special_Log .mw-usertoollinks { - display:none; -} -.rootpage-Special_Log .comment { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLTagFilter { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLMultiSelectField { - display:none; -} diff --git a/100Change2020/ansible/roles/mediawiki/files/Group-board.css b/100Change2020/ansible/roles/mediawiki/files/Group-board.css deleted file mode 100644 index a3e93949..00000000 --- a/100Change2020/ansible/roles/mediawiki/files/Group-board.css +++ /dev/null @@ -1,8 +0,0 @@ -#p-views ul li:not(.simplefavorite-icon):not(#ca-view):not(#ca-edit) { display:none!important; } -#p-cactions { display:none!important; } -#p-namespaces { display:none!important; } -#pt-mytalk { display:none!important; } -#pt-watchlist { display:none!important; } -#pt-mycontris { display:none!important; } -.mw-editsection { display:none!important; } -#p-tb { display:none!important; } diff --git a/100Change2020/ansible/roles/mediawiki/tasks/main.yml b/100Change2020/ansible/roles/mediawiki/tasks/main.yml deleted file mode 100644 index 11a6ec57..00000000 --- a/100Change2020/ansible/roles/mediawiki/tasks/main.yml +++ /dev/null @@ -1,667 +0,0 @@ ---- - -- name: Add php repository - Ubuntu - become_user: root - apt_repository: - repo: ppa:ondrej/php - when: ansible_distribution == 'Ubuntu' - -- name: install prerequisites - become_user: root - # See https://www.mediawiki.org/wiki/Manual:Installation_requirements - apt: - name: "{{ item }}" - #update_cache: yes # commented out for dev purposes - state: present - loop: - - apache2 - - curl - - git - - php - - php-apcu - - php-cli - - php-intl - - php-mbstring - - php-mysql - - php-mysqli - - php-xml - - unzip - -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable PHP modules - become_user: root - shell: phpenmod {{ item }} - loop: - - mbstring - - mysqli - - xml - -- name: Get Composer - get_url: - url: https://getcomposer.org/installer - dest: "{{ mediawiki_install_directory }}/composer-setup.php" - checksum: "sha384:795f976fe0ebd8b75f26a6dd68f78fd3453ce79f32ecb33e7fd087d39bfeb978342fb73ac986cd4f54edd0dc902601dc" - -- name: Make wiki bin directory - file: - path: "{{ mediawiki_install_directory }}/bin" - state: directory - -- name: Install Composer locally - shell: php {{ mediawiki_install_directory }}/composer-setup.php --install-dir={{ mediawiki_install_directory }}/bin --filename=composer - -- name: Remove Composer setup script - file: - path: "{{ mediawiki_install_directory }}/composer-setup.php" - state: absent - -- name: Install Composer globally - become_user: root - shell: mv {{ mediawiki_install_directory }}/bin/composer /usr/local/bin/composer - -- name: Install MW with Composer - command: composer install --no-dev - args: - chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Patch EmbedVideo - patch: - src: EmbedVideoIframeTitle.patch - basedir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/EmbedVideo-v2.8.0/" - -- name: Install RSS - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/RSS-REL1_34-0e63926.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install PluggableAuth - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install SimpleSAML extension - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install Collection - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout PickSome - git: - repo: https://github.com/OpenTechStrategies/PickSome - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/PickSome/" - version: 59df890 - -- name: Checkout ActivityLog - git: - repo: https://github.com/OpenTechStrategies/ActivityLog - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" - version: 27e9191 - -- name: Checkout SimpleFavorites - git: - repo: https://github.com/OpenTechStrategies/SimpleFavorites - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/SimpleFavorites/" - version: 59fed33 - -- name: Checkout TeamComments - git: - repo: https://github.com/OpenTechStrategies/TeamComments - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TeamComments/" - version: 450bff7 - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - -- name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=mysql --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=lfc --scriptpath=\"/lfc\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"lfc\" \"admin\"" - args: - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" - -- name: Enable RSS - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - wfLoadExtension('RSS'); - $wgRSSUrlWhitelist = ["*"]; - -- name: Enable PluggableAuth - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" - block: | - wfLoadExtension( 'PluggableAuth' ); - $wgPluggableAuth_EnableAutoLogin = true; - $wgPluggableAuth_EnableLocalLogin = true; - # We only potentially set to false if coming in from the web - if(array_key_exists('REQUEST_URI', $_SERVER)) { - $wgPluggableAuth_EnableLocalLogin = (substr($_SERVER['REQUEST_URI'], 0, 13) == "/lfc/api.php"); - } - - # We hijack at the top level if someone who knows what they are doing - # puts in a get arg before the first redirect even happens - if(array_key_exists('locallogin', $_GET)) { - setcookie('locallogin', $_GET['locallogin'], time() + 3600, '/'); - $wgPluggableAuth_EnableLocalLogin = $_GET['locallogin'] == "on"; - } - if(array_key_exists('locallogin', $_COOKIE)) { - $wgPluggableAuth_EnableLocalLogin = $_COOKIE['locallogin'] == "on"; - } - $wgPluggableAuth_EnableLocalProperties = false; - $wgPluggableAuth_ButtonLabel = "Log In With Okta"; - $wgInvalidUsernameCharacters = ""; - -- name: Enable SimpleSAMLphp extension - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" - block: | - wfLoadExtension( 'SimpleSAMLphp' ); - $wgSimpleSAMLphp_InstallDir = '{{ simplesaml_install_directory }}/simplesamlphp-1.18.4'; - $wgSimpleSAMLphp_AuthSourceId = '{{ simplesaml_okta_metadata_name }}'; - $wgSimpleSAMLphp_RealNameAttribute = ['firstName', 'lastName']; - $wgSimpleSAMLphp_EmailAttribute = 'email'; - $wgSimpleSAMLphp_UsernameAttribute = 'username'; - $wgSimpleSAMLphp_SyncAllGroups_GroupNameModificationCallback = function($origGroupName){ - # Remove spaces - return preg_replace('/\s/', '', $origGroupName); - }; - $wgSimpleSAMLphp_AttributeProcessorFactories = [ - "MediaWiki\\Extension\\SimpleSAMLphp\\AttributeProcessor\\SyncAllGroups::factory" - ]; - -- name: Install ActivityLog Configuration - copy: - src: ActivityLogConfiguration - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable ActivityLog - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" - block: | - wfLoadExtension('ActivityLog'); - $wgMessagesDirs['ActivityLogConfiguration'] = 'ActivityLogConfiguration/i18n'; - $wgActivityLogHooksToWatch["ArticleViewHeader"] = function ($article) { - $referrer = $_SERVER['HTTP_REFERER']; - $ourServer = "http://torque.leverforchange.org"; - - if($referrer && $ourServer == substr($referrer, 0, strlen($ourServer))) { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader-with-referrer", - $_SERVER['HTTP_REFERER'] - ); - } else { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader" - ); - } - }; - - $wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { - global $wgTitle; - return array($user, $wgTitle, "activitylog-userlogin"); - }; - - $wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { - return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); - }; - - -- name: Enable PickSome - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PICKSOME CONFIG" - block: | - # While this next line should be taken care of in extenions, and indeed - # it is, because this extension is loaded via wfLoadExtension, and because - # Collection is loaded the old way, the sidebar before output is called - # preferring Collection, placing it higher on the siderbar than PickSome. - # - # This was requested to be changed, and the most straightforward way is - # to add it to the hook directly in LocalSettings - $wgHooks['SidebarBeforeOutput'][] = 'PickSomeHooks::onSidebarBeforeOutput'; - wfLoadExtension('PickSome'); - $wgPickSomeNumberOfPicks = 5; - # This may not be performant and require caching if number of users/page hits - # becomes large. - $wgPickSomePage = function($title) { - $eligibleWildCardsTitle = Title::newFromText("TorqueConfig:FinalistCandidates"); - if($eligibleWildCardsTitle->exists()) { - $page = new WikiPage($eligibleWildCardsTitle); - $valid_pages = []; - preg_match_all("/\\[\\[([^\\]]*)\\]\\]/", $page->getContent()->getText(), $valid_pages); - foreach($valid_pages[1] as $valid_page) { - if($title->equals(Title::newFromText($valid_page))) { - return true; - } - } - return false; - } else { - return false; - } - }; - - $wgPickSomeSortFunction = function($t1, $t2) { - $text1 = $t1->getText(); - $text2 = $t2->getText(); - - $text1 = preg_replace("/^\\W/", "", $text1); - $text2 = preg_replace("/^\\W/", "", $text2); - return $text1 > $text2; - }; - - $picksomeOverrideMessage = [ - "picksome-all" => "Everyone's Finalist Candidates", - "picksome-title" => "Finalist Candidates", - "picksome-choices" => "Finalist Candidate Choices", - "picksome-my-picks" => "My Finalist Candidates", - "picksome-unpick" => "Deselect", - "picksome-pick" => "Select this page", - "picksome-no-picks" => "No Finalist Candidates", - "picksome-current" => "Current Page", - "picksome-view-all" => "View Everyone's Finalist Candidates", - "picksome-global-list" => "Global Finalist Candidate List", - "picksome-remove-below" => "To select the current page, remove one below", - "picksome-stop" => "Stop Selecting", - "picksome-close-window" => "Close Window", - "picksome-start" => "Start Selecting", - ]; - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $picksomeOverrideMessage; - if(array_key_exists(strtolower($title), $picksomeOverrideMessage)) { - $message = $picksomeOverrideMessage[strtolower($title)]; - } - }; - -# This actually needs to be installed after PickSome (above), because -# we want the picksome sidebar to be loaded before the Collection sidebar -# because of how mediawiki decides order of portlet. -- name: Enable Collection - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE COLLECTION CONFIG" - block: | - require_once "$IP/extensions/Collection/Collection.php"; - $wgCollectionMWServeURL = "http://127.0.0.1:8899"; - $wgCollectionMaxArticles = 250; - $wgEnableApi = true; - $wgCollectionFormats = array( 'rl' => 'PDF',); - $wgCollectionPortletFormats = []; - $wgCollectionDisableDownloadSection = false; - $wgHooks['ApiBeforeMain'][] = function($main) { - global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; - if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { - $wgTorqueDataConnectRenderToHTML = false; - $tdcinfo = $main->getRequest()->getText("tdcinfo", false); - list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); - } - }; - $wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { - global $wgCollectionMWServeCredentials; - $group = TorqueDataConnectConfig::getValidGroup($user); - $view = TorqueDataConnectConfig::getCurrentView(); - $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; - }; - -- name: Enable SimpleFavorites - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('SimpleFavorites');" - -- name: Enable TorqueDataConnect - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" - block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectSheetName = "proposals"; - $wgTorqueDataConnectWikiKey = "lfc"; - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - wfLoadExtension('TorqueDataConnect'); - -- name: Enable TeamComments - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TEAMCOMMENTS CONFIG" - block: | - wfLoadExtension('TeamComments'); - $wgTeamCommentsCheatSheetLocation = "Wiki_Markup_Cheat_Sheet"; - $wgTeamCommentsUserPseudonymizer = function($username) { - return "Pseudonymous User #" . TorqueDataConnectUserLookup::lookupByUsername($username)->{"id"}; - }; - -- name: Enable Uploading - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} UPLOAD CONFIG" - block: | - $wgEnableUploads = true; - $wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'docx', 'html', 'pdf', 'xlsx')); - $wgFileBlacklist = array(); - $wgMimeTypeBlacklist = array(); - $wgStrictFileExtensions = false; - $wgTrustedMediaFormats = array('application/zip', 'text/html'); - $wgVerifyMimeType = false; - $wgAllowJavaUploads = true; - $wgCheckFileExtensions = false; - $wgGroupPermissions['bot']['edit'] = true; - $wgGroupPermissions['bot']['upload'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - $wgGroupPermissions['autoconfirmed']['reupload'] = true; - -- name: Set TOC depth - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMaxTocLevel = 2; - -- name: Disable Collection Warning 1 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Disable Collection Warning 2 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Remove Collection Book Text - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" - regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' - replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' - -- name: Disable MediaWiki Cache - # When the cache is enabled, on AWS, with the default setting, - # the following createAndPromote.php command fails due to cache timeout. - # The reason isn't clear, but for now, this will fix it. - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMainCacheType = CACHE_NONE; - -- name: Create mwlib user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" - -- name: Create csv2wiki user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" - -- name: Set Group Permissions - blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # For now, this must be set so that accounts coming in from okta - # work correctly! writeapi and creataccount must also be true - # for all users ('*'). - $wgGroupPermissions['*']['autocreateaccount'] = true; - - # For when we resolve how the new accounts are created (see above) - # these permissions will still need to exist, even though they - # are redundant for now. - $wgGroupPermissions['LFCTorque']['writeapi'] = true; - $wgGroupPermissions['LFCTorqueAdmin']['writeapi'] = true; - $wgGroupPermissions['LFCConsultants']['writeapi'] = true; - $wgGroupPermissions['BoardMembers']['writeapi'] = true; - $wgGroupPermissions['PseudoBoardMembers']['writeapi'] = true; - - # Disable teamcomments for users on this wiki by default. - $wgGroupPermissions['*']['teamcomment'] = false; - $wgGroupPermissions['*']['teamcommentseeusernames'] = false; - - # Then enable teamcomments for the groups that should be leaving comments - $wgGroupPermissions['LFCTorque']['teamcomment'] = true; - $wgGroupPermissions['LFCTorqueAdmin']['teamcomment'] = true; - $wgGroupPermissions['LFCConsultants']['teamcomment'] = true; - $wgGroupPermissions['BoardMembers']['teamcomment'] = true; - $wgGroupPermissions['PseudoBoardMembers']['teamcomment'] = true; - $wgGroupPermissions['LFCResearchPartners']['teamcomment'] = true; - $wgGroupPermissions['LFCEvaluators']['teamcomment'] = true; - - # Allow some groups to see usernames - $wgGroupPermissions['LFCTorque']['teamcommentseeusernames'] = true; - $wgGroupPermissions['LFCTorqueAdmin']['teamcommentseeusernames'] = true; - $wgGroupPermissions['LFCConsultants']['teamcommentseeusernames'] = true; - $wgGroupPermissions['BoardMembers']['teamcommentseeusernames'] = true; - $wgGroupPermissions['PseudoBoardMembers']['teamcommentseeusernames'] = true; - - $wgGroupPermissions['torqueapi']['read'] = true; - $wgGroupPermissions['ForumOne']['read'] = true; - $wgGroupPermissions['LFCConsultants']['read'] = true; - $wgGroupPermissions['BoardMembers']['read'] = true; - $wgGroupPermissions['PseudoBoardMembers']['read'] = true; - $wgGroupPermissions['LFCResearchPartners']['read'] = true; - $wgGroupPermissions['LFCEvaluators']['read'] = true; - $wgGroupPermissions['BoardMembers']['picksome'] = true; - $wgGroupPermissions['BoardMembers']['picksome-write'] = true; - $wgGroupPermissions['PseudoBoardMembers']['picksome'] = true; - - # Log permissions (ability to see Special:Log) - $wgAvailableRights[] = 'view-special-log'; - $wgGroupPermissions['*']['view-special-log'] = false; - $wgGroupPermissions['sysop']['view-special-log'] = true; - - foreach($wgGroupPermissions['sysop'] as $key => $value) { - $wgGroupPermissions['LFCTorque'][$key] = $value; - } - - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - - # Permissions that we want sysops/admins to have that - # but not for staff go here - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['picksome'] = true; - $wgGroupPermissions['sysop']['picksome-admin'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - foreach($wgGroupPermissions['sysop'] as $key => $value) { - $wgGroupPermissions['LFCTorqueAdmin'][$key] = $value; - } - foreach($wgGroupPermissions['bureaucrat'] as $key => $value) { - $wgGroupPermissions['LFCTorqueAdmin'][$key] = $value; - } - -- name: Disable Special:Log for groups that don't have view-special-log - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SpecialPage_initList'][] = function ( &$list ) { - global $wgUser; - - if(!$wgUser->isAllowed('view-special-log')) { - unset( $list['Log'] ); - } - return true; - }; - -- name: Create Special:Log name overrides - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTitlesOverrideMessages = [ - "picksomelogpage" => "Selection", - "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", - "simplefavoriteslog" => "Favorites", - "log-name-create" => "Page Creation", - "movelogpage" => "Page Rename", - "uploadlogpage" => "File Upload", - "dellogpage" => "Page Deletion", - "newuserlogpage" => "User Creation", - "log-name-teamcomments" => "Comments", - "torquedataconnect-apiaccesslog" => "API Accesses", - "torquedataconnect-datachangeslog" => "Data Changes", - "rightslog" => "Changes to Access Control / Permissions" - ]; - - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $logTitlesOverrideMessages; - if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { - $message = $logTitlesOverrideMessages[strtolower($title)]; - } - }; - -- name: Disable Special:Log types that aren't of interest - blockinfile: - marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; - - $wgHooks['SetupAfterCache'][] = function () { - global $wgLogTypes, $logTypesBlacklist; - foreach($logTypesBlacklist as $logType) { - unset($wgLogTypes[array_search($logType, $wgLogTypes)]); - } - - return true; - }; - -- name: Change Special:Log format slightly - blockinfile: - marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # This is a little brittle, based on how the lines are rendered by the skin currently used - # but should work for the foreseeable future. - $wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ - $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); - }; - - -- name: Transfer LFC Logo - copy: - src: LeverForChange_Logo.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LeverForChange_Logo.png" - -- name: Install LFC Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/LeverForChange_Logo.png"; - -- name: Transfer board group css - copy: - src: Group-board.css - dest: "{{ mediawiki_install_directory }}/Group-board.css" - -- name: Install board group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Group-{{ item }}.css < {{ mediawiki_install_directory }}/Group-board.css" - loop: - - BoardMembersTorque - - BoardMembers - - LFCEvaluators - - LFCResearchPartners - -- name: Remove board group css - file: - path: "{{ mediawiki_install_directory }}/Group-board.css" - state: absent - -- name: Transfer Common css - copy: - src: Common.css - dest: "{{ mediawiki_install_directory }}/Common.css" - -- name: Install Common css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" - -- name: Remove Common css - file: - path: "{{ mediawiki_install_directory }}/Common.css" - state: absent - -- name: Transfer htaccess - copy: - src: .htaccess - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" - -- name: Transfer wiki cheat sheet - copy: - src: Wiki_Markup_Cheat_Sheet - dest: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Install wiki cheat sheet - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b Wiki_Markup_Cheat_Sheet < {{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Transfer wiki cheat sheet - file: - path: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - state: absent - -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" - -# Handle Apache changes -- name: Symlink to webserver directory - become_user: root - file: - state: link - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/lfc" - -- name: Set permissions on attachments directory - become_user: root - file: - path: "{{ html_directory }}/lfc/images/" - owner: www-data - group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted - diff --git a/100Change2020/ansible/roles/simplesaml/tasks/main.yml b/100Change2020/ansible/roles/simplesaml/tasks/main.yml deleted file mode 100644 index 6c0c7fd3..00000000 --- a/100Change2020/ansible/roles/simplesaml/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Add okta account to autoconfig - lineinfile: - path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" - insertafter: '\$metadata_url_for = array\(' - line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," diff --git a/100Change2020Demo/ansible/roles/mediawiki/tasks/main.yml b/100Change2020Demo/ansible/roles/mediawiki/tasks/main.yml index fd3882f4..d3a9e0d7 100644 --- a/100Change2020Demo/ansible/roles/mediawiki/tasks/main.yml +++ b/100Change2020Demo/ansible/roles/mediawiki/tasks/main.yml @@ -37,7 +37,7 @@ path: "{{ mediawiki_install_directory }}/bin" state: directory -- name: Checkout Torque +- name: Check out Torque git: repo: https://github.com/OpenTechStrategies/torque dest: "{{ mediawiki_install_directory }}/torque/" diff --git a/Climate2030/ansible/Climate2030.yml b/Climate2030/ansible/Climate2030.yml index eb72a98e..0bc8b868 100644 --- a/Climate2030/ansible/Climate2030.yml +++ b/Climate2030/ansible/Climate2030.yml @@ -4,7 +4,20 @@ become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - collection + - embed_video + - permissions + # PickSome has to come after collection so the left menu bar is correct + - picksome + - simplefavorites + - simplesaml + - teamcomments + - torquedataconnect + - Climate2030 + # This should always go last, to run db updates and restart + - finishmediawiki - hosts: simplesaml become: true diff --git a/Climate2030/ansible/inv/local/group_vars/all.tmpl b/Climate2030/ansible/inv/local/group_vars/all.tmpl index bf955beb..521f0ee0 100644 --- a/Climate2030/ansible/inv/local/group_vars/all.tmpl +++ b/Climate2030/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: Climate2030 + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: Climate2030 + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/Climate2030/ansible/inv/prod/group_vars/all/base b/Climate2030/ansible/inv/prod/group_vars/all/base index 2d4000b5..52f4df46 100644 --- a/Climate2030/ansible/inv/prod/group_vars/all/base +++ b/Climate2030/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,7 @@ --- +competition_name: Climate2030 +torquedataconnect_sheet_name: Climate2030 + html_directory: /var/www/html mediawiki_install_directory: /home/deploy/Climate2030/ mediawiki_mwlib_username: mwlib diff --git a/Climate2030/ansible/roles/mediawiki/files/Climate2030_Logo.png b/Climate2030/ansible/roles/Climate2030/files/Climate2030_Logo.png similarity index 100% rename from Climate2030/ansible/roles/mediawiki/files/Climate2030_Logo.png rename to Climate2030/ansible/roles/Climate2030/files/Climate2030_Logo.png diff --git a/Climate2030/ansible/roles/Climate2030/tasks/main.yml b/Climate2030/ansible/roles/Climate2030/tasks/main.yml new file mode 100644 index 00000000..09f1aaa5 --- /dev/null +++ b/Climate2030/ansible/roles/Climate2030/tasks/main.yml @@ -0,0 +1,13 @@ +--- + +- name: Transfer Climate2030 Logo + copy: + src: Climate2030_Logo.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/Climate2030_Logo.png" + +- name: Install Climate2030 Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/Climate2030_Logo.png"; + diff --git a/Climate2030/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json b/Climate2030/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json deleted file mode 100644 index 93685958..00000000 --- a/Climate2030/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "activitylog-articleviewheader": "$1 visited $3", - "activitylog-articlesavepage": "$1 edited $3", - "activitylog-articleviewheader-with-referrer": "$1 visited $3 (from $5)", - "activitylog-userlogin": "$1 logged in" -} diff --git a/Climate2030/ansible/roles/mediawiki/files/Common.css b/Climate2030/ansible/roles/mediawiki/files/Common.css deleted file mode 100644 index a8c46177..00000000 --- a/Climate2030/ansible/roles/mediawiki/files/Common.css +++ /dev/null @@ -1,26 +0,0 @@ -/* This disables some of the Special:Log inputs */ -.rootpage-Special_Log .mw-usertoollinks { - display:none; -} -.rootpage-Special_Log .comment { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLTagFilter { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLMultiSelectField { - display:none; -} -#mw-input-pluggableauthlogin { - background-color:#9056a9; -} -.mw-htmlform-login-or {margin-top:50px; - display:flex; -} -.mw-htmlform-login-or:before, .mw-htmlform-login-or:after { - color:white; - content:''; - flex:1; - border-bottom:2px solid black; - margin:auto 0.25em; -} diff --git a/Climate2030/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch b/Climate2030/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch deleted file mode 100644 index a24dfef3..00000000 --- a/Climate2030/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch +++ /dev/null @@ -1,380 +0,0 @@ -+++ ./classes/VideoService.php 2020-01-02 17:10:22.640951109 +0000 -@@ -18,7 +18,7 @@ - */ - static private $services = [ - 'archiveorg' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -30,7 +30,7 @@ - ] - ], - 'bambuser' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -42,7 +42,7 @@ - ] - ], - 'bambuser_channel' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -54,7 +54,7 @@ - ] - ], - 'beam' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -66,7 +66,7 @@ - ] - ], - 'disclose' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -75,7 +75,7 @@ - '#disclose.tv/action/viewvideo/([\d]+)/([\w-]+)/#is' - ], - 'id_regex' => [ -- '#^([\d]+)$#is' -+ '#^([\d]+)$#is' - ] - ], - 'blip' => [ -@@ -88,7 +88,7 @@ - 'oembed' => 'http://blip.tv/oembed/?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'bing' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -100,7 +100,7 @@ - ] - ], - 'collegehumor' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6260162601626, // (600 / 369) - 'https_enabled' => true, -@@ -112,7 +112,7 @@ - ] - ], - 'dailymotion' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -124,13 +124,13 @@ - ] - ], - 'divshare' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true - ], - 'funnyordie' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64102564102564, // (640 / 390) - 'https_enabled' => false, -@@ -142,7 +142,7 @@ - ] - ], - 'gfycat' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'https_enabled' => true, - 'url_regex' => [ -@@ -153,7 +153,7 @@ - ] - ], - 'jwplayer' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -165,7 +165,7 @@ - ] - ], - 'kickstarter' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -177,7 +177,7 @@ - ] - ], - 'mediacccde' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 660, - 'default_ratio' => 1.77777777777778, //(16 / 9), - 'https_enabled' => true, -@@ -189,7 +189,7 @@ - ] - ], - 'metacafe' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => false, -@@ -201,7 +201,7 @@ - ] - ], - 'nico' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.59609120521173, // (490 / 307) - 'https_enabled' => false, -@@ -213,7 +213,7 @@ - ] - ], - 'rutube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -225,7 +225,7 @@ - ] - ], - 'smashcast' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -237,7 +237,7 @@ - ] - ], - 'soundcloud' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 186, - 'default_ratio' => 2.66666, - 'https_enabled' => true, -@@ -246,7 +246,7 @@ - ] - ], - 'teachertube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.72972972972973, // (640 / 370) - 'https_enabled' => false, -@@ -258,7 +258,7 @@ - ] - ], - 'ted' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -270,7 +270,7 @@ - ] - ], - 'tubitv' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -282,7 +282,7 @@ - ] - ], - 'tudou' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -295,7 +295,7 @@ - ] - ], - 'tvpot' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -307,7 +307,7 @@ - ] - ], - 'twitch' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -319,7 +319,7 @@ - ] - ], - 'twitchclip' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -331,7 +331,7 @@ - ] - ], - 'twitchvod' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -343,12 +343,12 @@ - ] - ], - 'videomaten' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_ratio' => 1.5, // (300 / 200) - 'https_enabled' => false - ], - 'vimeo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -362,7 +362,7 @@ - 'oembed' => '%4$s//vimeo.com/api/oembed.json?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'vine' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1, // (1 / 1) - 'https_enabled' => true, -@@ -374,7 +374,7 @@ - ] - ], - 'yahoo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -386,7 +386,7 @@ - ] - ], - 'youtube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -403,7 +403,7 @@ - ] - ], - 'youtubeplaylist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -415,7 +415,7 @@ - ] - ], - 'youtubevideolist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -427,7 +427,7 @@ - ] - ], - 'youku' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -527,6 +527,13 @@ - private $urlArgs = false; - - /** -+ * Title for iframe. -+ * -+ * @var string -+ */ -+ private $iframeTitle = ""; -+ -+ /** - * Main Constructor - * - * @access private -@@ -554,6 +561,7 @@ - - /** - * return the service host map array -+ * - * @return array $serviceHostMap - */ - public static function getServiceHostMap() { -@@ -602,6 +610,7 @@ - htmlentities($this->getVideoID(), ENT_QUOTES), - $this->getWidth(), - $this->getHeight(), -+ $this->getIframeTitle(), - ]; - - if ($this->getExtraIds() !== false) { -@@ -723,6 +732,20 @@ - } - - /** -+ * Return the iframeTitle. -+ * -+ * @access public -+ * @return String, defaulting to message 'ev_default_play_desc' -+ */ -+ public function getIframeTitle() { -+ if($this->iframeTitle == "") { -+ return wfMessage('ev_default_play_desc')->text(); -+ } -+ -+ return $this->iframeTitle; -+ } -+ -+ /** - * Set the width of the player. This also will set the height automatically. - * Width will be automatically constrained to the minimum and maximum widths. - * -+++ ./i18n/en.json 2020-01-02 17:47:39.993265357 +0000 -@@ -18,5 +18,6 @@ - "ev_video_long_desc": "$1, $2 codec, length $3, $4x$5 pixels, $6 overall", - "ev_audio_short_desc": "$1", - "ev_audio_long_desc": "$1, $2 codec, length $3, $4 overall", -- "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1" -+ "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1", -+ "ev_default_play_desc": "Play video" - } diff --git a/Climate2030/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet b/Climate2030/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet deleted file mode 100644 index 3316ca20..00000000 --- a/Climate2030/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet +++ /dev/null @@ -1,196 +0,0 @@ -__NOTOC__ - -'''''Note:''''' This is an abridged version of the famous -[https://en.wikipedia.org/wiki/Help:Cheatsheet Wikipedia Syntax Cheat Sheet] --- try there if you don't see the markup codes you're looking for below. - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan=3 style="background:#E6F2FF; border-top:2px #a3b1bf solid;text-align:center;" | -'''Works anywhere in the text'''         -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|Italics, bold, and both -| -''italics'', '''bold''', and '''''both''''' -| -''italics'', '''bold''', and '''''both''''' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to another page -| -[[some page]]
-| -[[some page]]
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -"[[Wikipedia:Piped link|Pipe]]" a link to change the link's text -| -[[Android (operating system)|Android]] -| -[[Android (operating system)|Android]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -Link to a section -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Plain off-site URL -| -https://www.wikipedia.org -| -https://www.wikipedia.org -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to an off-site URL -| -[https://www.wikipedia.org] -| -[https://www.wikipedia.org] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link and link-text to an off-site URL -| -[https://www.wikipedia.org/ Wikipedia] -| -[https://www.wikipedia.org/ Wikipedia] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Signature -
''E.g., to sign your contributions when posting to a [[Wikipedia:Tutorial (Talk pages)|talk page]]''
-| -~~~~ -| -[[Special:Mypage|Username]] ([[Special:Mytalk|talk]]) {{CURRENTTIME}}, {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC) -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Strike some text -| -This text is conspicuously stricken. -| -This text is conspicuously stricken. -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Underline -| -This text is underlined -| -This text is underlined -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Picture tutorial|Show an image]] -| -[[File:Wiki.png|thumb|Caption]] -| -[[File:Wiki.png|thumb|Caption]] -
''If the image hasn't been uploaded, you'll just see its path as red text.''
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Add a page to a Category. -|[[Category:Cetaceans I Have Known]]

''best placed near the bottom of a page'' -|''shows'' "Cetaceans I Have Known" ''in a bar at bottom when the page is previewed or published'' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to a [[Wikipedia:FAQ/Categories|category]] or [[Help:Files|file]] -|
[[:Category:Cetaceans I Have Known]]
[[:File:File name]] -|
[[:Category:Wikipedia basic information]]
[[:File:Example.jpg]] -|} - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan="3" style="background:#E6F2FF; border-top:2px #a3b1bf solid; text-align:center;" | '''Works only at the beginnings of lines'''     -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|[[Wikipedia:Redirect|Redirect to another page]] -
''redirects must be placed at the start of the first line''
-| -#REDIRECT [[Target page]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Redirect|Redirect to a section of another page]] -| -#REDIRECT [[Target page#anchorName]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page#anchorName]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Section headings
-
''a Table of Contents will automatically be generated when four headings are added to an article''
-| -==Level 2==
-===Level 3===
-====Level 4====
-=====Level 5=====
-======Level 6======

-''do not use''  =Level 1=  ''as it is for page titles'' -| - -==Level 2== -===Level 3=== -====Level 4==== -=====Level 5===== -======Level 6====== -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Bullet-point list (unnumbered list) -| -* One
-* Two
-** Two point one
-* Three -| -* One -* Two -** Two point one -* Three -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Numbered list (enumerated list) -| -# One
-# Two
-## Two point one
-# Three -| -# One -# Two -## Two point one -# Three -|} diff --git a/Climate2030/ansible/roles/mediawiki/tasks/main.yml b/Climate2030/ansible/roles/mediawiki/tasks/main.yml deleted file mode 100644 index 2acc81bb..00000000 --- a/Climate2030/ansible/roles/mediawiki/tasks/main.yml +++ /dev/null @@ -1,648 +0,0 @@ ---- - -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Install MW with Composer - command: composer install --no-dev - args: - chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Patch EmbedVideo - patch: - src: EmbedVideoIframeTitle.patch - basedir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/EmbedVideo-v2.8.0/" - -- name: Install PluggableAuth - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install SimpleSAML extension - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install Collection - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout PickSome - git: - repo: https://github.com/OpenTechStrategies/PickSome - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/PickSome/" - version: 59df890 - -- name: Checkout ActivityLog - git: - repo: https://github.com/OpenTechStrategies/ActivityLog - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" - version: 27e9191 - -- name: Checkout SimpleFavorites - git: - repo: https://github.com/OpenTechStrategies/SimpleFavorites - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/SimpleFavorites/" - version: 59fed33 - -- name: Checkout TeamComments - git: - repo: https://github.com/OpenTechStrategies/TeamComments - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TeamComments/" - version: 450bff7 - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - -- name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=mysql --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=Climate2030 --scriptpath=\"/Climate2030\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"Climate2030\" \"admin\"" - args: - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" - -- name: Enable PluggableAuth - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" - block: | - wfLoadExtension( 'PluggableAuth' ); - $wgPluggableAuth_EnableAutoLogin = true; - $wgPluggableAuth_EnableLocalLogin = true; - $wgPluggableAuth_EnableLocalProperties = false; - $wgPluggableAuth_ButtonLabel = "Log In Using MacArthur SSO"; - $wgInvalidUsernameCharacters = ""; - -- name: Enable SimpleSAMLphp extension - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" - block: | - wfLoadExtension( 'SimpleSAMLphp' ); - $wgSimpleSAMLphp_SyncAllGroups_LocallyManaged = ["sysop", "DecisionMakers"]; - $wgSimpleSAMLphp_InstallDir = '{{ simplesaml_install_directory }}/simplesamlphp-1.18.4'; - $wgSimpleSAMLphp_AuthSourceId = '{{ simplesaml_okta_metadata_name }}'; - $wgSimpleSAMLphp_RealNameAttribute = ['firstName', 'lastName']; - $wgSimpleSAMLphp_EmailAttribute = 'email'; - $wgSimpleSAMLphp_UsernameAttribute = 'username'; - $wgSimpleSAMLphp_GroupMap = [ - 'sysop' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], - 'DecisionMakers' => ['groups' => ['LFC Decision Makers']] - ]; - - $wgSimpleSAMLphp_SyncAllGroups_GroupNameModificationCallback = function($origGroupName){ - # Remove spaces - return preg_replace('/\s/', '', $origGroupName); - }; - $wgSimpleSAMLphp_AttributeProcessorFactories = [ - "MediaWiki\\Extension\\SimpleSAMLphp\\AttributeProcessor\\SyncAllGroups::factory" - ]; - -- name: Enable Collection - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE COLLECTION CONFIG" - block: | - require_once "$IP/extensions/Collection/Collection.php"; - $wgCollectionMWServeURL = "http://127.0.0.1:8899"; - $wgCollectionMaxArticles = 250; - $wgEnableApi = true; - $wgCollectionFormats = array( 'rl' => 'PDF',); - $wgCollectionPortletFormats = []; - $wgCollectionDisableDownloadSection = false; - $wgHooks['ApiBeforeMain'][] = function($main) { - global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; - if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { - $wgTorqueDataConnectRenderToHTML = false; - $tdcinfo = $main->getRequest()->getText("tdcinfo", false); - list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); - } - }; - $wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { - global $wgCollectionMWServeCredentials; - $group = TorqueDataConnectConfig::getValidGroup($user); - $view = TorqueDataConnectConfig::getCurrentView(); - $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; - }; - -- name: Enable TorqueDataConnect - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" - block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectSheetName = "Climate2030"; - $wgTorqueDataConnectWikiKey = "Climate2030"; - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - wfLoadExtension('TorqueDataConnect'); - -- name: Enable SimpleFavorites - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('SimpleFavorites');" - -- name: Enable TeamComments - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TEAMCOMMENTS CONFIG" - block: | - wfLoadExtension('TeamComments'); - $wgTeamCommentsCheatSheetLocation = "Wiki_Markup_Cheat_Sheet"; - $wgTeamCommentsUserPseudonymizer = function($username) { - return "Pseudonymous User #" . TorqueDataConnectUserLookup::lookupByUsername($username)->{"id"}; - }; - -- name: Enable Uploading - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} UPLOAD CONFIG" - block: | - $wgEnableUploads = true; - $wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'docx', 'html', 'pdf', 'xlsx')); - $wgFileBlacklist = array(); - $wgMimeTypeBlacklist = array(); - $wgStrictFileExtensions = false; - $wgTrustedMediaFormats = array('application/zip', 'text/html'); - $wgVerifyMimeType = false; - $wgAllowJavaUploads = true; - $wgCheckFileExtensions = false; - $wgGroupPermissions['bot']['edit'] = true; - $wgGroupPermissions['bot']['upload'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - $wgGroupPermissions['autoconfirmed']['reupload'] = true; - -- name: Set TOC depth - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMaxTocLevel = 2; - -- name: Disable Collection Warning 1 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Disable Collection Warning 2 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Remove Collection Book Text - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" - regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' - replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' - -- name: Install ActivityLog Configuration - copy: - src: ActivityLogConfiguration - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable ActivityLog - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" - block: | - wfLoadExtension('ActivityLog'); - $wgMessagesDirs['ActivityLogConfiguration'] = 'ActivityLogConfiguration/i18n'; - $wgActivityLogHooksToWatch["ArticleViewHeader"] = function ($article) { - $referrer = $_SERVER['HTTP_REFERER']; - $ourServer = "http://torque.leverforchange.org"; - - if($referrer && $ourServer == substr($referrer, 0, strlen($ourServer))) { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader-with-referrer", - $_SERVER['HTTP_REFERER'] - ); - } else { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader" - ); - } - }; - - $wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { - global $wgTitle; - return array($user, $wgTitle, "activitylog-userlogin"); - }; - - $wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { - return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); - }; - -- name: Enable PickSome - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PICKSOME CONFIG" - block: | - # While this next line should be taken care of in extenions, and indeed - # it is, because this extension is loaded via wfLoadExtension, and because - # Collection is loaded the old way, the sidebar before output is called - # preferring Collection, placing it higher on the siderbar than PickSome. - # - # This was requested to be changed, and the most straightforward way is - # to add it to the hook directly in LocalSettings - $wgHooks['SidebarBeforeOutput'][] = 'PickSomeHooks::onSidebarBeforeOutput'; - wfLoadExtension('PickSome'); - $wgPickSomeNumberOfPicks = 15; - # This may not be performant and require caching if number of users/page hits - # becomes large. - $wgPickSomePage = function($title) { - $eligibleWildCardsTitle = Title::newFromText("TorqueConfig:ValidProposals"); - if($eligibleWildCardsTitle->exists()) { - $page = new WikiPage($eligibleWildCardsTitle); - $valid_pages = []; - preg_match_all("/\\[\\[([^\\]]*)\\]\\]/", $page->getContent()->getText(), $valid_pages); - foreach($valid_pages[1] as $valid_page) { - if($title->equals(Title::newFromText($valid_page))) { - return true; - } - } - return false; - } else { - return false; - } - }; - - $wgPickSomeSortFunction = function($t1, $t2) { - $text1 = $t1->getText(); - $text2 = $t2->getText(); - - $text1 = preg_replace("/^\\W/", "", $text1); - $text2 = preg_replace("/^\\W/", "", $text2); - return $text1 > $text2; - }; - - $picksomeOverrideMessage = [ - "picksome-all" => "Everyone's Finalist Candidates", - "picksome-title" => "Finalist Candidates", - "picksome-choices" => "Finalist Candidate Choices", - "picksome-my-picks" => "My Finalist Candidates", - "picksome-unpick" => "Deselect", - "picksome-pick" => "Select this page", - "picksome-no-picks" => "No Finalist Candidates", - "picksome-current" => "Current Page", - "picksome-view-all" => "View Everyone's Finalist Candidates", - "picksome-global-list" => "Global Finalist Candidate List", - "picksome-remove-below" => "To select the current page, remove one below", - "picksome-stop" => "Stop Selecting", - "picksome-close-window" => "Close Window", - "picksome-start" => "Start Selecting", - ]; - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $picksomeOverrideMessage; - if(array_key_exists(strtolower($title), $picksomeOverrideMessage)) { - $message = $picksomeOverrideMessage[strtolower($title)]; - } - }; - -- name: Disable MediaWiki Cache - # When the cache is enabled, on AWS, with the default setting, - # the following createAndPromote.php command fails due to cache timeout. - # The reason isn't clear, but for now, this will fix it. - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMainCacheType = CACHE_NONE; - -- name: Create mwlib user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" - -- name: Create csv2wiki user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" - -- name: Set Group Permissions - blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgGroupPermissions['*']['read'] = false; - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - - # Permissions that we want sysops/admins to have that - # but not for staff go here - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - - # Groups requested specifically by LFC. - $wgGroupPermissions['LFCConsultingPartners']['read'] = true; - $wgGroupPermissions['LFCConsultingPartners']['torquedataconnect-edit'] = true; - $wgGroupPermissions['LFCResearchPartners']['read'] = true; - $wgGroupPermissions['LFCEvaluators']['read'] = true; - - # These are OTS Torque Standard Groups - $wgGroupPermissions['OutsideReviewers']['read'] = true; - $wgGroupPermissions['Staff']['read'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['read'] = true; - $wgGroupPermissions['DecisionMakers']['read'] = true; - - # Disable teamcomments for users on this wiki by default. - $wgGroupPermissions['*']['teamcomment'] = false; - $wgGroupPermissions['*']['teamcommentseeusernames'] = false; - - # Then enable teamcomments for the groups that should be leaving comments - $wgGroupPermissions['Staff']['teamcomment'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['teamcomment'] = true; - $wgGroupPermissions['DecisionMakers']['teamcomment'] = true; - $wgGroupPermissions['sysop']['teamcomment'] = true; - $wgGroupPermissions['LFCResearchPartners']['teamcomment'] = true; - $wgGroupPermissions['LFCEvaluators']['teamcomment'] = true; - - # Allow some groups to see usernames - $wgGroupPermissions['Staff']['teamcommentseeusernames'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['teamcommentseeusernames'] = true; - $wgGroupPermissions['DecisionMakers']['teamcommentseeusernames'] = true; - $wgGroupPermissions['sysop']['teamcommentseeusernames'] = true; - - # PickSome permissions - $wgGroupPermissions['DecisionMakers']['picksome'] = true; - $wgGroupPermissions['DecisionMakers']['picksome-write'] = true; - $wgGroupPermissions['sysop']['picksome'] = true; - $wgGroupPermissions['sysop']['picksome-admin'] = true; - - # Log permissions (ability to see Special:Log) - $wgAvailableRights[] = 'view-special-log'; - $wgGroupPermissions['*']['view-special-log'] = false; - $wgGroupPermissions['sysop']['view-special-log'] = true; - - -- name: Create LFC Evaluator page rule - blockinfile: - marker: "## {mark} ANSIBLE LFC EVALUATOR CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SkinTemplateNavigation'][] = function ( $template, &$links ) { - $currentTitle = $template->getTitle()->getFullText(); - $lfc_prepend = "LFC Analysis of "; - $eval_prepend = "Evaluations of "; - - $isAnalysisPage = (strlen($currentTitle) > strlen($lfc_prepend) && substr($currentTitle, 0, strlen($lfc_prepend)) === $lfc_prepend); - $isEvalPage = (strlen($currentTitle) > strlen($eval_prepend) && substr($currentTitle, 0, strlen($eval_prepend)) === $eval_prepend); - - $originalPageTitle = $currentTitle; - if($isAnalysisPage) { - $originalPageTitle = substr($currentTitle, strlen($lfc_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } else if($isEvalPage) { - $originalPageTitle = substr($currentTitle, strlen($eval_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } - $lfcAnalysisTitle = Title::newFromText($lfc_prepend . $originalPageTitle); - $evalTitle = Title::newFromText($eval_prepend . $originalPageTitle); - if($isAnalysisPage || $lfcAnalysisTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['lfcanalysis'] = [ - 'class' => ($isAnalysisPage ? 'selected' : ''), - 'href' => ($isAnalysisPage ? $template->getTitle()->getLocalUrl() : $lfcAnalysisTitle->getLocalUrl()), - 'text' => 'LFC Analysis', - ]; - } - if($isEvalPage || $evalTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['evaluations'] = [ - 'class' => ($isEvalPage ? 'selected' : ''), - 'href' => ($isEvalPage ? $template->getTitle()->getLocalUrl() : $evalTitle->getLocalUrl()), - 'text' => 'Evaluations', - ]; - } - - unset($links['namespaces']['talk']); - }; - - -- name: Disable Special:Log for groups that don't have view-special-log - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SpecialPage_initList'][] = function ( &$list ) { - global $wgUser; - - if(!$wgUser->isAllowed('view-special-log')) { - unset( $list['Log'] ); - } - return true; - }; - -- name: Create Special:Log name overrides - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTitlesOverrideMessages = [ - "picksomelogpage" => "Selection", - "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", - "simplefavoriteslog" => "Favorites", - "log-name-create" => "Page Creation", - "movelogpage" => "Page Rename", - "uploadlogpage" => "File Upload", - "dellogpage" => "Page Deletion", - "newuserlogpage" => "User Creation", - "log-name-teamcomments" => "Comments", - "torquedataconnect-apiaccesslog" => "API Accesses", - "torquedataconnect-datachangeslog" => "Data Changes", - "rightslog" => "Changes to Access Control / Permissions" - ]; - - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $logTitlesOverrideMessages; - if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { - $message = $logTitlesOverrideMessages[strtolower($title)]; - } - }; - -- name: Disable Special:Log types that aren't of interest - blockinfile: - marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; - - $wgHooks['SetupAfterCache'][] = function () { - global $wgLogTypes, $logTypesBlacklist; - foreach($logTypesBlacklist as $logType) { - unset($wgLogTypes[array_search($logType, $wgLogTypes)]); - } - - return true; - }; - -- name: Change Special:Log format slightly - blockinfile: - marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # This is a little brittle, based on how the lines are rendered by the skin currently used - # but should work for the foreseeable future. - $wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ - $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); - }; - -- name: Rearrange Login Page - blockinfile: - marker: "## {mark} ANSIBLE CHANGE LOGIN ORDERING" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['AuthChangeFormFields'][] = function ($requests, $fieldInfo, &$formDescriptor, $action) { - if($action != \MediaWiki\Auth\AuthManager::ACTION_LOGIN) { - return; - } - - $formDescriptor['username']['weight'] = 200; - $formDescriptor['password']['weight'] = 201; - $formDescriptor['rememberMe']['weight'] = 202; - $formDescriptor['loginattempt']['weight'] = 203; - $formDescriptor['break'] = [ - 'type' => 'info', - 'weight' => 150, - 'cssclass' => 'mw-htmlform-login-or', - 'default' => "or" - ]; - - unset($formDescriptor['linkcontainer']); - unset($formDescriptor['passwordReset']); - unset($formDescriptor['createOrLogin']); - - if ( isset( $formDescriptor['pluggableauthlogin'] ) ) { - $formDescriptor['pluggableauthlogin']['weight'] = -1; - } - }; - -- name: Enable Common.css on Login Page - blockinfile: - marker: "## {mark} ANSIBLE ENABLE CSS ON LOGIN" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgAllowSiteCSSOnRestrictedPages = true; - -- name: Transfer Climate2030 Logo - copy: - src: Climate2030_Logo.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/Climate2030_Logo.png" - -- name: Install Climate2030 Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/Climate2030_Logo.png"; - -- name: Transfer Common group css - copy: - src: Common.css - dest: "{{ mediawiki_install_directory }}/Common.css" - -- name: Install Common group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" - -- name: Remove Common group css - file: - path: "{{ mediawiki_install_directory }}/Common.css" - state: absent - -- name: Transfer DecisionMakers group css - copy: - src: Group-DecisionMakers.css - dest: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" - -- name: Install DecisionMakers group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Group-{{ item }}.css < {{ mediawiki_install_directory }}/Group-DecisionMakers.css" - loop: - - PseudoDecisionMakers - - DecisionMakers - - LFCEvaluators - - LFCResearchPartners - - LFCConsultingPartners - -- name: Remove DecisionMakers group css - file: - path: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" - state: absent - -- name: Transfer htaccess - copy: - src: .htaccess - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" - -- name: Transfer wiki cheat sheet - copy: - src: Wiki_Markup_Cheat_Sheet - dest: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Install wiki cheat sheet - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b Wiki_Markup_Cheat_Sheet < {{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Transfer wiki cheat sheet - file: - path: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - state: absent - -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" - -# Handle Apache changes -- name: Symlink to webserver directory - become_user: root - file: - state: link - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/Climate2030" - -- name: Set permissions on attachments directory - become_user: root - file: - path: "{{ html_directory }}/Climate2030/images" - owner: www-data - group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted diff --git a/Climate2030/ansible/roles/simplesaml/tasks/main.yml b/Climate2030/ansible/roles/simplesaml/tasks/main.yml deleted file mode 100644 index 6c0c7fd3..00000000 --- a/Climate2030/ansible/roles/simplesaml/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Add okta account to autoconfig - lineinfile: - path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" - insertafter: '\$metadata_url_for = array\(' - line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," diff --git a/DemoView/ansible/DemoView.yml b/DemoView/ansible/DemoView.yml index eb72a98e..6907c953 100644 --- a/DemoView/ansible/DemoView.yml +++ b/DemoView/ansible/DemoView.yml @@ -4,10 +4,23 @@ become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - collection + - embed_video + - permissions + # PickSome has to come after collection so the left menu bar is correct + - picksome + - simplefavorites + - simplesaml + - teamcomments + - torquedataconnect + - DemoView + # This should always go last, to run db updates and restart + - finishmediawiki - hosts: simplesaml become: true become_user: "{{ deployment_user }}" roles: - - simplesaml + - simplesaml diff --git a/DemoView/ansible/inv/local/group_vars/all.tmpl b/DemoView/ansible/inv/local/group_vars/all.tmpl index b93694a3..0497ee42 100644 --- a/DemoView/ansible/inv/local/group_vars/all.tmpl +++ b/DemoView/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: DemoView + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: DemoView + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/DemoView/ansible/inv/prod/group_vars/all/base b/DemoView/ansible/inv/prod/group_vars/all/base index 4e95f5b2..6e8bb5f2 100644 --- a/DemoView/ansible/inv/prod/group_vars/all/base +++ b/DemoView/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: DemoView +torquedataconnect_sheet_name: DemoView html_directory: /var/www/html mediawiki_install_directory: /home/deploy/DemoView/ mediawiki_mwlib_username: mwlib diff --git a/100Change2020/ansible/roles/mediawiki/files/.htaccess b/DemoView/ansible/roles/DemoView/files/.htaccess similarity index 100% rename from 100Change2020/ansible/roles/mediawiki/files/.htaccess rename to DemoView/ansible/roles/DemoView/files/.htaccess diff --git a/DemoView/ansible/roles/mediawiki/files/LeverForChange_Logo.png b/DemoView/ansible/roles/DemoView/files/LeverForChange_Logo.png similarity index 100% rename from DemoView/ansible/roles/mediawiki/files/LeverForChange_Logo.png rename to DemoView/ansible/roles/DemoView/files/LeverForChange_Logo.png diff --git a/DemoView/ansible/roles/DemoView/tasks/main.yml b/DemoView/ansible/roles/DemoView/tasks/main.yml new file mode 100644 index 00000000..6d3d4dac --- /dev/null +++ b/DemoView/ansible/roles/DemoView/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: Transfer LFC Logo + copy: + src: LeverForChange_Logo.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LeverForChange_Logo.png" + +- name: Install LFC Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/LeverForChange_Logo.png"; diff --git a/DemoView/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json b/DemoView/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json deleted file mode 100644 index 93685958..00000000 --- a/DemoView/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "activitylog-articleviewheader": "$1 visited $3", - "activitylog-articlesavepage": "$1 edited $3", - "activitylog-articleviewheader-with-referrer": "$1 visited $3 (from $5)", - "activitylog-userlogin": "$1 logged in" -} diff --git a/DemoView/ansible/roles/mediawiki/files/Common.css b/DemoView/ansible/roles/mediawiki/files/Common.css deleted file mode 100644 index dcdcb6d8..00000000 --- a/DemoView/ansible/roles/mediawiki/files/Common.css +++ /dev/null @@ -1,16 +0,0 @@ -/* This disables some of the Special:Log inputs */ -.rootpage-Special_Log .mw-usertoollinks { - display:none; -} -.rootpage-Special_Log .comment { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLTagFilter { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLMultiSelectField { - display:none; -} -.torque-wrapper .mw-editsection { - display:none!important; -} diff --git a/DemoView/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch b/DemoView/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch deleted file mode 100644 index a24dfef3..00000000 --- a/DemoView/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch +++ /dev/null @@ -1,380 +0,0 @@ -+++ ./classes/VideoService.php 2020-01-02 17:10:22.640951109 +0000 -@@ -18,7 +18,7 @@ - */ - static private $services = [ - 'archiveorg' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -30,7 +30,7 @@ - ] - ], - 'bambuser' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -42,7 +42,7 @@ - ] - ], - 'bambuser_channel' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -54,7 +54,7 @@ - ] - ], - 'beam' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -66,7 +66,7 @@ - ] - ], - 'disclose' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -75,7 +75,7 @@ - '#disclose.tv/action/viewvideo/([\d]+)/([\w-]+)/#is' - ], - 'id_regex' => [ -- '#^([\d]+)$#is' -+ '#^([\d]+)$#is' - ] - ], - 'blip' => [ -@@ -88,7 +88,7 @@ - 'oembed' => 'http://blip.tv/oembed/?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'bing' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -100,7 +100,7 @@ - ] - ], - 'collegehumor' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6260162601626, // (600 / 369) - 'https_enabled' => true, -@@ -112,7 +112,7 @@ - ] - ], - 'dailymotion' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -124,13 +124,13 @@ - ] - ], - 'divshare' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true - ], - 'funnyordie' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64102564102564, // (640 / 390) - 'https_enabled' => false, -@@ -142,7 +142,7 @@ - ] - ], - 'gfycat' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'https_enabled' => true, - 'url_regex' => [ -@@ -153,7 +153,7 @@ - ] - ], - 'jwplayer' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -165,7 +165,7 @@ - ] - ], - 'kickstarter' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -177,7 +177,7 @@ - ] - ], - 'mediacccde' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 660, - 'default_ratio' => 1.77777777777778, //(16 / 9), - 'https_enabled' => true, -@@ -189,7 +189,7 @@ - ] - ], - 'metacafe' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => false, -@@ -201,7 +201,7 @@ - ] - ], - 'nico' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.59609120521173, // (490 / 307) - 'https_enabled' => false, -@@ -213,7 +213,7 @@ - ] - ], - 'rutube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -225,7 +225,7 @@ - ] - ], - 'smashcast' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -237,7 +237,7 @@ - ] - ], - 'soundcloud' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 186, - 'default_ratio' => 2.66666, - 'https_enabled' => true, -@@ -246,7 +246,7 @@ - ] - ], - 'teachertube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.72972972972973, // (640 / 370) - 'https_enabled' => false, -@@ -258,7 +258,7 @@ - ] - ], - 'ted' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -270,7 +270,7 @@ - ] - ], - 'tubitv' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -282,7 +282,7 @@ - ] - ], - 'tudou' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -295,7 +295,7 @@ - ] - ], - 'tvpot' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -307,7 +307,7 @@ - ] - ], - 'twitch' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -319,7 +319,7 @@ - ] - ], - 'twitchclip' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -331,7 +331,7 @@ - ] - ], - 'twitchvod' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -343,12 +343,12 @@ - ] - ], - 'videomaten' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_ratio' => 1.5, // (300 / 200) - 'https_enabled' => false - ], - 'vimeo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -362,7 +362,7 @@ - 'oembed' => '%4$s//vimeo.com/api/oembed.json?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'vine' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1, // (1 / 1) - 'https_enabled' => true, -@@ -374,7 +374,7 @@ - ] - ], - 'yahoo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -386,7 +386,7 @@ - ] - ], - 'youtube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -403,7 +403,7 @@ - ] - ], - 'youtubeplaylist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -415,7 +415,7 @@ - ] - ], - 'youtubevideolist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -427,7 +427,7 @@ - ] - ], - 'youku' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -527,6 +527,13 @@ - private $urlArgs = false; - - /** -+ * Title for iframe. -+ * -+ * @var string -+ */ -+ private $iframeTitle = ""; -+ -+ /** - * Main Constructor - * - * @access private -@@ -554,6 +561,7 @@ - - /** - * return the service host map array -+ * - * @return array $serviceHostMap - */ - public static function getServiceHostMap() { -@@ -602,6 +610,7 @@ - htmlentities($this->getVideoID(), ENT_QUOTES), - $this->getWidth(), - $this->getHeight(), -+ $this->getIframeTitle(), - ]; - - if ($this->getExtraIds() !== false) { -@@ -723,6 +732,20 @@ - } - - /** -+ * Return the iframeTitle. -+ * -+ * @access public -+ * @return String, defaulting to message 'ev_default_play_desc' -+ */ -+ public function getIframeTitle() { -+ if($this->iframeTitle == "") { -+ return wfMessage('ev_default_play_desc')->text(); -+ } -+ -+ return $this->iframeTitle; -+ } -+ -+ /** - * Set the width of the player. This also will set the height automatically. - * Width will be automatically constrained to the minimum and maximum widths. - * -+++ ./i18n/en.json 2020-01-02 17:47:39.993265357 +0000 -@@ -18,5 +18,6 @@ - "ev_video_long_desc": "$1, $2 codec, length $3, $4x$5 pixels, $6 overall", - "ev_audio_short_desc": "$1", - "ev_audio_long_desc": "$1, $2 codec, length $3, $4 overall", -- "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1" -+ "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1", -+ "ev_default_play_desc": "Play video" - } diff --git a/DemoView/ansible/roles/mediawiki/files/Group-DecisionMaker.css b/DemoView/ansible/roles/mediawiki/files/Group-DecisionMaker.css deleted file mode 100644 index 375e9d41..00000000 --- a/DemoView/ansible/roles/mediawiki/files/Group-DecisionMaker.css +++ /dev/null @@ -1,7 +0,0 @@ -#p-views ul li:not(.simplefavorite-icon):not(#ca-view):not(#ca-edit) { display:none!important; } -#p-cactions { display:none!important; } -#pt-mytalk { display:none!important; } -#pt-watchlist { display:none!important; } -#pt-mycontris { display:none!important; } -.mw-editsection { display:none!important; } -#p-tb { display:none!important; } diff --git a/DemoView/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet b/DemoView/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet deleted file mode 100644 index 3316ca20..00000000 --- a/DemoView/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet +++ /dev/null @@ -1,196 +0,0 @@ -__NOTOC__ - -'''''Note:''''' This is an abridged version of the famous -[https://en.wikipedia.org/wiki/Help:Cheatsheet Wikipedia Syntax Cheat Sheet] --- try there if you don't see the markup codes you're looking for below. - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan=3 style="background:#E6F2FF; border-top:2px #a3b1bf solid;text-align:center;" | -'''Works anywhere in the text'''         -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|Italics, bold, and both -| -''italics'', '''bold''', and '''''both''''' -| -''italics'', '''bold''', and '''''both''''' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to another page -| -[[some page]]
-| -[[some page]]
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -"[[Wikipedia:Piped link|Pipe]]" a link to change the link's text -| -[[Android (operating system)|Android]] -| -[[Android (operating system)|Android]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -Link to a section -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Plain off-site URL -| -https://www.wikipedia.org -| -https://www.wikipedia.org -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to an off-site URL -| -[https://www.wikipedia.org] -| -[https://www.wikipedia.org] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link and link-text to an off-site URL -| -[https://www.wikipedia.org/ Wikipedia] -| -[https://www.wikipedia.org/ Wikipedia] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Signature -
''E.g., to sign your contributions when posting to a [[Wikipedia:Tutorial (Talk pages)|talk page]]''
-| -~~~~ -| -[[Special:Mypage|Username]] ([[Special:Mytalk|talk]]) {{CURRENTTIME}}, {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC) -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Strike some text -| -This text is conspicuously stricken. -| -This text is conspicuously stricken. -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Underline -| -This text is underlined -| -This text is underlined -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Picture tutorial|Show an image]] -| -[[File:Wiki.png|thumb|Caption]] -| -[[File:Wiki.png|thumb|Caption]] -
''If the image hasn't been uploaded, you'll just see its path as red text.''
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Add a page to a Category. -|[[Category:Cetaceans I Have Known]]

''best placed near the bottom of a page'' -|''shows'' "Cetaceans I Have Known" ''in a bar at bottom when the page is previewed or published'' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to a [[Wikipedia:FAQ/Categories|category]] or [[Help:Files|file]] -|
[[:Category:Cetaceans I Have Known]]
[[:File:File name]] -|
[[:Category:Wikipedia basic information]]
[[:File:Example.jpg]] -|} - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan="3" style="background:#E6F2FF; border-top:2px #a3b1bf solid; text-align:center;" | '''Works only at the beginnings of lines'''     -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|[[Wikipedia:Redirect|Redirect to another page]] -
''redirects must be placed at the start of the first line''
-| -#REDIRECT [[Target page]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Redirect|Redirect to a section of another page]] -| -#REDIRECT [[Target page#anchorName]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page#anchorName]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Section headings
-
''a Table of Contents will automatically be generated when four headings are added to an article''
-| -==Level 2==
-===Level 3===
-====Level 4====
-=====Level 5=====
-======Level 6======

-''do not use''  =Level 1=  ''as it is for page titles'' -| - -==Level 2== -===Level 3=== -====Level 4==== -=====Level 5===== -======Level 6====== -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Bullet-point list (unnumbered list) -| -* One
-* Two
-** Two point one
-* Three -| -* One -* Two -** Two point one -* Three -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Numbered list (enumerated list) -| -# One
-# Two
-## Two point one
-# Three -| -# One -# Two -## Two point one -# Three -|} diff --git a/DemoView/ansible/roles/mediawiki/tasks/main.yml b/DemoView/ansible/roles/mediawiki/tasks/main.yml deleted file mode 100644 index 39a8be8d..00000000 --- a/DemoView/ansible/roles/mediawiki/tasks/main.yml +++ /dev/null @@ -1,600 +0,0 @@ ---- - -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Install MW with Composer - command: composer install --no-dev - args: - chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Patch EmbedVideo - patch: - src: EmbedVideoIframeTitle.patch - basedir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/EmbedVideo-v2.8.0/" - -- name: Install PluggableAuth - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install SimpleSAML extension - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install Collection - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout PickSome - git: - repo: https://github.com/OpenTechStrategies/PickSome - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/PickSome/" - version: 59df890 - -- name: Checkout ActivityLog - git: - repo: https://github.com/OpenTechStrategies/ActivityLog - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" - version: 27e9191 - -- name: Checkout SimpleFavorites - git: - repo: https://github.com/OpenTechStrategies/SimpleFavorites - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/SimpleFavorites/" - version: 59fed33 - -- name: Checkout TeamComments - git: - repo: https://github.com/OpenTechStrategies/TeamComments - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TeamComments/" - version: 450bff7 - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - -- name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=mysql --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=DemoView --scriptpath=\"/DemoView\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"DemoView\" \"admin\"" - args: - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" - -- name: Enable PluggableAuth - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" - block: | - wfLoadExtension( 'PluggableAuth' ); - $wgPluggableAuth_EnableAutoLogin = true; - $wgPluggableAuth_EnableLocalLogin = true; - $wgPluggableAuth_EnableLocalProperties = false; - $wgPluggableAuth_ButtonLabel = "Log In With MacArthur Okta"; - $wgInvalidUsernameCharacters = ""; - -- name: Enable SimpleSAMLphp extension - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" - block: | - wfLoadExtension( 'SimpleSAMLphp' ); - $wgSimpleSAMLphp_InstallDir = '{{ simplesaml_install_directory }}/simplesamlphp-1.18.4'; - $wgSimpleSAMLphp_AuthSourceId = '{{ simplesaml_okta_metadata_name }}'; - $wgSimpleSAMLphp_RealNameAttribute = ['firstName', 'lastName']; - $wgSimpleSAMLphp_EmailAttribute = 'email'; - $wgSimpleSAMLphp_UsernameAttribute = 'email'; - $wgSimpleSAMLphp_GroupMap = ['sysop' => ['groups' => ['LFC Torque Admin', 'LFC Staff']]]; - $wgSimpleSAMLphp_SyncAllGroups_GroupNameModificationCallback = function($origGroupName){ - # Remove spaces - return preg_replace('/\s/', '', $origGroupName); - }; - $wgSimpleSAMLphp_AttributeProcessorFactories = [ - "MediaWiki\\Extension\\SimpleSAMLphp\\AttributeProcessor\\SyncAllGroups::factory" - ]; - -- name: Enable PickSome - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PICKSOME CONFIG" - block: | - # While this next line should be taken care of in extenions, and indeed - # it is, because this extension is loaded via wfLoadExtension, and because - # Collection is loaded the old way, the sidebar before output is called - # preferring Collection, placing it higher on the siderbar than PickSome. - # - # This was requested to be changed, and the most straightforward way is - # to add it to the hook directly in LocalSettings - $wgHooks['SidebarBeforeOutput'][] = 'PickSomeHooks::onSidebarBeforeOutput'; - wfLoadExtension('PickSome'); - $wgPickSomeNumberOfPicks = 5; - # This may not be performant and require caching if number of users/page hits - # becomes large. - $wgPickSomePage = function($title) { - $eligibleWildCardsTitle = Title::newFromText("TorqueConfig:ValidProposals"); - if($eligibleWildCardsTitle->exists()) { - $page = new WikiPage($eligibleWildCardsTitle); - $valid_pages = []; - preg_match_all("/\\[\\[([^\\]]*)\\]\\]/", $page->getContent()->getText(), $valid_pages); - foreach($valid_pages[1] as $valid_page) { - if($title->equals(Title::newFromText($valid_page))) { - return true; - } - } - return false; - } else { - return false; - } - }; - - $wgPickSomeSortFunction = function($t1, $t2) { - $text1 = $t1->getText(); - $text2 = $t2->getText(); - - $text1 = preg_replace("/^\\W/", "", $text1); - $text2 = preg_replace("/^\\W/", "", $text2); - return $text1 > $text2; - }; - - $picksomeOverrideMessage = [ - "picksome-all" => "Everyone's Finalist Candidates", - "picksome-title" => "Finalist Candidates", - "picksome-choices" => "Finalist Candidate Choices", - "picksome-my-picks" => "My Finalist Candidates", - "picksome-unpick" => "Deselect", - "picksome-pick" => "Select this page", - "picksome-no-picks" => "No Finalist Candidates", - "picksome-current" => "Current Page", - "picksome-view-all" => "View Everyone's Finalist Candidates", - "picksome-global-list" => "Global Finalist Candidate List", - "picksome-remove-below" => "To select the current page, remove one below", - "picksome-stop" => "Stop Selecting", - "picksome-close-window" => "Close Window", - "picksome-start" => "Start Selecting", - ]; - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $picksomeOverrideMessage; - if(array_key_exists(strtolower($title), $picksomeOverrideMessage)) { - $message = $picksomeOverrideMessage[strtolower($title)]; - } - }; - -# This actually needs to be installed after PickSome (above), because -# we want the picksome sidebar to be loaded before the Collection sidebar -# because of how mediawiki decides order of portlet. -- name: Enable Collection - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE COLLECTION CONFIG" - block: | - require_once "$IP/extensions/Collection/Collection.php"; - $wgCollectionMWServeURL = "http://127.0.0.1:8899"; - $wgCollectionMaxArticles = 250; - $wgEnableApi = true; - $wgCollectionFormats = array( 'rl' => 'PDF',); - $wgCollectionPortletFormats = []; - $wgCollectionDisableDownloadSection = false; - $wgHooks['ApiBeforeMain'][] = function($main) { - global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; - if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { - $wgTorqueDataConnectRenderToHTML = false; - $tdcinfo = $main->getRequest()->getText("tdcinfo", false); - list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); - } - }; - $wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { - global $wgCollectionMWServeCredentials; - $group = TorqueDataConnectConfig::getValidGroup($user); - $view = TorqueDataConnectConfig::getCurrentView(); - $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; - }; - -- name: Enable TorqueDataConnect - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" - block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectSheetName = "DemoView"; - $wgTorqueDataConnectServerLocation = "http://localhost:{{ torquedata_server_port }}"; - $wgTorqueDataConnectWikiKey = "DemoView"; - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - wfLoadExtension('TorqueDataConnect'); - -- name: Enable SimpleFavorites - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('SimpleFavorites');" - -- name: Enable TeamComments - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TEAMCOMMENTS CONFIG" - block: | - wfLoadExtension('TeamComments'); - $wgTeamCommentsCheatSheetLocation = "Wiki_Markup_Cheat_Sheet"; - $wgTeamCommentsUserPseudonymizer = function($username) { - return "Pseudonymous User #" . TorqueDataConnectUserLookup::lookupByUsername($username)->{"id"}; - }; - - -- name: Enable Uploading - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} UPLOAD CONFIG" - block: | - $wgEnableUploads = true; - $wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'docx', 'html', 'pdf', 'xlsx')); - $wgFileBlacklist = array(); - $wgMimeTypeBlacklist = array(); - $wgStrictFileExtensions = false; - $wgTrustedMediaFormats = array('application/zip', 'text/html'); - $wgVerifyMimeType = false; - $wgAllowJavaUploads = true; - $wgCheckFileExtensions = false; - $wgGroupPermissions['bot']['edit'] = true; - $wgGroupPermissions['bot']['upload'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - $wgGroupPermissions['autoconfirmed']['reupload'] = true; - -- name: Set TOC depth - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMaxTocLevel = 2; - -- name: Disable Collection Warning 1 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Disable Collection Warning 2 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Remove Collection Book Text - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" - regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' - replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' - -- name: Install ActivityLog Configuration - copy: - src: ActivityLogConfiguration - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable ActivityLog - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" - block: | - wfLoadExtension('ActivityLog'); - $wgMessagesDirs['ActivityLogConfiguration'] = 'ActivityLogConfiguration/i18n'; - $wgActivityLogHooksToWatch["ArticleViewHeader"] = function ($article) { - $referrer = $_SERVER['HTTP_REFERER']; - $ourServer = "http://torque.leverforchange.org"; - - if($referrer && $ourServer == substr($referrer, 0, strlen($ourServer))) { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader-with-referrer", - $_SERVER['HTTP_REFERER'] - ); - } else { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader" - ); - } - }; - - $wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { - global $wgTitle; - return array($user, $wgTitle, "activitylog-userlogin"); - }; - - $wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { - return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); - }; - -- name: Disable MediaWiki Cache - # When the cache is enabled, on AWS, with the default setting, - # the following createAndPromote.php command fails due to cache timeout. - # The reason isn't clear, but for now, this will fix it. - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMainCacheType = CACHE_NONE; - -- name: Create mwlib user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" - -- name: Create csv2wiki user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" - -- name: Set Group Permissions - blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgGroupPermissions['*']['read'] = false; - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - - # Permissions that we want sysops/admins to have that - # but not for staff go here - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-edit'] = true; - - # Groups requested specifically by LFC. - $wgGroupPermissions['LFCResearchPartners']['read'] = true; - $wgGroupPermissions['LFCEvaluators']['read'] = true; - - # These are OTS Torque Standard Groups - $wgGroupPermissions['OutsideReviewer']['read'] = true; - $wgGroupPermissions['Staff']['read'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['read'] = true; - $wgGroupPermissions['DecisionMaker']['read'] = true; - - # Disable teamcomments for users on this wiki by default. - $wgGroupPermissions['*']['teamcomment'] = false; - $wgGroupPermissions['*']['teamcommentseeusernames'] = false; - - # Then enable teamcomments for the groups that should be leaving comments - $wgGroupPermissions['Staff']['teamcomment'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['DecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['sysop']['teamcomment'] = true; - - # Log permissions (ability to see Special:Log) - $wgAvailableRights[] = 'view-special-log'; - $wgGroupPermissions['*']['view-special-log'] = false; - $wgGroupPermissions['sysop']['view-special-log'] = true; - - # PickSome permissions - $wgGroupPermissions['sysop']['picksome-write'] = true; - $wgGroupPermissions['sysop']['picksome'] = true; - $wgGroupPermissions['sysop']['picksome-admin'] = true; - $wgGroupPermissions['BoardMembers']['picksome-write'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['picksome'] = true; - -- name: Disable Special:Log for groups that don't have view-special-log - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SpecialPage_initList'][] = function ( &$list ) { - global $wgUser; - - if(!$wgUser->isAllowed('view-special-log')) { - unset( $list['Log'] ); - } - return true; - }; - -- name: Create LFC Evaluator page rule - blockinfile: - marker: "## {mark} ANSIBLE LFC EVALUATOR CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SkinTemplateNavigation'][] = function ( $template, &$links ) { - $currentTitle = $template->getTitle()->getFullText(); - $lfc_prepend = "LFC Analysis of "; - $eval_prepend = "Evaluations of "; - - $isAnalysisPage = (strlen($currentTitle) > strlen($lfc_prepend) && substr($currentTitle, 0, strlen($lfc_prepend)) === $lfc_prepend); - $isEvalPage = (strlen($currentTitle) > strlen($eval_prepend) && substr($currentTitle, 0, strlen($eval_prepend)) === $eval_prepend); - - $originalPageTitle = $currentTitle; - if($isAnalysisPage) { - $originalPageTitle = substr($currentTitle, strlen($lfc_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } else if($isEvalPage) { - $originalPageTitle = substr($currentTitle, strlen($eval_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } - $lfcAnalysisTitle = Title::newFromText($lfc_prepend . $originalPageTitle); - $evalTitle = Title::newFromText($eval_prepend . $originalPageTitle); - if($isAnalysisPage || $lfcAnalysisTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['lfcanalysis'] = [ - 'class' => ($isAnalysisPage ? 'selected' : ''), - 'href' => ($isAnalysisPage ? $template->getTitle()->getLocalUrl() : $lfcAnalysisTitle->getLocalUrl()), - 'text' => 'LFC Analysis', - ]; - } - if($isEvalPage || $evalTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['evaluations'] = [ - 'class' => ($isEvalPage ? 'selected' : ''), - 'href' => ($isEvalPage ? $template->getTitle()->getLocalUrl() : $evalTitle->getLocalUrl()), - 'text' => 'Evaluations', - ]; - } - - unset($links['namespaces']['talk']); - }; - -- name: Create Special:Log name overrides - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTitlesOverrideMessages = [ - "picksomelogpage" => "Selection", - "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", - "simplefavoriteslog" => "Favorites", - "log-name-create" => "Page Creation", - "movelogpage" => "Page Rename", - "uploadlogpage" => "File Upload", - "dellogpage" => "Page Deletion", - "newuserlogpage" => "User Creation", - "log-name-teamcomments" => "Comments", - "torquedataconnect-apiaccesslog" => "API Accesses", - "torquedataconnect-datachangeslog" => "Data Changes", - "rightslog" => "Changes to Access Control / Permissions" - ]; - - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $logTitlesOverrideMessages; - if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { - $message = $logTitlesOverrideMessages[strtolower($title)]; - } - }; - -- name: Disable Special:Log types that aren't of interest - blockinfile: - marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; - - $wgHooks['SetupAfterCache'][] = function () { - global $wgLogTypes, $logTypesBlacklist; - foreach($logTypesBlacklist as $logType) { - unset($wgLogTypes[array_search($logType, $wgLogTypes)]); - } - - return true; - }; - -- name: Change Special:Log format slightly - blockinfile: - marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # This is a little brittle, based on how the lines are rendered by the skin currently used - # but should work for the foreseeable future. - $wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ - $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); - }; - -- name: Transfer LFC Logo - copy: - src: LeverForChange_Logo.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LeverForChange_Logo.png" - -- name: Install LFC Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/LeverForChange_Logo.png"; - -- name: Transfer Common group css - copy: - src: Common.css - dest: "{{ mediawiki_install_directory }}/Common.css" - -- name: Install Common group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" - -- name: Remove Common group css - file: - path: "{{ mediawiki_install_directory }}/Common.css" - state: absent - -- name: Transfer DecisionMaker group css - copy: - src: Group-DecisionMaker.css - dest: "{{ mediawiki_install_directory }}/Group-DecisionMaker.css" - -- name: Install DecisionMaker group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Group-{{ item }}.css < {{ mediawiki_install_directory }}/Group-DecisionMaker.css" - loop: - - PseudoDecisionMaker - - DecisionMaker - - LFCEvaluators - - LFCResearchPartners - -- name: Remove DecisionMaker group css - file: - path: "{{ mediawiki_install_directory }}/Group-DecisionMaker.css" - state: absent - -- name: Transfer htaccess - copy: - src: .htaccess - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" - -- name: Transfer wiki cheat sheet - copy: - src: Wiki_Markup_Cheat_Sheet - dest: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Install wiki cheat sheet - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b Wiki_Markup_Cheat_Sheet < {{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Transfer wiki cheat sheet - file: - path: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - state: absent - -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" - -# Handle Apache changes -- name: Symlink to webserver directory - become_user: root - file: - state: link - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/DemoView" - -- name: Set permissions on attachments directory - become_user: root - file: - path: "{{ html_directory }}/DemoView/images/" - owner: www-data - group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted diff --git a/DemoView/ansible/roles/simplesaml/tasks/main.yml b/DemoView/ansible/roles/simplesaml/tasks/main.yml deleted file mode 100644 index 6c0c7fd3..00000000 --- a/DemoView/ansible/roles/simplesaml/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Add okta account to autoconfig - lineinfile: - path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" - insertafter: '\$metadata_url_for = array\(' - line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," diff --git a/EO2020/ansible/EO2020.yml b/EO2020/ansible/EO2020.yml index eb72a98e..486ed808 100644 --- a/EO2020/ansible/EO2020.yml +++ b/EO2020/ansible/EO2020.yml @@ -4,7 +4,18 @@ become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - collection + - embed_video + - permissions + - simplefavorites + - simplesaml + - teamcomments + - torquedataconnect + - EO2020 + # This should always go last, to run db updates and restart + - finishmediawiki - hosts: simplesaml become: true diff --git a/EO2020/ansible/inv/local/group_vars/all.tmpl b/EO2020/ansible/inv/local/group_vars/all.tmpl index bf955beb..f0f6fbf9 100644 --- a/EO2020/ansible/inv/local/group_vars/all.tmpl +++ b/EO2020/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: EO2020 + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: EO2020 + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/EO2020/ansible/inv/prod/group_vars/all/base b/EO2020/ansible/inv/prod/group_vars/all/base index 28d25e2c..5159b37e 100644 --- a/EO2020/ansible/inv/prod/group_vars/all/base +++ b/EO2020/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,7 @@ --- +competition_name: EO2020 +torquedataconnect_sheet_name: EO2020 + html_directory: /var/www/html mediawiki_install_directory: /home/deploy/EO2020/ mediawiki_mwlib_username: mwlib diff --git a/Climate2030/ansible/roles/mediawiki/files/.htaccess b/EO2020/ansible/roles/EO2020/files/.htaccess similarity index 100% rename from Climate2030/ansible/roles/mediawiki/files/.htaccess rename to EO2020/ansible/roles/EO2020/files/.htaccess diff --git a/EO2020/ansible/roles/mediawiki/files/LeverForChange_Logo.png b/EO2020/ansible/roles/EO2020/files/LeverForChange_Logo.png similarity index 100% rename from EO2020/ansible/roles/mediawiki/files/LeverForChange_Logo.png rename to EO2020/ansible/roles/EO2020/files/LeverForChange_Logo.png diff --git a/EO2020/ansible/roles/EO2020/tasks/main.yml b/EO2020/ansible/roles/EO2020/tasks/main.yml new file mode 100644 index 00000000..2d7fe52e --- /dev/null +++ b/EO2020/ansible/roles/EO2020/tasks/main.yml @@ -0,0 +1,17 @@ +--- + +- name: Transfer EO Logo + copy: + src: "{{ lookup('env','OTS_DIR') }}/clients/lever-for-change/torque-sites/EO2020/data/EOLogo.png" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/EOLogo.png" + +- name: Transfer LFC Logo + copy: + src: LeverForChange_Logo.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LeverForChange_Logo.png" + +- name: Install LFC Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/LeverForChange_Logo.png"; diff --git a/EO2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json b/EO2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json deleted file mode 100644 index 93685958..00000000 --- a/EO2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "activitylog-articleviewheader": "$1 visited $3", - "activitylog-articlesavepage": "$1 edited $3", - "activitylog-articleviewheader-with-referrer": "$1 visited $3 (from $5)", - "activitylog-userlogin": "$1 logged in" -} diff --git a/EO2020/ansible/roles/mediawiki/files/Common.css b/EO2020/ansible/roles/mediawiki/files/Common.css deleted file mode 100644 index e502a300..00000000 --- a/EO2020/ansible/roles/mediawiki/files/Common.css +++ /dev/null @@ -1,13 +0,0 @@ -/* This disables some of the Special:Log inputs */ -.rootpage-Special_Log .mw-usertoollinks { - display:none; -} -.rootpage-Special_Log .comment { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLTagFilter { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLMultiSelectField { - display:none; -} diff --git a/EO2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch b/EO2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch deleted file mode 100644 index a24dfef3..00000000 --- a/EO2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch +++ /dev/null @@ -1,380 +0,0 @@ -+++ ./classes/VideoService.php 2020-01-02 17:10:22.640951109 +0000 -@@ -18,7 +18,7 @@ - */ - static private $services = [ - 'archiveorg' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -30,7 +30,7 @@ - ] - ], - 'bambuser' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -42,7 +42,7 @@ - ] - ], - 'bambuser_channel' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -54,7 +54,7 @@ - ] - ], - 'beam' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -66,7 +66,7 @@ - ] - ], - 'disclose' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -75,7 +75,7 @@ - '#disclose.tv/action/viewvideo/([\d]+)/([\w-]+)/#is' - ], - 'id_regex' => [ -- '#^([\d]+)$#is' -+ '#^([\d]+)$#is' - ] - ], - 'blip' => [ -@@ -88,7 +88,7 @@ - 'oembed' => 'http://blip.tv/oembed/?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'bing' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -100,7 +100,7 @@ - ] - ], - 'collegehumor' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6260162601626, // (600 / 369) - 'https_enabled' => true, -@@ -112,7 +112,7 @@ - ] - ], - 'dailymotion' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -124,13 +124,13 @@ - ] - ], - 'divshare' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true - ], - 'funnyordie' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64102564102564, // (640 / 390) - 'https_enabled' => false, -@@ -142,7 +142,7 @@ - ] - ], - 'gfycat' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'https_enabled' => true, - 'url_regex' => [ -@@ -153,7 +153,7 @@ - ] - ], - 'jwplayer' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -165,7 +165,7 @@ - ] - ], - 'kickstarter' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -177,7 +177,7 @@ - ] - ], - 'mediacccde' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 660, - 'default_ratio' => 1.77777777777778, //(16 / 9), - 'https_enabled' => true, -@@ -189,7 +189,7 @@ - ] - ], - 'metacafe' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => false, -@@ -201,7 +201,7 @@ - ] - ], - 'nico' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.59609120521173, // (490 / 307) - 'https_enabled' => false, -@@ -213,7 +213,7 @@ - ] - ], - 'rutube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -225,7 +225,7 @@ - ] - ], - 'smashcast' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -237,7 +237,7 @@ - ] - ], - 'soundcloud' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 186, - 'default_ratio' => 2.66666, - 'https_enabled' => true, -@@ -246,7 +246,7 @@ - ] - ], - 'teachertube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.72972972972973, // (640 / 370) - 'https_enabled' => false, -@@ -258,7 +258,7 @@ - ] - ], - 'ted' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -270,7 +270,7 @@ - ] - ], - 'tubitv' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -282,7 +282,7 @@ - ] - ], - 'tudou' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -295,7 +295,7 @@ - ] - ], - 'tvpot' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -307,7 +307,7 @@ - ] - ], - 'twitch' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -319,7 +319,7 @@ - ] - ], - 'twitchclip' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -331,7 +331,7 @@ - ] - ], - 'twitchvod' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -343,12 +343,12 @@ - ] - ], - 'videomaten' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_ratio' => 1.5, // (300 / 200) - 'https_enabled' => false - ], - 'vimeo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -362,7 +362,7 @@ - 'oembed' => '%4$s//vimeo.com/api/oembed.json?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'vine' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1, // (1 / 1) - 'https_enabled' => true, -@@ -374,7 +374,7 @@ - ] - ], - 'yahoo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -386,7 +386,7 @@ - ] - ], - 'youtube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -403,7 +403,7 @@ - ] - ], - 'youtubeplaylist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -415,7 +415,7 @@ - ] - ], - 'youtubevideolist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -427,7 +427,7 @@ - ] - ], - 'youku' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -527,6 +527,13 @@ - private $urlArgs = false; - - /** -+ * Title for iframe. -+ * -+ * @var string -+ */ -+ private $iframeTitle = ""; -+ -+ /** - * Main Constructor - * - * @access private -@@ -554,6 +561,7 @@ - - /** - * return the service host map array -+ * - * @return array $serviceHostMap - */ - public static function getServiceHostMap() { -@@ -602,6 +610,7 @@ - htmlentities($this->getVideoID(), ENT_QUOTES), - $this->getWidth(), - $this->getHeight(), -+ $this->getIframeTitle(), - ]; - - if ($this->getExtraIds() !== false) { -@@ -723,6 +732,20 @@ - } - - /** -+ * Return the iframeTitle. -+ * -+ * @access public -+ * @return String, defaulting to message 'ev_default_play_desc' -+ */ -+ public function getIframeTitle() { -+ if($this->iframeTitle == "") { -+ return wfMessage('ev_default_play_desc')->text(); -+ } -+ -+ return $this->iframeTitle; -+ } -+ -+ /** - * Set the width of the player. This also will set the height automatically. - * Width will be automatically constrained to the minimum and maximum widths. - * -+++ ./i18n/en.json 2020-01-02 17:47:39.993265357 +0000 -@@ -18,5 +18,6 @@ - "ev_video_long_desc": "$1, $2 codec, length $3, $4x$5 pixels, $6 overall", - "ev_audio_short_desc": "$1", - "ev_audio_long_desc": "$1, $2 codec, length $3, $4 overall", -- "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1" -+ "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1", -+ "ev_default_play_desc": "Play video" - } diff --git a/EO2020/ansible/roles/mediawiki/files/Group-DecisionMaker.css b/EO2020/ansible/roles/mediawiki/files/Group-DecisionMaker.css deleted file mode 100644 index a3e93949..00000000 --- a/EO2020/ansible/roles/mediawiki/files/Group-DecisionMaker.css +++ /dev/null @@ -1,8 +0,0 @@ -#p-views ul li:not(.simplefavorite-icon):not(#ca-view):not(#ca-edit) { display:none!important; } -#p-cactions { display:none!important; } -#p-namespaces { display:none!important; } -#pt-mytalk { display:none!important; } -#pt-watchlist { display:none!important; } -#pt-mycontris { display:none!important; } -.mw-editsection { display:none!important; } -#p-tb { display:none!important; } diff --git a/EO2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet b/EO2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet deleted file mode 100644 index 3316ca20..00000000 --- a/EO2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet +++ /dev/null @@ -1,196 +0,0 @@ -__NOTOC__ - -'''''Note:''''' This is an abridged version of the famous -[https://en.wikipedia.org/wiki/Help:Cheatsheet Wikipedia Syntax Cheat Sheet] --- try there if you don't see the markup codes you're looking for below. - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan=3 style="background:#E6F2FF; border-top:2px #a3b1bf solid;text-align:center;" | -'''Works anywhere in the text'''         -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|Italics, bold, and both -| -''italics'', '''bold''', and '''''both''''' -| -''italics'', '''bold''', and '''''both''''' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to another page -| -[[some page]]
-| -[[some page]]
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -"[[Wikipedia:Piped link|Pipe]]" a link to change the link's text -| -[[Android (operating system)|Android]] -| -[[Android (operating system)|Android]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -Link to a section -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Plain off-site URL -| -https://www.wikipedia.org -| -https://www.wikipedia.org -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to an off-site URL -| -[https://www.wikipedia.org] -| -[https://www.wikipedia.org] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link and link-text to an off-site URL -| -[https://www.wikipedia.org/ Wikipedia] -| -[https://www.wikipedia.org/ Wikipedia] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Signature -
''E.g., to sign your contributions when posting to a [[Wikipedia:Tutorial (Talk pages)|talk page]]''
-| -~~~~ -| -[[Special:Mypage|Username]] ([[Special:Mytalk|talk]]) {{CURRENTTIME}}, {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC) -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Strike some text -| -This text is conspicuously stricken. -| -This text is conspicuously stricken. -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Underline -| -This text is underlined -| -This text is underlined -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Picture tutorial|Show an image]] -| -[[File:Wiki.png|thumb|Caption]] -| -[[File:Wiki.png|thumb|Caption]] -
''If the image hasn't been uploaded, you'll just see its path as red text.''
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Add a page to a Category. -|[[Category:Cetaceans I Have Known]]

''best placed near the bottom of a page'' -|''shows'' "Cetaceans I Have Known" ''in a bar at bottom when the page is previewed or published'' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to a [[Wikipedia:FAQ/Categories|category]] or [[Help:Files|file]] -|
[[:Category:Cetaceans I Have Known]]
[[:File:File name]] -|
[[:Category:Wikipedia basic information]]
[[:File:Example.jpg]] -|} - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan="3" style="background:#E6F2FF; border-top:2px #a3b1bf solid; text-align:center;" | '''Works only at the beginnings of lines'''     -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|[[Wikipedia:Redirect|Redirect to another page]] -
''redirects must be placed at the start of the first line''
-| -#REDIRECT [[Target page]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Redirect|Redirect to a section of another page]] -| -#REDIRECT [[Target page#anchorName]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page#anchorName]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Section headings
-
''a Table of Contents will automatically be generated when four headings are added to an article''
-| -==Level 2==
-===Level 3===
-====Level 4====
-=====Level 5=====
-======Level 6======

-''do not use''  =Level 1=  ''as it is for page titles'' -| - -==Level 2== -===Level 3=== -====Level 4==== -=====Level 5===== -======Level 6====== -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Bullet-point list (unnumbered list) -| -* One
-* Two
-** Two point one
-* Three -| -* One -* Two -** Two point one -* Three -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Numbered list (enumerated list) -| -# One
-# Two
-## Two point one
-# Three -| -# One -# Two -## Two point one -# Three -|} diff --git a/EO2020/ansible/roles/mediawiki/tasks/main.yml b/EO2020/ansible/roles/mediawiki/tasks/main.yml deleted file mode 100644 index a6a4cbca..00000000 --- a/EO2020/ansible/roles/mediawiki/tasks/main.yml +++ /dev/null @@ -1,493 +0,0 @@ ---- - -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Install MW with Composer - command: composer install --no-dev - args: - chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Patch EmbedVideo - patch: - src: EmbedVideoIframeTitle.patch - basedir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/EmbedVideo-v2.8.0/" - -- name: Install PluggableAuth - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install SimpleSAML extension - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install Collection - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout ActivityLog - git: - repo: https://github.com/OpenTechStrategies/ActivityLog - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" - version: 27e9191 - -- name: Checkout SimpleFavorites - git: - repo: https://github.com/OpenTechStrategies/SimpleFavorites - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/SimpleFavorites/" - version: 59fed33 - -- name: Checkout TeamComments - git: - repo: https://github.com/OpenTechStrategies/TeamComments - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TeamComments/" - version: 450bff7 - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - -- name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=mysql --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=EO2020 --scriptpath=\"/EO2020\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"EO2020\" \"admin\"" - args: - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" - -- name: Enable PluggableAuth - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" - block: | - wfLoadExtension( 'PluggableAuth' ); - $wgPluggableAuth_EnableAutoLogin = true; - $wgPluggableAuth_EnableLocalLogin = true; - $wgPluggableAuth_EnableLocalProperties = false; - $wgPluggableAuth_ButtonLabel = "Log In With MacArthur Okta"; - $wgInvalidUsernameCharacters = ""; - -- name: Enable SimpleSAMLphp extension - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" - block: | - wfLoadExtension( 'SimpleSAMLphp' ); - $wgSimpleSAMLphp_InstallDir = '{{ simplesaml_install_directory }}/simplesamlphp-1.18.4'; - $wgSimpleSAMLphp_AuthSourceId = '{{ simplesaml_okta_metadata_name }}'; - $wgSimpleSAMLphp_RealNameAttribute = ['firstName', 'lastName']; - $wgSimpleSAMLphp_EmailAttribute = 'email'; - $wgSimpleSAMLphp_UsernameAttribute = 'email'; - $wgSimpleSAMLphp_GroupMap = ['sysop' => ['groups' => ['LFC Torque Admin', 'LFC Staff']]]; - $wgSimpleSAMLphp_SyncAllGroups_GroupNameModificationCallback = function($origGroupName){ - # Remove spaces - return preg_replace('/\s/', '', $origGroupName); - }; - $wgSimpleSAMLphp_AttributeProcessorFactories = [ - "MediaWiki\\Extension\\SimpleSAMLphp\\AttributeProcessor\\SyncAllGroups::factory" - ]; - -# This actually needs to be installed after PickSome (above), because -# we want the picksome sidebar to be loaded before the Collection sidebar -# because of how mediawiki decides order of portlet. -- name: Enable Collection - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE COLLECTION CONFIG" - block: | - require_once "$IP/extensions/Collection/Collection.php"; - $wgCollectionMWServeURL = "http://127.0.0.1:8899"; - $wgCollectionMaxArticles = 250; - $wgEnableApi = true; - $wgCollectionFormats = array( 'rl' => 'PDF',); - $wgCollectionPortletFormats = []; - $wgCollectionDisableDownloadSection = false; - $wgHooks['ApiBeforeMain'][] = function($main) { - global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; - if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { - $wgTorqueDataConnectRenderToHTML = false; - $tdcinfo = $main->getRequest()->getText("tdcinfo", false); - list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); - } - }; - $wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { - global $wgCollectionMWServeCredentials; - $group = TorqueDataConnectConfig::getValidGroup($user); - $view = TorqueDataConnectConfig::getCurrentView(); - $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; - }; - -- name: Enable TorqueDataConnect - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" - block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectSheetName = "EO2020"; - $wgTorqueDataConnectWikiKey = "EO2020"; - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - wfLoadExtension('TorqueDataConnect'); - -- name: Enable SimpleFavorites - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('SimpleFavorites');" - -- name: Enable TeamComments - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TEAMCOMMENTS CONFIG" - block: | - wfLoadExtension('TeamComments'); - $wgTeamCommentsCheatSheetLocation = "Wiki_Markup_Cheat_Sheet"; - $wgTeamCommentsUserPseudonymizer = function($username) { - return "Pseudonymous User #" . TorqueDataConnectUserLookup::lookupByUsername($username)->{"id"}; - }; - -- name: Enable Uploading - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} UPLOAD CONFIG" - block: | - $wgEnableUploads = true; - $wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'docx', 'html', 'pdf', 'xlsx')); - $wgFileBlacklist = array(); - $wgMimeTypeBlacklist = array(); - $wgStrictFileExtensions = false; - $wgTrustedMediaFormats = array('application/zip', 'text/html'); - $wgVerifyMimeType = false; - $wgAllowJavaUploads = true; - $wgCheckFileExtensions = false; - $wgGroupPermissions['bot']['edit'] = true; - $wgGroupPermissions['bot']['upload'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - $wgGroupPermissions['autoconfirmed']['reupload'] = true; - -- name: Set TOC depth - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMaxTocLevel = 2; - -- name: Disable Collection Warning 1 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Disable Collection Warning 2 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Remove Collection Book Text - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" - regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' - replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' - -- name: Install ActivityLog Configuration - copy: - src: ActivityLogConfiguration - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable ActivityLog - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" - block: | - wfLoadExtension('ActivityLog'); - $wgMessagesDirs['ActivityLogConfiguration'] = 'ActivityLogConfiguration/i18n'; - $wgActivityLogHooksToWatch["ArticleViewHeader"] = function ($article) { - $referrer = $_SERVER['HTTP_REFERER']; - $ourServer = "http://torque.leverforchange.org"; - - if($referrer && $ourServer == substr($referrer, 0, strlen($ourServer))) { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader-with-referrer", - $_SERVER['HTTP_REFERER'] - ); - } else { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader" - ); - } - }; - - $wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { - global $wgTitle; - return array($user, $wgTitle, "activitylog-userlogin"); - }; - - $wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { - return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); - }; - -- name: Disable MediaWiki Cache - # When the cache is enabled, on AWS, with the default setting, - # the following createAndPromote.php command fails due to cache timeout. - # The reason isn't clear, but for now, this will fix it. - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMainCacheType = CACHE_NONE; - -- name: Create mwlib user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" - -- name: Create csv2wiki user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" - -- name: Set Group Permissions - blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgGroupPermissions['*']['read'] = false; - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - - # Permissions that we want sysops/admins to have that - # but not for staff go here - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - - # NOTE: There are some MediaWiki 'sysop' and 'bureaucrat' permissions - # that we give to LFCTorque and LFCTorqueAdmin in 100Change2020 in - # ../../../../../100Change2020/ansible/roles/mediawiki/tasks/main.yml - # that we don't seem to be giving here. I'm not sure whether - # that's an oversight or whether there's a reason we don't do it - # for EO2020, so for now I'm just noting this on 2020-06-01. -Karl - - # Groups requested specifically by LFC. - $wgGroupPermissions['LFCResearchPartners']['read'] = true; - $wgGroupPermissions['LFCEvaluators']['read'] = true; - - # These are OTS Torque Standard Groups - $wgGroupPermissions['OutsideReviewer']['read'] = true; - $wgGroupPermissions['Staff']['read'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['read'] = true; - $wgGroupPermissions['DecisionMaker']['read'] = true; - - # Disable teamcomments for users on this wiki by default. - $wgGroupPermissions['*']['teamcomment'] = false; - $wgGroupPermissions['*']['teamcommentseeusernames'] = false; - - # Then enable teamcomments for the groups that should be leaving comments - $wgGroupPermissions['Staff']['teamcomment'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['DecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['sysop']['teamcomment'] = true; - $wgGroupPermissions['LFCResearchPartners']['teamcomment'] = true; - $wgGroupPermissions['LFCEvaluators']['teamcomment'] = true; - - # Allow some groups to see usernames - $wgGroupPermissions['Staff']['teamcommentseeusernames'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['teamcommentseeusernames'] = true; - $wgGroupPermissions['DecisionMaker']['teamcommentseeusernames'] = true; - $wgGroupPermissions['sysop']['teamcommentseeusernames'] = true; - - # Log permissions (ability to see Special:Log) - $wgAvailableRights[] = 'view-special-log'; - $wgGroupPermissions['*']['view-special-log'] = false; - $wgGroupPermissions['sysop']['view-special-log'] = true; - -- name: Disable Special:Log for groups that don't have view-special-log - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SpecialPage_initList'][] = function ( &$list ) { - global $wgUser; - - if(!$wgUser->isAllowed('view-special-log')) { - unset( $list['Log'] ); - } - return true; - }; - -- name: Create Special:Log name overrides - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTitlesOverrideMessages = [ - "picksomelogpage" => "Selection", - "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", - "simplefavoriteslog" => "Favorites", - "log-name-create" => "Page Creation", - "movelogpage" => "Page Rename", - "uploadlogpage" => "File Upload", - "dellogpage" => "Page Deletion", - "newuserlogpage" => "User Creation", - "log-name-teamcomments" => "Comments", - "torquedataconnect-apiaccesslog" => "API Accesses", - "torquedataconnect-datachangeslog" => "Data Changes", - "rightslog" => "Changes to Access Control / Permissions" - ]; - - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $logTitlesOverrideMessages; - if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { - $message = $logTitlesOverrideMessages[strtolower($title)]; - } - }; - -- name: Disable Special:Log types that aren't of interest - blockinfile: - marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; - - $wgHooks['SetupAfterCache'][] = function () { - global $wgLogTypes, $logTypesBlacklist; - foreach($logTypesBlacklist as $logType) { - unset($wgLogTypes[array_search($logType, $wgLogTypes)]); - } - - return true; - }; - -- name: Change Special:Log format slightly - blockinfile: - marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # This is a little brittle, based on how the lines are rendered by the skin currently used - # but should work for the foreseeable future. - $wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ - $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); - }; - -- name: Transfer EO Logo - copy: - src: "{{ lookup('env','OTS_DIR') }}/clients/lever-for-change/torque-sites/EO2020/data/EOLogo.png" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/EOLogo.png" - -- name: Transfer LFC Logo - copy: - src: LeverForChange_Logo.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LeverForChange_Logo.png" - -- name: Install LFC Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/LeverForChange_Logo.png"; - -- name: Transfer Common group css - copy: - src: Common.css - dest: "{{ mediawiki_install_directory }}/Common.css" - -- name: Install Common group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" - -- name: Remove Common group css - file: - path: "{{ mediawiki_install_directory }}/Common.css" - state: absent - -- name: Transfer DecisionMaker group css - copy: - src: Group-DecisionMaker.css - dest: "{{ mediawiki_install_directory }}/Group-DecisionMaker.css" - -- name: Install DecisionMaker group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Group-{{ item }}.css < {{ mediawiki_install_directory }}/Group-DecisionMaker.css" - loop: - - PseudoDecisionMaker - - DecisionMaker - - LFCEvaluators - - LFCResearchPartners - -- name: Remove DecisionMaker group css - file: - path: "{{ mediawiki_install_directory }}/Group-DecisionMaker.css" - state: absent - -- name: Transfer htaccess - copy: - src: .htaccess - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" - -- name: Transfer wiki cheat sheet - copy: - src: Wiki_Markup_Cheat_Sheet - dest: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Install wiki cheat sheet - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b Wiki_Markup_Cheat_Sheet < {{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Transfer wiki cheat sheet - file: - path: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - state: absent - -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" - -# Handle Apache changes -- name: Symlink to webserver directory - become_user: root - file: - state: link - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/EO2020" - -- name: Set permissions on attachments directory - become_user: root - file: - path: "{{ html_directory }}/EO2020/images/" - owner: www-data - group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted diff --git a/EO2020/ansible/roles/simplesaml/tasks/main.yml b/EO2020/ansible/roles/simplesaml/tasks/main.yml deleted file mode 100644 index 6c0c7fd3..00000000 --- a/EO2020/ansible/roles/simplesaml/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Add okta account to autoconfig - lineinfile: - path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" - insertafter: '\$metadata_url_for = array\(' - line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," diff --git a/INSTALL.md b/INSTALL.md index 1e554a4a..cbc3f1e8 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -15,7 +15,7 @@ layout. * `.yml` - the main playbook file * `inv/` - the inventory files -* `roles/` - the ansible scripts and support +* `roles/` - the ansible scripts for customizations specific to this competition Before you get started, you need to get ansible on your system. This is probably easiest through package management. @@ -24,6 +24,12 @@ is probably easiest through package management. $ sudo apt-get install ansible ``` +Then, you need to tell ansible where to find the general torque-sites roles + +``` +$ export ANSIBLE_ROLES_PATH=$ANSIBLE_ROLES_PATH:/path/to/torque-sites/roles +``` + #### Apache configuration for large files Because the etl pipelines we use generate large csvs to upload, and those are diff --git a/LLIIA2020/ansible/LLIIA2020.yml b/LLIIA2020/ansible/LLIIA2020.yml index eb72a98e..58d07537 100644 --- a/LLIIA2020/ansible/LLIIA2020.yml +++ b/LLIIA2020/ansible/LLIIA2020.yml @@ -4,10 +4,21 @@ become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - collection + - embed_video + - permissions + - simplefavorites + - simplesaml + - teamcomments + - torquedataconnect + - LLIIA2020 + # This should always go last, to run db updates and restart + - finishmediawiki - hosts: simplesaml become: true become_user: "{{ deployment_user }}" roles: - - simplesaml + - simplesaml diff --git a/LLIIA2020/ansible/inv/local/group_vars/all.tmpl b/LLIIA2020/ansible/inv/local/group_vars/all.tmpl index bf955beb..98d5da7d 100644 --- a/LLIIA2020/ansible/inv/local/group_vars/all.tmpl +++ b/LLIIA2020/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: LLIIA2020 + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: LLIIA2020 + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/LLIIA2020/ansible/inv/prod/group_vars/all/base b/LLIIA2020/ansible/inv/prod/group_vars/all/base index e26f2fea..a4181d4a 100644 --- a/LLIIA2020/ansible/inv/prod/group_vars/all/base +++ b/LLIIA2020/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: LLIIA2020 +torquedataconnect_sheet_name: LLIIA2020 html_directory: /var/www/html mediawiki_install_directory: /home/deploy/LLIIA2020/ mediawiki_mwlib_username: mwlib diff --git a/DemoView/ansible/roles/mediawiki/files/.htaccess b/LLIIA2020/ansible/roles/LLIIA2020/files/.htaccess similarity index 100% rename from DemoView/ansible/roles/mediawiki/files/.htaccess rename to LLIIA2020/ansible/roles/LLIIA2020/files/.htaccess diff --git a/LLIIA2020/ansible/roles/mediawiki/files/LLIIA_Logo.png b/LLIIA2020/ansible/roles/LLIIA2020/files/LLIIA_Logo.png similarity index 100% rename from LLIIA2020/ansible/roles/mediawiki/files/LLIIA_Logo.png rename to LLIIA2020/ansible/roles/LLIIA2020/files/LLIIA_Logo.png diff --git a/LLIIA2020/ansible/roles/LLIIA2020/tasks/main.yml b/LLIIA2020/ansible/roles/LLIIA2020/tasks/main.yml new file mode 100644 index 00000000..12886d54 --- /dev/null +++ b/LLIIA2020/ansible/roles/LLIIA2020/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: Transfer LLIIA Logo + copy: + src: LLIIA_Logo.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LLIIA_Logo.png" + +- name: Install LLIIA Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/LLIIA_Logo.png"; diff --git a/LLIIA2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json b/LLIIA2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json deleted file mode 100644 index 93685958..00000000 --- a/LLIIA2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "activitylog-articleviewheader": "$1 visited $3", - "activitylog-articlesavepage": "$1 edited $3", - "activitylog-articleviewheader-with-referrer": "$1 visited $3 (from $5)", - "activitylog-userlogin": "$1 logged in" -} diff --git a/LLIIA2020/ansible/roles/mediawiki/files/Common.css b/LLIIA2020/ansible/roles/mediawiki/files/Common.css deleted file mode 100644 index e502a300..00000000 --- a/LLIIA2020/ansible/roles/mediawiki/files/Common.css +++ /dev/null @@ -1,13 +0,0 @@ -/* This disables some of the Special:Log inputs */ -.rootpage-Special_Log .mw-usertoollinks { - display:none; -} -.rootpage-Special_Log .comment { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLTagFilter { - display:none; -} -.rootpage-Special_Log .mw-htmlform-field-HTMLMultiSelectField { - display:none; -} diff --git a/LLIIA2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch b/LLIIA2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch deleted file mode 100644 index a24dfef3..00000000 --- a/LLIIA2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch +++ /dev/null @@ -1,380 +0,0 @@ -+++ ./classes/VideoService.php 2020-01-02 17:10:22.640951109 +0000 -@@ -18,7 +18,7 @@ - */ - static private $services = [ - 'archiveorg' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -30,7 +30,7 @@ - ] - ], - 'bambuser' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -42,7 +42,7 @@ - ] - ], - 'bambuser_channel' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -54,7 +54,7 @@ - ] - ], - 'beam' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -66,7 +66,7 @@ - ] - ], - 'disclose' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -75,7 +75,7 @@ - '#disclose.tv/action/viewvideo/([\d]+)/([\w-]+)/#is' - ], - 'id_regex' => [ -- '#^([\d]+)$#is' -+ '#^([\d]+)$#is' - ] - ], - 'blip' => [ -@@ -88,7 +88,7 @@ - 'oembed' => 'http://blip.tv/oembed/?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'bing' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -100,7 +100,7 @@ - ] - ], - 'collegehumor' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6260162601626, // (600 / 369) - 'https_enabled' => true, -@@ -112,7 +112,7 @@ - ] - ], - 'dailymotion' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -124,13 +124,13 @@ - ] - ], - 'divshare' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true - ], - 'funnyordie' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64102564102564, // (640 / 390) - 'https_enabled' => false, -@@ -142,7 +142,7 @@ - ] - ], - 'gfycat' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'https_enabled' => true, - 'url_regex' => [ -@@ -153,7 +153,7 @@ - ] - ], - 'jwplayer' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -165,7 +165,7 @@ - ] - ], - 'kickstarter' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -177,7 +177,7 @@ - ] - ], - 'mediacccde' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 660, - 'default_ratio' => 1.77777777777778, //(16 / 9), - 'https_enabled' => true, -@@ -189,7 +189,7 @@ - ] - ], - 'metacafe' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => false, -@@ -201,7 +201,7 @@ - ] - ], - 'nico' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.59609120521173, // (490 / 307) - 'https_enabled' => false, -@@ -213,7 +213,7 @@ - ] - ], - 'rutube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -225,7 +225,7 @@ - ] - ], - 'smashcast' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -237,7 +237,7 @@ - ] - ], - 'soundcloud' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 186, - 'default_ratio' => 2.66666, - 'https_enabled' => true, -@@ -246,7 +246,7 @@ - ] - ], - 'teachertube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.72972972972973, // (640 / 370) - 'https_enabled' => false, -@@ -258,7 +258,7 @@ - ] - ], - 'ted' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -270,7 +270,7 @@ - ] - ], - 'tubitv' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -282,7 +282,7 @@ - ] - ], - 'tudou' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -295,7 +295,7 @@ - ] - ], - 'tvpot' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -307,7 +307,7 @@ - ] - ], - 'twitch' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -319,7 +319,7 @@ - ] - ], - 'twitchclip' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -331,7 +331,7 @@ - ] - ], - 'twitchvod' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -343,12 +343,12 @@ - ] - ], - 'videomaten' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_ratio' => 1.5, // (300 / 200) - 'https_enabled' => false - ], - 'vimeo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -362,7 +362,7 @@ - 'oembed' => '%4$s//vimeo.com/api/oembed.json?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'vine' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1, // (1 / 1) - 'https_enabled' => true, -@@ -374,7 +374,7 @@ - ] - ], - 'yahoo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -386,7 +386,7 @@ - ] - ], - 'youtube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -403,7 +403,7 @@ - ] - ], - 'youtubeplaylist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -415,7 +415,7 @@ - ] - ], - 'youtubevideolist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -427,7 +427,7 @@ - ] - ], - 'youku' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -527,6 +527,13 @@ - private $urlArgs = false; - - /** -+ * Title for iframe. -+ * -+ * @var string -+ */ -+ private $iframeTitle = ""; -+ -+ /** - * Main Constructor - * - * @access private -@@ -554,6 +561,7 @@ - - /** - * return the service host map array -+ * - * @return array $serviceHostMap - */ - public static function getServiceHostMap() { -@@ -602,6 +610,7 @@ - htmlentities($this->getVideoID(), ENT_QUOTES), - $this->getWidth(), - $this->getHeight(), -+ $this->getIframeTitle(), - ]; - - if ($this->getExtraIds() !== false) { -@@ -723,6 +732,20 @@ - } - - /** -+ * Return the iframeTitle. -+ * -+ * @access public -+ * @return String, defaulting to message 'ev_default_play_desc' -+ */ -+ public function getIframeTitle() { -+ if($this->iframeTitle == "") { -+ return wfMessage('ev_default_play_desc')->text(); -+ } -+ -+ return $this->iframeTitle; -+ } -+ -+ /** - * Set the width of the player. This also will set the height automatically. - * Width will be automatically constrained to the minimum and maximum widths. - * -+++ ./i18n/en.json 2020-01-02 17:47:39.993265357 +0000 -@@ -18,5 +18,6 @@ - "ev_video_long_desc": "$1, $2 codec, length $3, $4x$5 pixels, $6 overall", - "ev_audio_short_desc": "$1", - "ev_audio_long_desc": "$1, $2 codec, length $3, $4 overall", -- "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1" -+ "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1", -+ "ev_default_play_desc": "Play video" - } diff --git a/LLIIA2020/ansible/roles/mediawiki/files/Group-DecisionMakers.css b/LLIIA2020/ansible/roles/mediawiki/files/Group-DecisionMakers.css deleted file mode 100644 index 375e9d41..00000000 --- a/LLIIA2020/ansible/roles/mediawiki/files/Group-DecisionMakers.css +++ /dev/null @@ -1,7 +0,0 @@ -#p-views ul li:not(.simplefavorite-icon):not(#ca-view):not(#ca-edit) { display:none!important; } -#p-cactions { display:none!important; } -#pt-mytalk { display:none!important; } -#pt-watchlist { display:none!important; } -#pt-mycontris { display:none!important; } -.mw-editsection { display:none!important; } -#p-tb { display:none!important; } diff --git a/LLIIA2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet b/LLIIA2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet deleted file mode 100644 index 3316ca20..00000000 --- a/LLIIA2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet +++ /dev/null @@ -1,196 +0,0 @@ -__NOTOC__ - -'''''Note:''''' This is an abridged version of the famous -[https://en.wikipedia.org/wiki/Help:Cheatsheet Wikipedia Syntax Cheat Sheet] --- try there if you don't see the markup codes you're looking for below. - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan=3 style="background:#E6F2FF; border-top:2px #a3b1bf solid;text-align:center;" | -'''Works anywhere in the text'''         -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|Italics, bold, and both -| -''italics'', '''bold''', and '''''both''''' -| -''italics'', '''bold''', and '''''both''''' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to another page -| -[[some page]]
-| -[[some page]]
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -"[[Wikipedia:Piped link|Pipe]]" a link to change the link's text -| -[[Android (operating system)|Android]] -| -[[Android (operating system)|Android]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -Link to a section -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Plain off-site URL -| -https://www.wikipedia.org -| -https://www.wikipedia.org -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to an off-site URL -| -[https://www.wikipedia.org] -| -[https://www.wikipedia.org] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link and link-text to an off-site URL -| -[https://www.wikipedia.org/ Wikipedia] -| -[https://www.wikipedia.org/ Wikipedia] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Signature -
''E.g., to sign your contributions when posting to a [[Wikipedia:Tutorial (Talk pages)|talk page]]''
-| -~~~~ -| -[[Special:Mypage|Username]] ([[Special:Mytalk|talk]]) {{CURRENTTIME}}, {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC) -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Strike some text -| -This text is conspicuously stricken. -| -This text is conspicuously stricken. -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Underline -| -This text is underlined -| -This text is underlined -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Picture tutorial|Show an image]] -| -[[File:Wiki.png|thumb|Caption]] -| -[[File:Wiki.png|thumb|Caption]] -
''If the image hasn't been uploaded, you'll just see its path as red text.''
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Add a page to a Category. -|[[Category:Cetaceans I Have Known]]

''best placed near the bottom of a page'' -|''shows'' "Cetaceans I Have Known" ''in a bar at bottom when the page is previewed or published'' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to a [[Wikipedia:FAQ/Categories|category]] or [[Help:Files|file]] -|
[[:Category:Cetaceans I Have Known]]
[[:File:File name]] -|
[[:Category:Wikipedia basic information]]
[[:File:Example.jpg]] -|} - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan="3" style="background:#E6F2FF; border-top:2px #a3b1bf solid; text-align:center;" | '''Works only at the beginnings of lines'''     -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|[[Wikipedia:Redirect|Redirect to another page]] -
''redirects must be placed at the start of the first line''
-| -#REDIRECT [[Target page]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Redirect|Redirect to a section of another page]] -| -#REDIRECT [[Target page#anchorName]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page#anchorName]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Section headings
-
''a Table of Contents will automatically be generated when four headings are added to an article''
-| -==Level 2==
-===Level 3===
-====Level 4====
-=====Level 5=====
-======Level 6======

-''do not use''  =Level 1=  ''as it is for page titles'' -| - -==Level 2== -===Level 3=== -====Level 4==== -=====Level 5===== -======Level 6====== -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Bullet-point list (unnumbered list) -| -* One
-* Two
-** Two point one
-* Three -| -* One -* Two -** Two point one -* Three -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Numbered list (enumerated list) -| -# One
-# Two
-## Two point one
-# Three -| -# One -# Two -## Two point one -# Three -|} diff --git a/LLIIA2020/ansible/roles/mediawiki/tasks/main.yml b/LLIIA2020/ansible/roles/mediawiki/tasks/main.yml deleted file mode 100644 index dbe352fa..00000000 --- a/LLIIA2020/ansible/roles/mediawiki/tasks/main.yml +++ /dev/null @@ -1,532 +0,0 @@ ---- - -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Install MW with Composer - command: composer install --no-dev - args: - chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Patch EmbedVideo - patch: - src: EmbedVideoIframeTitle.patch - basedir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/EmbedVideo-v2.8.0/" - -- name: Install PluggableAuth - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install SimpleSAML extension - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install Collection - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout ActivityLog - git: - repo: https://github.com/OpenTechStrategies/ActivityLog - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" - version: 27e9191 - -- name: Checkout SimpleFavorites - git: - repo: https://github.com/OpenTechStrategies/SimpleFavorites - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/SimpleFavorites/" - version: 59fed33 - -- name: Checkout TeamComments - git: - repo: https://github.com/OpenTechStrategies/TeamComments - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TeamComments/" - version: 450bff7 - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - -- name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=mysql --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=LLIIA2020 --scriptpath=\"/LLIIA2020\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"LLIIA2020\" \"admin\"" - args: - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" - -- name: Enable PluggableAuth - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" - block: | - wfLoadExtension( 'PluggableAuth' ); - $wgPluggableAuth_EnableAutoLogin = true; - $wgPluggableAuth_EnableLocalLogin = true; - $wgPluggableAuth_EnableLocalProperties = false; - $wgPluggableAuth_ButtonLabel = "Log In With MacArthur Okta"; - $wgInvalidUsernameCharacters = ""; - -- name: Enable SimpleSAMLphp extension - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" - block: | - wfLoadExtension( 'SimpleSAMLphp' ); - $wgSimpleSAMLphp_SyncAllGroups_LocallyManaged = ["sysop", "DecisionMakers", "interface-admin", "bureaucrat"]; - $wgSimpleSAMLphp_InstallDir = '{{ simplesaml_install_directory }}/simplesamlphp-1.18.4'; - $wgSimpleSAMLphp_AuthSourceId = '{{ simplesaml_okta_metadata_name }}'; - $wgSimpleSAMLphp_RealNameAttribute = ['firstName', 'lastName']; - $wgSimpleSAMLphp_EmailAttribute = 'email'; - $wgSimpleSAMLphp_UsernameAttribute = 'username'; - $wgSimpleSAMLphp_GroupMap = [ - 'sysop' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], - 'interface-admin' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], - 'bureaucrat' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], - 'DecisionMakers' => ['groups' => ['LFC Decision Makers']] - ]; - - $wgSimpleSAMLphp_SyncAllGroups_GroupNameModificationCallback = function($origGroupName){ - # Remove spaces - return preg_replace('/\s/', '', $origGroupName); - }; - $wgSimpleSAMLphp_AttributeProcessorFactories = [ - "MediaWiki\\Extension\\SimpleSAMLphp\\AttributeProcessor\\SyncAllGroups::factory" - ]; - -- name: Enable Collection - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE COLLECTION CONFIG" - block: | - require_once "$IP/extensions/Collection/Collection.php"; - $wgCollectionMWServeURL = "http://127.0.0.1:8899"; - $wgCollectionMaxArticles = 250; - $wgEnableApi = true; - $wgCollectionFormats = array( 'rl' => 'PDF',); - $wgCollectionPortletFormats = []; - $wgCollectionDisableDownloadSection = false; - $wgHooks['ApiBeforeMain'][] = function($main) { - global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; - if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { - $wgTorqueDataConnectRenderToHTML = false; - $tdcinfo = $main->getRequest()->getText("tdcinfo", false); - list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); - } - }; - $wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { - global $wgCollectionMWServeCredentials; - $group = TorqueDataConnectConfig::getValidGroup($user); - $view = TorqueDataConnectConfig::getCurrentView(); - $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; - }; - -- name: Enable TorqueDataConnect - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" - block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectSheetName = "LLIIA2020"; - $wgTorqueDataConnectWikiKey = "LLIIA2020"; - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - wfLoadExtension('TorqueDataConnect'); - -- name: Enable SimpleFavorites - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('SimpleFavorites');" - -- name: Enable TeamComments - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TEAMCOMMENTS CONFIG" - block: | - wfLoadExtension('TeamComments'); - $wgTeamCommentsCheatSheetLocation = "Wiki_Markup_Cheat_Sheet"; - $wgTeamCommentsUserPseudonymizer = function($username) { - return "Pseudonymous User #" . TorqueDataConnectUserLookup::lookupByUsername($username)->{"id"}; - }; - -- name: Enable Uploading - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} UPLOAD CONFIG" - block: | - $wgEnableUploads = true; - $wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'docx', 'html', 'pdf', 'xlsx')); - $wgFileBlacklist = array(); - $wgMimeTypeBlacklist = array(); - $wgStrictFileExtensions = false; - $wgTrustedMediaFormats = array('application/zip', 'text/html'); - $wgVerifyMimeType = false; - $wgAllowJavaUploads = true; - $wgCheckFileExtensions = false; - $wgGroupPermissions['bot']['edit'] = true; - $wgGroupPermissions['bot']['upload'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - $wgGroupPermissions['autoconfirmed']['reupload'] = true; - -- name: Set TOC depth - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMaxTocLevel = 2; - -- name: Disable Collection Warning 1 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Disable Collection Warning 2 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Remove Collection Book Text - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" - regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' - replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' - -- name: Install ActivityLog Configuration - copy: - src: ActivityLogConfiguration - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable ActivityLog - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" - block: | - wfLoadExtension('ActivityLog'); - $wgMessagesDirs['ActivityLogConfiguration'] = 'ActivityLogConfiguration/i18n'; - $wgActivityLogHooksToWatch["ArticleViewHeader"] = function ($article) { - $referrer = $_SERVER['HTTP_REFERER']; - $ourServer = "http://torque.leverforchange.org"; - - if($referrer && $ourServer == substr($referrer, 0, strlen($ourServer))) { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader-with-referrer", - $_SERVER['HTTP_REFERER'] - ); - } else { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader" - ); - } - }; - - $wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { - global $wgTitle; - return array($user, $wgTitle, "activitylog-userlogin"); - }; - - $wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { - return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); - }; - -- name: Disable MediaWiki Cache - # When the cache is enabled, on AWS, with the default setting, - # the following createAndPromote.php command fails due to cache timeout. - # The reason isn't clear, but for now, this will fix it. - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMainCacheType = CACHE_NONE; - -- name: Create mwlib user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" - -- name: Create csv2wiki user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" - -- name: Set Group Permissions - blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgGroupPermissions['*']['read'] = false; - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-edit'] = true; - - # Groups requested specifically by LFC. - $wgGroupPermissions['LFCConsultingPartners']['read'] = true; - $wgGroupPermissions['LFCConsultingPartners']['torquedataconnect-edit'] = true; - $wgGroupPermissions['LFCResearchPartners']['read'] = true; - $wgGroupPermissions['LFCEvaluators']['read'] = true; - - # These are OTS Torque Standard Groups - $wgGroupPermissions['OutsideReviewers']['read'] = true; - $wgGroupPermissions['Staff']['read'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['read'] = true; - $wgGroupPermissions['DecisionMakers']['read'] = true; - - # Disable teamcomments for users on this wiki by default. - $wgGroupPermissions['*']['teamcomment'] = false; - $wgGroupPermissions['*']['teamcommentseeusernames'] = false; - - # Then enable teamcomments for the groups that should be leaving comments - $wgGroupPermissions['Staff']['teamcomment'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['DecisionMaker']['teamcomment'] = true; - $wgGroupPermissions['sysop']['teamcomment'] = true; - $wgGroupPermissions['LFCResearchPartners']['teamcomment'] = true; - $wgGroupPermissions['LFCEvaluators']['teamcomment'] = true; - - # Allow some groups to see usernames - $wgGroupPermissions['Staff']['teamcommentseeusernames'] = true; - $wgGroupPermissions['PseudoDecisionMaker']['teamcommentseeusernames'] = true; - $wgGroupPermissions['DecisionMaker']['teamcommentseeusernames'] = true; - $wgGroupPermissions['sysop']['teamcommentseeusernames'] = true; - - # Log permissions (ability to see Special:Log) - $wgAvailableRights[] = 'view-special-log'; - $wgGroupPermissions['*']['view-special-log'] = false; - $wgGroupPermissions['sysop']['view-special-log'] = true; - -- name: Create LFC Evaluator page rule - blockinfile: - marker: "## {mark} ANSIBLE LFC EVALUATOR CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SkinTemplateNavigation'][] = function ( $template, &$links ) { - $currentTitle = $template->getTitle()->getFullText(); - $lfc_prepend = "LFC Analysis of "; - $eval_prepend = "Evaluations of "; - - $isAnalysisPage = (strlen($currentTitle) > strlen($lfc_prepend) && substr($currentTitle, 0, strlen($lfc_prepend)) === $lfc_prepend); - $isEvalPage = (strlen($currentTitle) > strlen($eval_prepend) && substr($currentTitle, 0, strlen($eval_prepend)) === $eval_prepend); - - $originalPageTitle = $currentTitle; - if($isAnalysisPage) { - $originalPageTitle = substr($currentTitle, strlen($lfc_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } else if($isEvalPage) { - $originalPageTitle = substr($currentTitle, strlen($eval_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } - $lfcAnalysisTitle = Title::newFromText($lfc_prepend . $originalPageTitle); - $evalTitle = Title::newFromText($eval_prepend . $originalPageTitle); - if($isAnalysisPage || $lfcAnalysisTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['lfcanalysis'] = [ - 'class' => ($isAnalysisPage ? 'selected' : ''), - 'href' => ($isAnalysisPage ? $template->getTitle()->getLocalUrl() : $lfcAnalysisTitle->getLocalUrl()), - 'text' => 'LFC Analysis', - ]; - } - if($isEvalPage || $evalTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['evaluations'] = [ - 'class' => ($isEvalPage ? 'selected' : ''), - 'href' => ($isEvalPage ? $template->getTitle()->getLocalUrl() : $evalTitle->getLocalUrl()), - 'text' => 'Evaluations', - ]; - } - - unset($links['namespaces']['talk']); - }; - -- name: Disable Special:Log for groups that don't have view-special-log - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SpecialPage_initList'][] = function ( &$list ) { - global $wgUser; - - if(!$wgUser->isAllowed('view-special-log')) { - unset( $list['Log'] ); - } - return true; - }; - -- name: Create Special:Log name overrides - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTitlesOverrideMessages = [ - "picksomelogpage" => "Selection", - "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", - "simplefavoriteslog" => "Favorites", - "log-name-create" => "Page Creation", - "movelogpage" => "Page Rename", - "uploadlogpage" => "File Upload", - "dellogpage" => "Page Deletion", - "newuserlogpage" => "User Creation", - "log-name-teamcomments" => "Comments", - "torquedataconnect-apiaccesslog" => "API Accesses", - "torquedataconnect-datachangeslog" => "Data Changes", - "rightslog" => "Changes to Access Control / Permissions" - ]; - - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $logTitlesOverrideMessages; - if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { - $message = $logTitlesOverrideMessages[strtolower($title)]; - } - }; - -- name: Disable Special:Log types that aren't of interest - blockinfile: - marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; - - $wgHooks['SetupAfterCache'][] = function () { - global $wgLogTypes, $logTypesBlacklist; - foreach($logTypesBlacklist as $logType) { - unset($wgLogTypes[array_search($logType, $wgLogTypes)]); - } - - return true; - }; - -- name: Change Special:Log format slightly - blockinfile: - marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # This is a little brittle, based on how the lines are rendered by the skin currently used - # but should work for the foreseeable future. - $wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ - $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); - }; - -- name: Transfer LLIIA Logo - copy: - src: LLIIA_Logo.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LLIIA_Logo.png" - -- name: Install LLIIA Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/LLIIA_Logo.png"; - -- name: Transfer Common group css - copy: - src: Common.css - dest: "{{ mediawiki_install_directory }}/Common.css" - -- name: Install Common group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" - -- name: Remove Common group css - file: - path: "{{ mediawiki_install_directory }}/Common.css" - state: absent - -- name: Transfer DecisionMakers group css - copy: - src: Group-DecisionMakers.css - dest: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" - -- name: Install DecisionMakers group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Group-{{ item }}.css < {{ mediawiki_install_directory }}/Group-DecisionMakers.css" - loop: - - PseudoDecisionMakers - - DecisionMakers - - LFCEvaluators - - LFCResearchPartners - - LFCConsultingPartners - -- name: Remove DecisionMakers group css - file: - path: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" - state: absent - -- name: Transfer htaccess - copy: - src: .htaccess - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" - -- name: Transfer wiki cheat sheet - copy: - src: Wiki_Markup_Cheat_Sheet - dest: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Install wiki cheat sheet - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b Wiki_Markup_Cheat_Sheet < {{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Transfer wiki cheat sheet - file: - path: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - state: absent - -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" - -# Handle Apache changes -- name: Symlink to webserver directory - become_user: root - file: - state: link - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/LLIIA2020" - -- name: Set permissions on attachments directory - become_user: root - file: - path: "{{ html_directory }}/LLIIA2020/images" - owner: www-data - group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted diff --git a/LLIIA2020/ansible/roles/simplesaml/tasks/main.yml b/LLIIA2020/ansible/roles/simplesaml/tasks/main.yml deleted file mode 100644 index 6c0c7fd3..00000000 --- a/LLIIA2020/ansible/roles/simplesaml/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Add okta account to autoconfig - lineinfile: - path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" - insertafter: '\$metadata_url_for = array\(' - line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," diff --git a/LoneStar2020/ansible/LoneStar2020.yml b/LoneStar2020/ansible/LoneStar2020.yml index eb72a98e..6f44b76f 100644 --- a/LoneStar2020/ansible/LoneStar2020.yml +++ b/LoneStar2020/ansible/LoneStar2020.yml @@ -4,10 +4,22 @@ become: true become_user: "{{ deployment_user }}" roles: - - mediawiki + - mediawiki + - activitylog + - collection + - embed_video + - permissions + - simplefavorites + - simplesaml + - teamcomments + - torquedataconnect + # This should come after permissions because of overrides of defaults + - LoneStar2020 + # This should always go last, to run db updates and restart + - finishmediawiki - hosts: simplesaml become: true become_user: "{{ deployment_user }}" roles: - - simplesaml + - simplesaml diff --git a/LoneStar2020/ansible/inv/local/group_vars/all.tmpl b/LoneStar2020/ansible/inv/local/group_vars/all.tmpl index bf955beb..790e26d8 100644 --- a/LoneStar2020/ansible/inv/local/group_vars/all.tmpl +++ b/LoneStar2020/ansible/inv/local/group_vars/all.tmpl @@ -1,4 +1,13 @@ --- +competition_name: LoneStar2020 + +# The sheet that this wiki is going to act on. Most of the time +# this will be the same as the competition name (above), but sometimes +# this is different when either the competition name doesn't work as +# a sheet name (for instance, if it starts with a number), or if +# this wiki should act on a different sheet. +torquedataconnect_sheet_name: LoneStar2020 + # Root web directory (where symlinks to the mediawiki instances # are installed) html_directory: /var/www/html diff --git a/LoneStar2020/ansible/inv/prod/group_vars/all/base b/LoneStar2020/ansible/inv/prod/group_vars/all/base index 7db784b7..8c9d5a83 100644 --- a/LoneStar2020/ansible/inv/prod/group_vars/all/base +++ b/LoneStar2020/ansible/inv/prod/group_vars/all/base @@ -1,4 +1,6 @@ --- +competition_name: LoneStar2020 +torquedataconnect_sheet_name: LoneStar2020 html_directory: /var/www/html mediawiki_install_directory: /home/deploy/LoneStar2020/ mediawiki_mwlib_username: mwlib diff --git a/EO2020/ansible/roles/mediawiki/files/.htaccess b/LoneStar2020/ansible/roles/LoneStar2020/files/.htaccess similarity index 100% rename from EO2020/ansible/roles/mediawiki/files/.htaccess rename to LoneStar2020/ansible/roles/LoneStar2020/files/.htaccess diff --git a/LoneStar2020/ansible/roles/mediawiki/files/LoneStar_Logo.png b/LoneStar2020/ansible/roles/LoneStar2020/files/LoneStar_Logo.png similarity index 100% rename from LoneStar2020/ansible/roles/mediawiki/files/LoneStar_Logo.png rename to LoneStar2020/ansible/roles/LoneStar2020/files/LoneStar_Logo.png diff --git a/LoneStar2020/ansible/roles/LoneStar2020/tasks/main.yml b/LoneStar2020/ansible/roles/LoneStar2020/tasks/main.yml new file mode 100644 index 00000000..22015dce --- /dev/null +++ b/LoneStar2020/ansible/roles/LoneStar2020/tasks/main.yml @@ -0,0 +1,27 @@ +--- + +# Because the permissions override MUST come after the original permissions, we +# delete it from the file, and then re-insert it to ensure that it comes at the +# end of the LocalSettings file +- name: Clear Permissions Override + blockinfile: + marker: "## {mark} ANSIBLE GROUP PERMISSIONS OVERRIDE CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + +- name: Add Permissions Override + blockinfile: + marker: "## {mark} ANSIBLE GROUP PERMISSIONS OVERRIDE CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + block: | + $wgGroupPermissions['DecisionMakers']['teamcomment'] = false; + +- name: Transfer LoneStar Logo + copy: + src: LoneStar_Logo.png + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LoneStar_Logo.png" + +- name: Install LoneStar Logo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + regexp: ^\$wgLogo = .* + line: $wgLogo = "$wgResourceBasePath/resources/assets/LoneStar_Logo.png"; diff --git a/LoneStar2020/ansible/roles/mediawiki/files/.htaccess b/LoneStar2020/ansible/roles/mediawiki/files/.htaccess deleted file mode 100644 index 89a08c76..00000000 --- a/LoneStar2020/ansible/roles/mediawiki/files/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -php_value upload_max_filesize 128M -php_value post_max_size 128M diff --git a/LoneStar2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json b/LoneStar2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json deleted file mode 100644 index 93685958..00000000 --- a/LoneStar2020/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "activitylog-articleviewheader": "$1 visited $3", - "activitylog-articlesavepage": "$1 edited $3", - "activitylog-articleviewheader-with-referrer": "$1 visited $3 (from $5)", - "activitylog-userlogin": "$1 logged in" -} diff --git a/LoneStar2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch b/LoneStar2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch deleted file mode 100644 index a24dfef3..00000000 --- a/LoneStar2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch +++ /dev/null @@ -1,380 +0,0 @@ -+++ ./classes/VideoService.php 2020-01-02 17:10:22.640951109 +0000 -@@ -18,7 +18,7 @@ - */ - static private $services = [ - 'archiveorg' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -30,7 +30,7 @@ - ] - ], - 'bambuser' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -42,7 +42,7 @@ - ] - ], - 'bambuser_channel' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.2994923857868, // (640 / 493) - 'https_enabled' => true, -@@ -54,7 +54,7 @@ - ] - ], - 'beam' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -66,7 +66,7 @@ - ] - ], - 'disclose' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -75,7 +75,7 @@ - '#disclose.tv/action/viewvideo/([\d]+)/([\w-]+)/#is' - ], - 'id_regex' => [ -- '#^([\d]+)$#is' -+ '#^([\d]+)$#is' - ] - ], - 'blip' => [ -@@ -88,7 +88,7 @@ - 'oembed' => 'http://blip.tv/oembed/?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'bing' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -100,7 +100,7 @@ - ] - ], - 'collegehumor' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6260162601626, // (600 / 369) - 'https_enabled' => true, -@@ -112,7 +112,7 @@ - ] - ], - 'dailymotion' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -124,13 +124,13 @@ - ] - ], - 'divshare' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true - ], - 'funnyordie' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64102564102564, // (640 / 390) - 'https_enabled' => false, -@@ -142,7 +142,7 @@ - ] - ], - 'gfycat' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'https_enabled' => true, - 'url_regex' => [ -@@ -153,7 +153,7 @@ - ] - ], - 'jwplayer' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -165,7 +165,7 @@ - ] - ], - 'kickstarter' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -177,7 +177,7 @@ - ] - ], - 'mediacccde' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 660, - 'default_ratio' => 1.77777777777778, //(16 / 9), - 'https_enabled' => true, -@@ -189,7 +189,7 @@ - ] - ], - 'metacafe' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => false, -@@ -201,7 +201,7 @@ - ] - ], - 'nico' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.59609120521173, // (490 / 307) - 'https_enabled' => false, -@@ -213,7 +213,7 @@ - ] - ], - 'rutube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -225,7 +225,7 @@ - ] - ], - 'smashcast' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -237,7 +237,7 @@ - ] - ], - 'soundcloud' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 186, - 'default_ratio' => 2.66666, - 'https_enabled' => true, -@@ -246,7 +246,7 @@ - ] - ], - 'teachertube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.72972972972973, // (640 / 370) - 'https_enabled' => false, -@@ -258,7 +258,7 @@ - ] - ], - 'ted' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -270,7 +270,7 @@ - ] - ], - 'tubitv' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -282,7 +282,7 @@ - ] - ], - 'tudou' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -295,7 +295,7 @@ - ] - ], - 'tvpot' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -307,7 +307,7 @@ - ] - ], - 'twitch' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -319,7 +319,7 @@ - ] - ], - 'twitchclip' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -331,7 +331,7 @@ - ] - ], - 'twitchvod' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.64021164021164, // (620 / 378) - 'https_enabled' => false, -@@ -343,12 +343,12 @@ - ] - ], - 'videomaten' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_ratio' => 1.5, // (300 / 200) - 'https_enabled' => false - ], - 'vimeo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (640 / 360) - 'https_enabled' => true, -@@ -362,7 +362,7 @@ - 'oembed' => '%4$s//vimeo.com/api/oembed.json?url=%1$s&width=%2$d&maxwidth=%2$d' - ], - 'vine' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1, // (1 / 1) - 'https_enabled' => true, -@@ -374,7 +374,7 @@ - ] - ], - 'yahoo' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -386,7 +386,7 @@ - ] - ], - 'youtube' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -403,7 +403,7 @@ - ] - ], - 'youtubeplaylist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -415,7 +415,7 @@ - ] - ], - 'youtubevideolist' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.77777777777778, // (16 / 9) - 'https_enabled' => true, -@@ -427,7 +427,7 @@ - ] - ], - 'youku' => [ -- 'embed' => '', -+ 'embed' => '', - 'default_width' => 640, - 'default_ratio' => 1.6, - 'https_enabled' => false, -@@ -527,6 +527,13 @@ - private $urlArgs = false; - - /** -+ * Title for iframe. -+ * -+ * @var string -+ */ -+ private $iframeTitle = ""; -+ -+ /** - * Main Constructor - * - * @access private -@@ -554,6 +561,7 @@ - - /** - * return the service host map array -+ * - * @return array $serviceHostMap - */ - public static function getServiceHostMap() { -@@ -602,6 +610,7 @@ - htmlentities($this->getVideoID(), ENT_QUOTES), - $this->getWidth(), - $this->getHeight(), -+ $this->getIframeTitle(), - ]; - - if ($this->getExtraIds() !== false) { -@@ -723,6 +732,20 @@ - } - - /** -+ * Return the iframeTitle. -+ * -+ * @access public -+ * @return String, defaulting to message 'ev_default_play_desc' -+ */ -+ public function getIframeTitle() { -+ if($this->iframeTitle == "") { -+ return wfMessage('ev_default_play_desc')->text(); -+ } -+ -+ return $this->iframeTitle; -+ } -+ -+ /** - * Set the width of the player. This also will set the height automatically. - * Width will be automatically constrained to the minimum and maximum widths. - * -+++ ./i18n/en.json 2020-01-02 17:47:39.993265357 +0000 -@@ -18,5 +18,6 @@ - "ev_video_long_desc": "$1, $2 codec, length $3, $4x$5 pixels, $6 overall", - "ev_audio_short_desc": "$1", - "ev_audio_long_desc": "$1, $2 codec, length $3, $4 overall", -- "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1" -+ "error_embedvideo_cantdecode_evu": "Couldn't parse video from $1", -+ "ev_default_play_desc": "Play video" - } diff --git a/LoneStar2020/ansible/roles/mediawiki/files/Group-DecisionMakers.css b/LoneStar2020/ansible/roles/mediawiki/files/Group-DecisionMakers.css deleted file mode 100644 index a3e93949..00000000 --- a/LoneStar2020/ansible/roles/mediawiki/files/Group-DecisionMakers.css +++ /dev/null @@ -1,8 +0,0 @@ -#p-views ul li:not(.simplefavorite-icon):not(#ca-view):not(#ca-edit) { display:none!important; } -#p-cactions { display:none!important; } -#p-namespaces { display:none!important; } -#pt-mytalk { display:none!important; } -#pt-watchlist { display:none!important; } -#pt-mycontris { display:none!important; } -.mw-editsection { display:none!important; } -#p-tb { display:none!important; } diff --git a/LoneStar2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet b/LoneStar2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet deleted file mode 100644 index 3316ca20..00000000 --- a/LoneStar2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet +++ /dev/null @@ -1,196 +0,0 @@ -__NOTOC__ - -'''''Note:''''' This is an abridged version of the famous -[https://en.wikipedia.org/wiki/Help:Cheatsheet Wikipedia Syntax Cheat Sheet] --- try there if you don't see the markup codes you're looking for below. - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan=3 style="background:#E6F2FF; border-top:2px #a3b1bf solid;text-align:center;" | -'''Works anywhere in the text'''         -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|Italics, bold, and both -| -''italics'', '''bold''', and '''''both''''' -| -''italics'', '''bold''', and '''''both''''' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to another page -| -[[some page]]
-| -[[some page]]
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -"[[Wikipedia:Piped link|Pipe]]" a link to change the link's text -| -[[Android (operating system)|Android]] -| -[[Android (operating system)|Android]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -| -Link to a section -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -| -[[Frog#Locomotion]]
-[[Frog#Locomotion|locomotion in frogs]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Plain off-site URL -| -https://www.wikipedia.org -| -https://www.wikipedia.org -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to an off-site URL -| -[https://www.wikipedia.org] -| -[https://www.wikipedia.org] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link and link-text to an off-site URL -| -[https://www.wikipedia.org/ Wikipedia] -| -[https://www.wikipedia.org/ Wikipedia] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Signature -
''E.g., to sign your contributions when posting to a [[Wikipedia:Tutorial (Talk pages)|talk page]]''
-| -~~~~ -| -[[Special:Mypage|Username]] ([[Special:Mytalk|talk]]) {{CURRENTTIME}}, {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC) -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Strike some text -| -This text is conspicuously stricken. -| -This text is conspicuously stricken. -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Underline -| -This text is underlined -| -This text is underlined -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Picture tutorial|Show an image]] -| -[[File:Wiki.png|thumb|Caption]] -| -[[File:Wiki.png|thumb|Caption]] -
''If the image hasn't been uploaded, you'll just see its path as red text.''
-|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Add a page to a Category. -|[[Category:Cetaceans I Have Known]]

''best placed near the bottom of a page'' -|''shows'' "Cetaceans I Have Known" ''in a bar at bottom when the page is previewed or published'' -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Link to a [[Wikipedia:FAQ/Categories|category]] or [[Help:Files|file]] -|
[[:Category:Cetaceans I Have Known]]
[[:File:File name]] -|
[[:Category:Wikipedia basic information]]
[[:File:Example.jpg]] -|} - -
-
- -{|align="center" style="width:100%; border:2px #a3b1bf solid; background:#f5faff; text-align:left;" -|- -| colspan="3" style="background:#E6F2FF; border-top:2px #a3b1bf solid; text-align:center;" | '''Works only at the beginnings of lines'''     -|- style="background:#E6F2FF; padding:0.3em; font-size: 0.9em; text-align:center;" -| style="border-bottom:2px #a3b1bf solid" width="30%" | Description -| style="border-bottom:2px #a3b1bf solid" | You type -| style="border-bottom:2px #a3b1bf solid" width="30%" | You get -|- -|[[Wikipedia:Redirect|Redirect to another page]] -
''redirects must be placed at the start of the first line''
-| -#REDIRECT [[Target page]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|[[Wikipedia:Redirect|Redirect to a section of another page]] -| -#REDIRECT [[Target page#anchorName]] -| -[[File:Redirect arrow without text.svg|30px|link=]] [[Target page#anchorName]] -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Section headings
-
''a Table of Contents will automatically be generated when four headings are added to an article''
-| -==Level 2==
-===Level 3===
-====Level 4====
-=====Level 5=====
-======Level 6======

-''do not use''  =Level 1=  ''as it is for page titles'' -| - -==Level 2== -===Level 3=== -====Level 4==== -=====Level 5===== -======Level 6====== -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Bullet-point list (unnumbered list) -| -* One
-* Two
-** Two point one
-* Three -| -* One -* Two -** Two point one -* Three -|- -|colspan="3" style="border-top:1px solid #cee0f2;"| -|- -|Numbered list (enumerated list) -| -# One
-# Two
-## Two point one
-# Three -| -# One -# Two -## Two point one -# Three -|} diff --git a/LoneStar2020/ansible/roles/mediawiki/tasks/main.yml b/LoneStar2020/ansible/roles/mediawiki/tasks/main.yml deleted file mode 100644 index 45a48df9..00000000 --- a/LoneStar2020/ansible/roles/mediawiki/tasks/main.yml +++ /dev/null @@ -1,568 +0,0 @@ ---- - -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Install MW with Composer - command: composer install --no-dev - args: - chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Patch EmbedVideo - patch: - src: EmbedVideoIframeTitle.patch - basedir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/EmbedVideo-v2.8.0/" - -- name: Install PluggableAuth - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install SimpleSAML extension - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Install Collection - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout ActivityLog - git: - repo: https://github.com/OpenTechStrategies/ActivityLog - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" - version: 27e9191 - -- name: Checkout SimpleFavorites - git: - repo: https://github.com/OpenTechStrategies/SimpleFavorites - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/SimpleFavorites/" - version: 59fed33 - -- name: Checkout TeamComments - git: - repo: https://github.com/OpenTechStrategies/TeamComments - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TeamComments/" - version: 450bff7 - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - -- name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=mysql --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=LoneStar2020 --scriptpath=\"/LoneStar2020\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"LoneStar2020\" \"admin\"" - args: - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" - -- name: Enable PluggableAuth - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" - block: | - wfLoadExtension( 'PluggableAuth' ); - $wgPluggableAuth_EnableAutoLogin = true; - $wgPluggableAuth_EnableLocalLogin = true; - $wgPluggableAuth_EnableLocalProperties = false; - $wgPluggableAuth_ButtonLabel = "Log In Using MacArthur SSO"; - $wgInvalidUsernameCharacters = ""; - -- name: Enable SimpleSAMLphp extension - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" - block: | - wfLoadExtension( 'SimpleSAMLphp' ); - $wgSimpleSAMLphp_SyncAllGroups_LocallyManaged = ["sysop", "DecisionMakers"]; - $wgSimpleSAMLphp_InstallDir = '{{ simplesaml_install_directory }}/simplesamlphp-1.18.4'; - $wgSimpleSAMLphp_AuthSourceId = '{{ simplesaml_okta_metadata_name }}'; - $wgSimpleSAMLphp_RealNameAttribute = ['firstName', 'lastName']; - $wgSimpleSAMLphp_EmailAttribute = 'email'; - $wgSimpleSAMLphp_UsernameAttribute = 'username'; - $wgSimpleSAMLphp_GroupMap = [ - 'sysop' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], - 'DecisionMakers' => ['groups' => ['LFC Decision Makers']] - ]; - - $wgSimpleSAMLphp_SyncAllGroups_GroupNameModificationCallback = function($origGroupName){ - # Remove spaces - return preg_replace('/\s/', '', $origGroupName); - }; - $wgSimpleSAMLphp_AttributeProcessorFactories = [ - "MediaWiki\\Extension\\SimpleSAMLphp\\AttributeProcessor\\SyncAllGroups::factory" - ]; - -- name: Enable Collection - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE COLLECTION CONFIG" - block: | - require_once "$IP/extensions/Collection/Collection.php"; - $wgCollectionMWServeURL = "http://127.0.0.1:8899"; - $wgCollectionMaxArticles = 250; - $wgEnableApi = true; - $wgCollectionFormats = array( 'rl' => 'PDF',); - $wgCollectionPortletFormats = []; - $wgCollectionDisableDownloadSection = false; - $wgHooks['ApiBeforeMain'][] = function($main) { - global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; - if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { - $wgTorqueDataConnectRenderToHTML = false; - $tdcinfo = $main->getRequest()->getText("tdcinfo", false); - list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); - } - }; - $wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { - global $wgCollectionMWServeCredentials; - $group = TorqueDataConnectConfig::getValidGroup($user); - $view = TorqueDataConnectConfig::getCurrentView(); - $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; - }; - -- name: Enable TorqueDataConnect - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" - block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectSheetName = "LoneStar2020"; - $wgTorqueDataConnectWikiKey = "LoneStar2020"; - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - wfLoadExtension('TorqueDataConnect'); - -- name: Enable SimpleFavorites - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('SimpleFavorites');" - -- name: Enable TeamComments - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TEAMCOMMENTS CONFIG" - block: | - wfLoadExtension('TeamComments'); - $wgTeamCommentsCheatSheetLocation = "Wiki_Markup_Cheat_Sheet"; - $wgTeamCommentsUserPseudonymizer = function($username) { - return "Pseudonymous User #" . TorqueDataConnectUserLookup::lookupByUsername($username)->{"id"}; - }; - -- name: Enable Uploading - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} UPLOAD CONFIG" - block: | - $wgEnableUploads = true; - $wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'docx', 'html', 'pdf', 'xlsx')); - $wgFileBlacklist = array(); - $wgMimeTypeBlacklist = array(); - $wgStrictFileExtensions = false; - $wgTrustedMediaFormats = array('application/zip', 'text/html'); - $wgVerifyMimeType = false; - $wgAllowJavaUploads = true; - $wgCheckFileExtensions = false; - $wgGroupPermissions['bot']['edit'] = true; - $wgGroupPermissions['bot']['upload'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - $wgGroupPermissions['autoconfirmed']['reupload'] = true; - -- name: Set TOC depth - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMaxTocLevel = 2; - -- name: Disable Collection Warning 1 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Disable Collection Warning 2 - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" - regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' - replace: '#\1' - -- name: Remove Collection Book Text - replace: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" - regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' - replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' - -- name: Install ActivityLog Configuration - copy: - src: ActivityLogConfiguration - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - -- name: Enable ActivityLog - blockinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" - block: | - wfLoadExtension('ActivityLog'); - $wgMessagesDirs['ActivityLogConfiguration'] = 'ActivityLogConfiguration/i18n'; - $wgActivityLogHooksToWatch["ArticleViewHeader"] = function ($article) { - $referrer = $_SERVER['HTTP_REFERER']; - $ourServer = "http://torque.leverforchange.org"; - - if($referrer && $ourServer == substr($referrer, 0, strlen($ourServer))) { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader-with-referrer", - $_SERVER['HTTP_REFERER'] - ); - } else { - return array($article->getContext()->getUser(), - $article->getTitle(), - "activitylog-articleviewheader" - ); - } - }; - - $wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { - global $wgTitle; - return array($user, $wgTitle, "activitylog-userlogin"); - }; - - $wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { - return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); - }; - -- name: Disable MediaWiki Cache - # When the cache is enabled, on AWS, with the default setting, - # the following createAndPromote.php command fails due to cache timeout. - # The reason isn't clear, but for now, this will fix it. - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: $wgMainCacheType = CACHE_NONE; - -- name: Create mwlib user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" - -- name: Create csv2wiki user - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" - -- name: Set Group Permissions - blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgGroupPermissions['*']['read'] = false; - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - - # Permissions that we want sysops/admins to have that - # but not for staff go here - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-edit'] = true; - - # Groups requested specifically by LFC. - $wgGroupPermissions['LFCResearchPartners']['read'] = true; - $wgGroupPermissions['LFCEvaluators']['read'] = true; - - # These are OTS Torque Standard Groups - $wgGroupPermissions['OutsideReviewers']['read'] = true; - $wgGroupPermissions['Staff']['read'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['read'] = true; - $wgGroupPermissions['DecisionMakers']['read'] = true; - - # Disable teamcomments for users on this wiki by default. - $wgGroupPermissions['*']['teamcomment'] = false; - $wgGroupPermissions['*']['teamcommentseeusernames'] = false; - - # Then enable teamcomments for the groups that should be leaving comments - $wgGroupPermissions['Staff']['teamcomment'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['teamcomment'] = true; - $wgGroupPermissions['DecisionMakers']['teamcomment'] = false; - $wgGroupPermissions['sysop']['teamcomment'] = true; - $wgGroupPermissions['LFCResearchPartners']['teamcomment'] = true; - $wgGroupPermissions['LFCEvaluators']['teamcomment'] = true; - - # Allow some groups to see usernames - $wgGroupPermissions['Staff']['teamcommentseeusernames'] = true; - $wgGroupPermissions['PseudoDecisionMakers']['teamcommentseeusernames'] = true; - $wgGroupPermissions['DecisionMakers']['teamcommentseeusernames'] = true; - $wgGroupPermissions['sysop']['teamcommentseeusernames'] = true; - - # Log permissions (ability to see Special:Log) - $wgAvailableRights[] = 'view-special-log'; - $wgGroupPermissions['*']['view-special-log'] = false; - $wgGroupPermissions['sysop']['view-special-log'] = true; - - -- name: Create LFC Evaluator page rule - blockinfile: - marker: "## {mark} ANSIBLE LFC EVALUATOR CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SkinTemplateNavigation'][] = function ( $template, &$links ) { - $currentTitle = $template->getTitle()->getFullText(); - $lfc_prepend = "LFC Analysis of "; - $eval_prepend = "Evaluations of "; - - $isAnalysisPage = (strlen($currentTitle) > strlen($lfc_prepend) && substr($currentTitle, 0, strlen($lfc_prepend)) === $lfc_prepend); - $isEvalPage = (strlen($currentTitle) > strlen($eval_prepend) && substr($currentTitle, 0, strlen($eval_prepend)) === $eval_prepend); - - $originalPageTitle = $currentTitle; - if($isAnalysisPage) { - $originalPageTitle = substr($currentTitle, strlen($lfc_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } else if($isEvalPage) { - $originalPageTitle = substr($currentTitle, strlen($eval_prepend)); - $links['namespaces']['main']['class'] = ''; - $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); - } - $lfcAnalysisTitle = Title::newFromText($lfc_prepend . $originalPageTitle); - $evalTitle = Title::newFromText($eval_prepend . $originalPageTitle); - if($isAnalysisPage || $lfcAnalysisTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['lfcanalysis'] = [ - 'class' => ($isAnalysisPage ? 'selected' : ''), - 'href' => ($isAnalysisPage ? $template->getTitle()->getLocalUrl() : $lfcAnalysisTitle->getLocalUrl()), - 'text' => 'LFC Analysis', - ]; - } - if($isEvalPage || $evalTitle->exists()) { - $links['namespaces']['main']['text'] = 'Proposal'; - $links['namespaces']['evaluations'] = [ - 'class' => ($isEvalPage ? 'selected' : ''), - 'href' => ($isEvalPage ? $template->getTitle()->getLocalUrl() : $evalTitle->getLocalUrl()), - 'text' => 'Evaluations', - ]; - } - - unset($links['namespaces']['talk']); - }; - - -- name: Disable Special:Log for groups that don't have view-special-log - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['SpecialPage_initList'][] = function ( &$list ) { - global $wgUser; - - if(!$wgUser->isAllowed('view-special-log')) { - unset( $list['Log'] ); - } - return true; - }; - -- name: Create Special:Log name overrides - blockinfile: - marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTitlesOverrideMessages = [ - "picksomelogpage" => "Selection", - "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", - "simplefavoriteslog" => "Favorites", - "log-name-create" => "Page Creation", - "movelogpage" => "Page Rename", - "uploadlogpage" => "File Upload", - "dellogpage" => "Page Deletion", - "newuserlogpage" => "User Creation", - "log-name-teamcomments" => "Comments", - "torquedataconnect-apiaccesslog" => "API Accesses", - "torquedataconnect-datachangeslog" => "Data Changes", - "rightslog" => "Changes to Access Control / Permissions" - ]; - - $wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { - global $logTitlesOverrideMessages; - if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { - $message = $logTitlesOverrideMessages[strtolower($title)]; - } - }; - -- name: Disable Special:Log types that aren't of interest - blockinfile: - marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; - - $wgHooks['SetupAfterCache'][] = function () { - global $wgLogTypes, $logTypesBlacklist; - foreach($logTypesBlacklist as $logType) { - unset($wgLogTypes[array_search($logType, $wgLogTypes)]); - } - - return true; - }; - -- name: Change Special:Log format slightly - blockinfile: - marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - # This is a little brittle, based on how the lines are rendered by the skin currently used - # but should work for the foreseeable future. - $wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ - $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); - }; - -- name: Rearrange Login Page - blockinfile: - marker: "## {mark} ANSIBLE CHANGE LOGIN ORDERING" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgHooks['AuthChangeFormFields'][] = function ($requests, $fieldInfo, &$formDescriptor, $action) { - if($action != \MediaWiki\Auth\AuthManager::ACTION_LOGIN) { - return; - } - - $formDescriptor['username']['weight'] = 200; - $formDescriptor['password']['weight'] = 201; - $formDescriptor['rememberMe']['weight'] = 202; - $formDescriptor['loginattempt']['weight'] = 203; - $formDescriptor['break'] = [ - 'type' => 'info', - 'weight' => 150, - 'cssclass' => 'mw-htmlform-login-or', - 'default' => "or" - ]; - - unset($formDescriptor['linkcontainer']); - unset($formDescriptor['passwordReset']); - unset($formDescriptor['createOrLogin']); - - if ( isset( $formDescriptor['pluggableauthlogin'] ) ) { - $formDescriptor['pluggableauthlogin']['weight'] = -1; - } - }; - -- name: Enable Common.css on Login Page - blockinfile: - marker: "## {mark} ANSIBLE ENABLE CSS ON LOGIN" - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - block: | - $wgAllowSiteCSSOnRestrictedPages = true; - -- name: Transfer LoneStar Logo - copy: - src: LoneStar_Logo.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/LoneStar_Logo.png" - -- name: Install LoneStar Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/LoneStar_Logo.png"; - -- name: Transfer Common group css - copy: - src: Common.css - dest: "{{ mediawiki_install_directory }}/Common.css" - -- name: Install Common group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" - -- name: Remove Common group css - file: - path: "{{ mediawiki_install_directory }}/Common.css" - state: absent - -- name: Transfer DecisionMakers group css - copy: - src: Group-DecisionMakers.css - dest: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" - -- name: Install DecisionMakers group css - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Group-{{ item }}.css < {{ mediawiki_install_directory }}/Group-DecisionMakers.css" - loop: - - PseudoDecisionMakers - - DecisionMakers - - LFCEvaluators - - LFCResearchPartners - -- name: Remove DecisionMakers group css - file: - path: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" - state: absent - -- name: Transfer htaccess - copy: - src: .htaccess - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" - -- name: Transfer wiki cheat sheet - copy: - src: Wiki_Markup_Cheat_Sheet - dest: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Install wiki cheat sheet - raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b Wiki_Markup_Cheat_Sheet < {{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - -- name: Transfer wiki cheat sheet - file: - path: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" - state: absent - -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" - -# Handle Apache changes -- name: Symlink to webserver directory - become_user: root - file: - state: link - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/LoneStar2020" - -- name: Set permissions on attachments directory - become_user: root - file: - path: "{{ html_directory }}/LoneStar2020/images" - owner: www-data - group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted diff --git a/LoneStar2020/ansible/roles/simplesaml/tasks/main.yml b/LoneStar2020/ansible/roles/simplesaml/tasks/main.yml deleted file mode 100644 index 6c0c7fd3..00000000 --- a/LoneStar2020/ansible/roles/simplesaml/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Add okta account to autoconfig - lineinfile: - path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" - insertafter: '\$metadata_url_for = array\(' - line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," diff --git a/README.md b/README.md index 1602eb08..dc8e98cb 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,9 @@ Each subdirectory falls into one of three categories: 1. A support system for torque-sites 2. Generalized ETL Pipeline -3. Supporting files -4. A site (competition) +3. Centralized set of ansible roles for competitions +4. Supporting files +5. A site (competition) Because each adheres to the standards set out in these top level documents, most of the information needed is here. However, each @@ -62,6 +63,18 @@ information on how to get it installed on your system. The individual competitions etl pipelines are mainly configurations on this package. +### Centralized set of ansible roles + +This contains all the roles that are used in multiple competitions. Each +competition can include these roles in their top level `.yml` file, and then +add on their own customizations after as needed. Generally, these roles +should be included before customizations, and there may be an order that +they need to be run in in order to run correctly (for example, mediawiki +must be run before a role installing an extension). + +See [INSTALL.md](INSTALL.md) for more information on how to configure your +system to pick up these roles. + ### Supporting files These directories have some general files, usually downloaded from diff --git a/mwlib/ansible/mwlib.retry b/mwlib/ansible/mwlib.retry deleted file mode 100644 index 2fbb50c4..00000000 --- a/mwlib/ansible/mwlib.retry +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/100Change2017/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json b/roles/activitylog/files/ActivityLogConfiguration/i18n/en.json similarity index 100% rename from 100Change2017/ansible/roles/mediawiki/files/ActivityLogConfiguration/i18n/en.json rename to roles/activitylog/files/ActivityLogConfiguration/i18n/en.json diff --git a/roles/activitylog/files/activity-log.php b/roles/activitylog/files/activity-log.php new file mode 100644 index 00000000..28181260 --- /dev/null +++ b/roles/activitylog/files/activity-log.php @@ -0,0 +1,30 @@ +getContext()->getUser(), + $article->getTitle(), + "activitylog-articleviewheader-with-referrer", + $_SERVER['HTTP_REFERER'] + ); + } else { + return array($article->getContext()->getUser(), + $article->getTitle(), + "activitylog-articleviewheader" + ); + } +}; + +$wgActivityLogHooksToWatch["UserLoginComplete"] = function(&$user, &$inject_html, $direct) { + global $wgTitle; + return array($user, $wgTitle, "activitylog-userlogin"); +}; + +$wgActivityLogHooksToWatch["PageContentSave"] = function($wikiPage, $user, $content, &$summary, $isMinor, $isWatch, $section, $flags, $status) { + return array($user, $wikiPage->getTitle(), "activitylog-articlesavepage"); +}; +?> diff --git a/roles/activitylog/tasks/main.yml b/roles/activitylog/tasks/main.yml new file mode 100644 index 00000000..f2ba3fa3 --- /dev/null +++ b/roles/activitylog/tasks/main.yml @@ -0,0 +1,24 @@ +--- + +- name: Check out ActivityLog + git: + repo: https://github.com/OpenTechStrategies/ActivityLog + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/ActivityLog/" + version: 27e9191 + +- name: Install ActivityLog Configuration + copy: + src: ActivityLogConfiguration + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" + +- name: Transfer Config + copy: + src: activity-log.php + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/" + +- name: Enable ActivityLog + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE ACTIVITYLOG CONFIG" + block: | + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/activity-log.php"; diff --git a/roles/collection/tasks/main.yml b/roles/collection/tasks/main.yml new file mode 100644 index 00000000..e8524c0e --- /dev/null +++ b/roles/collection/tasks/main.yml @@ -0,0 +1,37 @@ +--- + +- name: Install Collection + unarchive: + src: "{{ playbook_dir }}/../../thirdparty/extensions/Collection-REL1_33-8566dd1.tar.gz" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" + +- name: Transfer Config + template: + src: collection.php.j2 + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/collection.php" + +- name: Enable Collection + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE COLLECTION CONFIG" + block: | + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/collection.php"; + +- name: Disable Collection Warning 1 + replace: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/Collection.body.php" + regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' + replace: '#\1' + +- name: Disable Collection Warning 2 + replace: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/templates/CollectionPageTemplate.php" + regexp: '^(\t.*MessageBoxHelper::renderWarningBoxes.*)$' + replace: '#\1' + +- name: Remove Collection Book Text + replace: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/Collection/i18n/en.json" + regexp: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats \(for example PDF or ODF\) or order a printed copy.",' + replace: '\t"coll-book_creator_intro": "With the ''''book creator'''' you can create a book containing wiki pages of your choice. You can export the book in different formats (for example PDF or ODF).",' + diff --git a/roles/collection/templates/collection.php.j2 b/roles/collection/templates/collection.php.j2 new file mode 100644 index 00000000..15707e78 --- /dev/null +++ b/roles/collection/templates/collection.php.j2 @@ -0,0 +1,23 @@ + 'PDF',); +$wgCollectionPortletFormats = []; +$wgCollectionDisableDownloadSection = false; +$wgHooks['ApiBeforeMain'][] = function($main) { + global $wgTorqueDataConnectGroup, $wgTorqueDataConnectRenderToHTML, $wgTorqueDataConnectView; + if($main->getUser() && strtolower($main->getUser()->getName()) == "{{ mediawiki_mwlib_username }}") { + $wgTorqueDataConnectRenderToHTML = false; + $tdcinfo = $main->getRequest()->getText("tdcinfo", false); + list($wgTorqueDataConnectGroup, $wgTorqueDataConnectView) = explode("|", $tdcinfo); + } +}; +$wgHooks['BeforeInitialize'][] = function(&$title, &$article = null, &$output, &$user, $request, $mediaWiki) { + global $wgCollectionMWServeCredentials; + $group = TorqueDataConnectConfig::getValidGroup($user); + $view = TorqueDataConnectConfig::getCurrentView(); + $wgCollectionMWServeCredentials = "{{ mediawiki_mwlib_username }}:${group}|${view}:{{ mediawiki_mwlib_password }}"; +}; +?> diff --git a/100Change2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch b/roles/embed_video/files/EmbedVideoIframeTitle.patch similarity index 100% rename from 100Change2020/ansible/roles/mediawiki/files/EmbedVideoIframeTitle.patch rename to roles/embed_video/files/EmbedVideoIframeTitle.patch diff --git a/roles/embed_video/tasks/main.yml b/roles/embed_video/tasks/main.yml new file mode 100644 index 00000000..b28f2e83 --- /dev/null +++ b/roles/embed_video/tasks/main.yml @@ -0,0 +1,16 @@ +--- + +- name: Install EmbedVideo + unarchive: + src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" + +- name: Patch EmbedVideo + patch: + src: EmbedVideoIframeTitle.patch + basedir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/EmbedVideo-v2.8.0/" + +- name: Enable EmbedVideo + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + line: "wfLoadExtension('EmbedVideo-v2.8.0');" diff --git a/roles/finishmediawiki/tasks/main.yml b/roles/finishmediawiki/tasks/main.yml new file mode 100644 index 00000000..e9e2d81c --- /dev/null +++ b/roles/finishmediawiki/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +# This should come near the end to make sure that all the database updates +# for the extensions get run after the rest of the system is set up. +- name: Run mediawiki updates + command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" + +- name: Restart Apache + become_user: root + service: + name: apache2 + state: restarted diff --git a/LLIIA2020/ansible/roles/mediawiki/files/.htaccess b/roles/mediawiki/files/.htaccess similarity index 100% rename from LLIIA2020/ansible/roles/mediawiki/files/.htaccess rename to roles/mediawiki/files/.htaccess diff --git a/LoneStar2020/ansible/roles/mediawiki/files/Common.css b/roles/mediawiki/files/Common.css similarity index 66% rename from LoneStar2020/ansible/roles/mediawiki/files/Common.css rename to roles/mediawiki/files/Common.css index b3a90dc2..3c7d9ac8 100644 --- a/LoneStar2020/ansible/roles/mediawiki/files/Common.css +++ b/roles/mediawiki/files/Common.css @@ -25,37 +25,37 @@ margin:auto 0.25em; } @media print { -.firstHeading { - display:none; -} -.torque-edit { - display:none; -} -table { - font-size:8pt; -} -div { - font-size:8pt; -} -p { - font-size:8pt; -} -ul { - font-size:8pt; -} -.footer-info { - display:none; -} -.printfooter { - display:none; -} -#footer { - display:none; -} -table { + .firstHeading { + display:none; + } + .torque-edit { + display:none; + } + table { + font-size:8pt; + } + div { + font-size:8pt; + } + p { + font-size:8pt; + } + ul { + font-size:8pt; + } + .footer-info { + display:none; + } + .printfooter { + display:none; + } + #footer { + display:none; + } + table { page-break-inside:avoid; -} -tr { + } + tr { page-break-inside:avoid; -} + } } diff --git a/100Change2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet b/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet similarity index 100% rename from 100Change2020/ansible/roles/mediawiki/files/Wiki_Markup_Cheat_Sheet rename to roles/mediawiki/files/Wiki_Markup_Cheat_Sheet diff --git a/roles/mediawiki/files/lfc-analysis-rule.php b/roles/mediawiki/files/lfc-analysis-rule.php new file mode 100644 index 00000000..22987c77 --- /dev/null +++ b/roles/mediawiki/files/lfc-analysis-rule.php @@ -0,0 +1,61 @@ +getTitle()->getFullText(); + + # There's a codependency with the ETL pipelines that these pages actually + # need to exist on the wiki. + $lfc_prepend = "LFC Analysis of "; + $eval_prepend = "Evaluations of "; + + $isAnalysisPage = (strlen($currentTitle) > strlen($lfc_prepend) && substr($currentTitle, 0, strlen($lfc_prepend)) === $lfc_prepend); + $isEvalPage = (strlen($currentTitle) > strlen($eval_prepend) && substr($currentTitle, 0, strlen($eval_prepend)) === $eval_prepend); + + $originalPageTitle = $currentTitle; + + # If we're on the analysis page, or the evaluation page, then the main page + # should be the original proposal. If we didn't have this, the main page would be + # the page we're looking at, even with we're on the Analysis Page/Evaluations Page. + if($isAnalysisPage) { + $originalPageTitle = substr($currentTitle, strlen($lfc_prepend)); + $links['namespaces']['main']['class'] = ''; + $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); + } else if($isEvalPage) { + $originalPageTitle = substr($currentTitle, strlen($eval_prepend)); + $links['namespaces']['main']['class'] = ''; + $links['namespaces']['main']['href'] = Title::newFromText($originalPageTitle)->getLocalUrl(); + } + $lfcAnalysisTitle = Title::newFromText($lfc_prepend . $originalPageTitle); + $evalTitle = Title::newFromText($eval_prepend . $originalPageTitle); + + # If we're on the Analysis page, then we shouldn't add another analysis page for the analysis + # page were on. Visually, we should be on the tab, with the left tab being the proposal + if($isAnalysisPage || $lfcAnalysisTitle->exists()) { + $links['namespaces']['main']['text'] = 'Proposal'; + $links['namespaces']['lfcanalysis'] = [ + 'class' => ($isAnalysisPage ? 'selected' : ''), + 'href' => ($isAnalysisPage ? $template->getTitle()->getLocalUrl() : $lfcAnalysisTitle->getLocalUrl()), + 'text' => 'LFC Analysis', + ]; + } + + # Same as above, but with Evaluations + if($isEvalPage || $evalTitle->exists()) { + $links['namespaces']['main']['text'] = 'Proposal'; + $links['namespaces']['evaluations'] = [ + 'class' => ($isEvalPage ? 'selected' : ''), + 'href' => ($isEvalPage ? $template->getTitle()->getLocalUrl() : $evalTitle->getLocalUrl()), + 'text' => 'Evaluations', + ]; + } + + # Remove the talk tab, even if the talk page exists + unset($links['namespaces']['talk']); +}; +?> diff --git a/roles/mediawiki/files/special-log.php b/roles/mediawiki/files/special-log.php new file mode 100644 index 00000000..f20356ee --- /dev/null +++ b/roles/mediawiki/files/special-log.php @@ -0,0 +1,46 @@ + "Selection", + "activitylogpage" => "Misc. Activity (page views, login, logout, etc)", + "simplefavoriteslog" => "Favorites", + "log-name-create" => "Page Creation", + "movelogpage" => "Page Rename", + "uploadlogpage" => "File Upload", + "dellogpage" => "Page Deletion", + "newuserlogpage" => "User Creation", + "log-name-teamcomments" => "Comments", + "torquedataconnect-apiaccesslog" => "API Accesses", + "torquedataconnect-datachangeslog" => "Data Changes", + "rightslog" => "Changes to Access Control / Permissions" +]; + +$wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { + global $logTitlesOverrideMessages; + if(array_key_exists(strtolower($title), $logTitlesOverrideMessages)) { + $message = $logTitlesOverrideMessages[strtolower($title)]; + } +}; + + +# Remove log types that we don't want +$logTypesBlacklist = ["block", "contentmodel", "import", "managetags", "merge", "patrol", "protect", "rights", "tag"]; + +$wgHooks['SetupAfterCache'][] = function () { + global $wgLogTypes, $logTypesBlacklist; + foreach($logTypesBlacklist as $logType) { + unset($wgLogTypes[array_search($logType, $wgLogTypes)]); + } + + return true; +}; + +# Change the log format a little +# +# This is a little brittle, based on how the lines are rendered by the skin currently used +# but should work for the foreseeable future. +$wgHooks['LogEventsListLineEnding'][] = function ($page, &$line, &$entry, &$classes, &$attribs){ + $line = preg_replace('/(\d\d\d\d)/', '\1 —', $line, 1); +}; +?> diff --git a/roles/mediawiki/files/upload-config.php b/roles/mediawiki/files/upload-config.php new file mode 100644 index 00000000..2eb611e4 --- /dev/null +++ b/roles/mediawiki/files/upload-config.php @@ -0,0 +1,15 @@ + diff --git a/100Change2017Partners/ansible/roles/mediawiki/tasks/main.yml b/roles/mediawiki/tasks/main.yml similarity index 50% rename from 100Change2017Partners/ansible/roles/mediawiki/tasks/main.yml rename to roles/mediawiki/tasks/main.yml index 7bb5b47f..fc13fe55 100644 --- a/100Change2017Partners/ansible/roles/mediawiki/tasks/main.yml +++ b/roles/mediawiki/tasks/main.yml @@ -1,11 +1,4 @@ --- - -- name: Add php repository - Ubuntu - become_user: root - apt_repository: - repo: ppa:ondrej/php - when: ansible_distribution == 'Ubuntu' - - name: install prerequisites become_user: root # See https://www.mediawiki.org/wiki/Manual:Installation_requirements @@ -26,24 +19,6 @@ - php-xml - unzip -- name: Setup installation directory - file: - path: "{{ mediawiki_install_directory }}" - state: directory - -- name: Download MediaWiki - get_url: - url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 - -- name: Extract MediaWiki tarball - unarchive: - src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" - dest: "{{ mediawiki_install_directory }}/" - remote_src: yes - creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" - - name: Enable PHP modules become_user: root shell: phpenmod {{ item }} @@ -56,7 +31,7 @@ get_url: url: https://getcomposer.org/installer dest: "{{ mediawiki_install_directory }}/composer-setup.php" - checksum: "sha384:795f976fe0ebd8b75f26a6dd68f78fd3453ce79f32ecb33e7fd087d39bfeb978342fb73ac986cd4f54edd0dc902601dc" + checksum: "sha384:c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394" - name: Make wiki bin directory file: @@ -64,7 +39,7 @@ state: directory - name: Install Composer locally - shell: php {{ mediawiki_install_directory }}/composer-setup.php --install-dir={{ mediawiki_install_directory }}/bin --filename=composer + shell: php {{ mediawiki_install_directory }}/composer-setup.php --version=1.10.16 --install-dir={{ mediawiki_install_directory }}/bin --filename=composer - name: Remove Composer setup script file: @@ -75,53 +50,81 @@ become_user: root shell: mv {{ mediawiki_install_directory }}/bin/composer /usr/local/bin/composer +- name: Setup installation directory + file: + path: "{{ mediawiki_install_directory }}" + state: directory + +- name: Download MediaWiki + get_url: + url: https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" + checksum: sha256:8335a2d8740c5dd5919a480b74c3d8e19f23a68b396df48c2d77646272fdcd67 + +- name: Extract MediaWiki tarball + unarchive: + src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0.tar.gz" + dest: "{{ mediawiki_install_directory }}/" + remote_src: yes + creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/" + - name: Install MW with Composer command: composer install --no-dev args: chdir: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" -- name: Install EmbedVideo - unarchive: - src: "{{ playbook_dir }}/../../thirdparty/extensions/EmbedVideo-v2.8.0.zip" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" - -- name: Checkout Torque - git: - repo: https://github.com/OpenTechStrategies/torque - dest: "{{ mediawiki_install_directory }}/torque/" - version: 16468ec - -- name: Link TorqueDataConnect - file: - src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" - state: link - - name: Create Wiki - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=postgres --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname=100Change2017Partners --scriptpath=\"/100Change2017Partners\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"100Change2017Partners\" \"admin\"" + command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/install.php --dbtype=mysql --dbserver=localhost --dbuser=wikiuser --dbpass=\"{{ db_password }}\" --dbname={{ competition_name }} --scriptpath=\"/{{ competition_name }}\" --lang=en --pass=\"{{ mediawiki_admin_password }}\" \"{{ competition_name }}\" \"admin\"" args: creates: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" -- name: Enable EmbedVideo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - line: "wfLoadExtension('EmbedVideo-v2.8.0');" +- name: Create competition configuration directory + file: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/" + state: directory + +- name: Transfer Configs + copy: + src: "{{ item }}" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/" + loop: + - upload-config.php + - lfc-analysis-rule.php + - special-log.php -- name: Enable TorqueDataConnect +- name: Enable Configs blockinfile: path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" + marker: "## {mark} CONFIGS" block: | - define("TORQUE_CONFIG", 4000); - define("TORQUE_CONFIG_TALK", 4001); - $wgExtraNamespaces[TORQUE_CONFIG] = "TorqueConfig"; - $wgExtraNamespaces[TORQUE_CONFIG_TALK] = "TorqueConfig_talk"; - $wgNamespaceProtection[TORQUE_CONFIG] = array("edittorqueconfig"); - $wgTorqueDataConnectConfigPage = "TorqueConfig:MainConfig"; - $wgTorqueDataConnectNotFoundMessage = "This proposal has been disqualified in admin, peer, or expert review."; - $wgTorqueDataConnectWikiKey = "100Change2017Partners"; - $wgTorqueDataConnectSheetName = "LFC100Change2017"; - wfLoadExtension('TorqueDataConnect'); + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/upload-config.php"; + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/lfc-analysis-rule.php"; + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/special-log.php"; + +- name: Remove Old Upload Config + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} UPLOAD CONFIG" + +- name: Remove Old LFC Analysis page rule + blockinfile: + marker: "## {mark} ANSIBLE LFC EVALUATOR CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + +- name: Remove Old Special:Log name overrides + blockinfile: + marker: "## {mark} ANSIBLE SPECIAL LOG NAME OVERRIDES CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + +- name: Remove Old Special:Log types that aren't of interest + blockinfile: + marker: "## {mark} ANSIBLE DISABLE SPECIAL LOG TYPES CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + +- name: Remove Old Special:Log format slightly + blockinfile: + marker: "## {mark} ANSIBLE CHANGE SPECIAL LOG FORMAT CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - name: Set TOC depth lineinfile: @@ -136,55 +139,49 @@ path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" line: $wgMainCacheType = CACHE_NONE; +- name: Create mwlib user + command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_mwlib_username }}\" \"{{ mediawiki_mwlib_password }}\"" + - name: Create csv2wiki user command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/createAndPromote.php --bot --force --dbuser=wikiuser --dbpass=\"{{ db_password }}\" \"{{ mediawiki_csv2wiki_username }}\" \"{{ mediawiki_csv2wiki_password }}\"" -- name: Set Group Permissions +- name: Enable Common.css on Login Page blockinfile: - marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" + marker: "## {mark} ANSIBLE ENABLE CSS ON LOGIN" path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" block: | - $wgGroupPermissions['*']['read'] = false; - $wgGroupPermissions['Staff']['read'] = true; - - foreach($wgGroupPermissions['sysop'] as $key => $value) { - $wgGroupPermissions['LFCTorque'][$key] = $value; - } - - $wgGroupPermissions['bot']['protect'] = true; - $wgRestrictionLevels[] = 'generated'; - $wgGroupPermissions['bot']['generated'] = true; - $wgGroupPermissions['bot']['torquedataconnect-admin'] = true; - - # Permissions that we want sysops/admins to have that - # but not for staff go here - $wgGroupPermissions['sysop']['generated'] = true; - $wgGroupPermissions['sysop']['edittorqueconfig'] = true; - $wgGroupPermissions['sysop']['torquedataconnect-admin'] = true; - foreach($wgGroupPermissions['sysop'] as $key => $value) { - $wgGroupPermissions['LFCTorqueAdmin'][$key] = $value; - } - -- name: Transfer LFC Logo + $wgAllowSiteCSSOnRestrictedPages = true; + +- name: Transfer Common group css copy: - src: 100Change-logo150.png - dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/resources/assets/100Change-logo150.png" + src: Common.css + dest: "{{ mediawiki_install_directory }}/Common.css" -- name: Install LFC Logo - lineinfile: - path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" - regexp: ^\$wgLogo = .* - line: $wgLogo = "$wgResourceBasePath/resources/assets/100Change-logo150.png"; +- name: Install Common group css + raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Common.css < {{ mediawiki_install_directory }}/Common.css" + +- name: Remove Common group css + file: + path: "{{ mediawiki_install_directory }}/Common.css" + state: absent - name: Transfer htaccess copy: src: .htaccess dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/.htaccess" -# This should come near the end to make sure that all the database updates -# for the extensions get run after the rest of the system is set up. -- name: Run mediawiki updates - command: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/update.php" +- name: Transfer wiki cheat sheet + copy: + src: Wiki_Markup_Cheat_Sheet + dest: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" + +- name: Install wiki cheat sheet + raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b Wiki_Markup_Cheat_Sheet < {{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" + +- name: Transfer wiki cheat sheet + file: + path: "{{ mediawiki_install_directory }}/Wiki_Markup_Cheat_Sheet" + state: absent # Handle Apache changes - name: Symlink to webserver directory @@ -192,17 +189,11 @@ file: state: link src: "{{ mediawiki_install_directory }}/mediawiki-1.33.0" - path: "{{ html_directory }}/100Change2017Partners" + path: "{{ html_directory }}/{{ competition_name }}" - name: Set permissions on attachments directory become_user: root file: - path: "{{ html_directory }}/100Change2017Partners/images/" + path: "{{ html_directory }}/{{ competition_name }}/images" owner: www-data group: www-data - -- name: Restart Apache - become_user: root - service: - name: apache2 - state: restarted diff --git a/100Change2020/ansible/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml similarity index 100% rename from 100Change2020/ansible/roles/mysql/tasks/main.yml rename to roles/mysql/tasks/main.yml diff --git a/Climate2030/ansible/roles/mediawiki/files/Group-DecisionMakers.css b/roles/permissions/files/Group-DecisionMakers.css similarity index 100% rename from Climate2030/ansible/roles/mediawiki/files/Group-DecisionMakers.css rename to roles/permissions/files/Group-DecisionMakers.css diff --git a/roles/permissions/files/default-permissions.php b/roles/permissions/files/default-permissions.php new file mode 100644 index 00000000..a1ef828a --- /dev/null +++ b/roles/permissions/files/default-permissions.php @@ -0,0 +1,85 @@ +isAllowed('view-special-log')) { + unset( $list['Log'] ); + } + return true; +}; + +# This is the SimpleSAMLphp group mapping. This is how incoming groups +# from SSO map to mediawiki groups. +$wgSimpleSAMLphp_SyncAllGroups_LocallyManaged = [ + "sysop", + "bureaucrat", + "interface-admin", + "DecisionMakers", + "LFCConsultingPartners", + "LFCResearchPartners", + "LFCEvaluators", + "PseudoDecisionMakers", +]; + +$wgSimpleSAMLphp_GroupMap = [ + 'sysop' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], + 'interface-admin' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], + 'bureaucrat' => ['groups' => ['LFC Torque Admin', 'LFC Staff']], + 'DecisionMakers' => ['groups' => ['LFC Decision Makers', 'Board Members']], + 'PseudoDecisionMakers' => ['groups' => ['Pseudo Board Members']], + 'LFCEvaluators' => ['groups' => ['LFC Consultants', 'LFC Evaluators']], + 'LFCResearchPartners' => ['groups' => ['LFC Research Partners']] +]; + +?> diff --git a/roles/permissions/tasks/main.yml b/roles/permissions/tasks/main.yml new file mode 100644 index 00000000..f5dbc547 --- /dev/null +++ b/roles/permissions/tasks/main.yml @@ -0,0 +1,37 @@ +--- + +- name: Transfer Config + copy: + src: default-permissions.php + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/" + +- name: Enable Permissions + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE GROUP PERMISSIONS CONFIG" + block: | + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/default-permissions.php"; + +- name: Transfer DecisionMakers group css + copy: + src: Group-DecisionMakers.css + dest: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" + +- name: Install DecisionMakers group css + raw: "php {{ mediawiki_install_directory }}/mediawiki-1.33.0/maintenance/edit.php -b MediaWiki:Group-{{ item }}.css < {{ mediawiki_install_directory }}/Group-DecisionMakers.css" + loop: + - PseudoDecisionMakers + - DecisionMakers + - LFCEvaluators + - LFCResearchPartners + - LFCConsultingPartners + +- name: Remove DecisionMakers group css + file: + path: "{{ mediawiki_install_directory }}/Group-DecisionMakers.css" + state: absent + +- name: Remove Old Disable Special:Log for groups that don't have view-special-log config + blockinfile: + marker: "## {mark} ANSIBLE SPECIAL LOG PERMISSIONS CONFIG" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" diff --git a/roles/picksome/files/picksome.php b/roles/picksome/files/picksome.php new file mode 100644 index 00000000..72e0901e --- /dev/null +++ b/roles/picksome/files/picksome.php @@ -0,0 +1,71 @@ +exists()) { + $page = new WikiPage($eligibleWildCardsTitle); + $valid_pages = []; + preg_match_all("/\\[\\[([^\\]]*)\\]\\]/", $page->getContent()->getText(), $valid_pages); + foreach($valid_pages[1] as $valid_page) { + if($title->equals(Title::newFromText($valid_page))) { + return true; + } + } + return false; + } else { + return false; + } +}; + +$wgPickSomeSortFunction = function($t1, $t2) { + $text1 = $t1->getText(); + $text2 = $t2->getText(); + + $text1 = preg_replace("/^\\W/", "", $text1); + $text2 = preg_replace("/^\\W/", "", $text2); + return $text1 > $text2; +}; + +# These are defaults for competitions as specified by LFC, but will probably be overridden +# on a competition by competition basis +$picksomeOverrideMessage = [ + "picksome-all" => "Everyone's Finalist Candidates", + "picksome-title" => "Finalist Candidates", + "picksome-choices" => "Finalist Candidate Choices", + "picksome-my-picks" => "My Finalist Candidates", + "picksome-unpick" => "Deselect", + "picksome-pick" => "Select this page", + "picksome-no-picks" => "No Finalist Candidates", + "picksome-current" => "Current Page", + "picksome-view-all" => "View Everyone's Finalist Candidates", + "picksome-global-list" => "Global Finalist Candidate List", + "picksome-remove-below" => "To select the current page, remove one below", + "picksome-stop" => "Stop Selecting", + "picksome-close-window" => "Close Window", + "picksome-start" => "Start Selecting", +]; +$wgHooks['MessagesPreLoad'][] = function($title, &$message, $code) { + global $picksomeOverrideMessage; + if(array_key_exists(strtolower($title), $picksomeOverrideMessage)) { + $message = $picksomeOverrideMessage[strtolower($title)]; + } +}; +?> diff --git a/roles/picksome/tasks/main.yml b/roles/picksome/tasks/main.yml new file mode 100644 index 00000000..fea7b7e1 --- /dev/null +++ b/roles/picksome/tasks/main.yml @@ -0,0 +1,19 @@ +--- + +- name: Check out PickSome + git: + repo: https://github.com/OpenTechStrategies/PickSome + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/PickSome/" + version: 59df890 + +- name: Transfer Config + copy: + src: picksome.php + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/" + +- name: Enable PickSome + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE PICKSOME CONFIG" + block: | + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/picksome.php"; diff --git a/100Change2017/ansible/roles/postgres/tasks/main.yml b/roles/postgres/tasks/main.yml similarity index 100% rename from 100Change2017/ansible/roles/postgres/tasks/main.yml rename to roles/postgres/tasks/main.yml diff --git a/roles/rss/tasks/main.yml b/roles/rss/tasks/main.yml new file mode 100644 index 00000000..a5fb4c59 --- /dev/null +++ b/roles/rss/tasks/main.yml @@ -0,0 +1,13 @@ +--- + +- name: Install RSS + unarchive: + src: "{{ playbook_dir }}/../../thirdparty/extensions/RSS-REL1_34-0e63926.tar.gz" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" + +- name: Enable RSS + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + block: | + wfLoadExtension('RSS'); + $wgRSSUrlWhitelist = ["*"]; diff --git a/roles/simplefavorites/tasks/main.yml b/roles/simplefavorites/tasks/main.yml new file mode 100644 index 00000000..0d22940d --- /dev/null +++ b/roles/simplefavorites/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: Check out SimpleFavorites + git: + repo: https://github.com/OpenTechStrategies/SimpleFavorites + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/SimpleFavorites/" + version: 59fed33 + +- name: Enable SimpleFavorites + lineinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + line: "wfLoadExtension('SimpleFavorites');" diff --git a/roles/simplesaml/tasks/main.yml b/roles/simplesaml/tasks/main.yml new file mode 100644 index 00000000..7b287a92 --- /dev/null +++ b/roles/simplesaml/tasks/main.yml @@ -0,0 +1,44 @@ +--- + +- name: Add okta account to autoconfig + lineinfile: + path: "{{ simplesaml_install_directory }}/simplesamlphp-1.18.4/saml-autoconfig.php" + insertafter: '\$metadata_url_for = array\(' + line: "'{{ simplesaml_okta_metadata_name }}' => '{{ simplesaml_okta_metadata_url }}'," + +- name: Install PluggableAuth + unarchive: + src: "{{ playbook_dir }}/../../thirdparty/extensions/PluggableAuth-REL1_33-a69f626.tar.gz" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" + +- name: Install SimpleSAML extension + unarchive: + src: "{{ playbook_dir }}/../../thirdparty/extensions/SimpleSAMLphp-REL1_33-7d91f27.tar.gz" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/" + +- name: Transfer Config + template: + src: simplesaml.php.j2 + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/simplesaml.php" + +- name: Enable PluggableAuth/SimpleSAML + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE PLUGGABLEAUTH/SIMPLSAML CONFIG" + block: | + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/simplesaml.php"; + +- name: Remove Enable PluggableAuth Block + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE PLUGABLE AUTH CONFIG" + +- name: Enable SimpleSAMLphp extension Block + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE SIMPLE SAML PHP CONFIG" + +- name: Rearrange Login Page Block + blockinfile: + marker: "## {mark} ANSIBLE CHANGE LOGIN ORDERING" + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" diff --git a/roles/simplesaml/templates/simplesaml.php.j2 b/roles/simplesaml/templates/simplesaml.php.j2 new file mode 100644 index 00000000..2688d239 --- /dev/null +++ b/roles/simplesaml/templates/simplesaml.php.j2 @@ -0,0 +1,82 @@ + 'info', + 'weight' => 150, + 'cssclass' => 'mw-htmlform-login-or', + 'default' => "or" + ]; + + unset($formDescriptor['linkcontainer']); + unset($formDescriptor['passwordReset']); + unset($formDescriptor['createOrLogin']); + + if ( isset( $formDescriptor['pluggableauthlogin'] ) ) { + $formDescriptor['pluggableauthlogin']['weight'] = -1; + } +}; +?> diff --git a/roles/teamcomments/tasks/main.yml b/roles/teamcomments/tasks/main.yml new file mode 100644 index 00000000..621017c8 --- /dev/null +++ b/roles/teamcomments/tasks/main.yml @@ -0,0 +1,19 @@ +--- + +- name: Check out TeamComments + git: + repo: https://github.com/OpenTechStrategies/TeamComments + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TeamComments/" + version: 450bff7 + +- name: Enable TeamComments + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE TEAMCOMMENTS CONFIG" + block: | + wfLoadExtension('TeamComments'); + $wgTeamCommentsCheatSheetLocation = "Wiki_Markup_Cheat_Sheet"; + $wgTeamCommentsUserPseudonymizer = function($username) { + return "Pseudonymous User #" . TorqueDataConnectUserLookup::lookupByUsername($username)->{"id"}; + }; + diff --git a/roles/torquedataconnect/defaults/main.yml b/roles/torquedataconnect/defaults/main.yml new file mode 100644 index 00000000..a15d72b8 --- /dev/null +++ b/roles/torquedataconnect/defaults/main.yml @@ -0,0 +1,2 @@ +--- +torquedata_server_port: 5000 diff --git a/roles/torquedataconnect/tasks/main.yml b/roles/torquedataconnect/tasks/main.yml new file mode 100644 index 00000000..c57edaec --- /dev/null +++ b/roles/torquedataconnect/tasks/main.yml @@ -0,0 +1,25 @@ +--- + +- name: Check out Torque + git: + repo: https://github.com/OpenTechStrategies/torque + dest: "{{ mediawiki_install_directory }}/torque/" + version: 16468ec + +- name: Link TorqueDataConnect + file: + src: "{{ mediawiki_install_directory }}/torque/TorqueDataConnect/" + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/extensions/TorqueDataConnect" + state: link + +- name: Transfer Config + template: + src: torquedataconnect.php.j2 + dest: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/torquedataconnect.php" + +- name: Enable TorqueDataConnect + blockinfile: + path: "{{ mediawiki_install_directory }}/mediawiki-1.33.0/LocalSettings.php" + marker: "## {mark} ANSIBLE TORQUEDATACONNECT CONFIG" + block: | + include "{{ mediawiki_install_directory }}/mediawiki-1.33.0/torque-sites-config/torquedataconnect.php"; diff --git a/roles/torquedataconnect/templates/torquedataconnect.php.j2 b/roles/torquedataconnect/templates/torquedataconnect.php.j2 new file mode 100644 index 00000000..8b368984 --- /dev/null +++ b/roles/torquedataconnect/templates/torquedataconnect.php.j2 @@ -0,0 +1,13 @@ + diff --git a/torquedata/ansible/roles/torquedata/tasks/main.yml b/torquedata/ansible/roles/torquedata/tasks/main.yml index 680b6cb5..ea5285c5 100644 --- a/torquedata/ansible/roles/torquedata/tasks/main.yml +++ b/torquedata/ansible/roles/torquedata/tasks/main.yml @@ -15,7 +15,7 @@ path: "{{ torquedata_install_directory }}" state: directory -- name: Checkout Torque +- name: Check out Torque git: repo: https://github.com/OpenTechStrategies/torque dest: "{{ torquedata_install_directory }}/torque/"