MaxSem has uploaded a new change for review. https://gerrit.wikimedia.org/r/68309
Change subject: Create a class to sync MediaWiki:Common.css etc on labs with production ...................................................................... Create a class to sync MediaWiki:Common.css etc on labs with production Change-Id: I2e1c55c47ba073016823551341437a9c2f6737b4 --- A files/misc/beta/sync-site-resources M manifests/misc/beta.pp 2 files changed, 49 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/09/68309/1 diff --git a/files/misc/beta/sync-site-resources b/files/misc/beta/sync-site-resources new file mode 100755 index 0000000..0afd5a2 --- /dev/null +++ b/files/misc/beta/sync-site-resources @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +RESOURCES=( 'Common.js Common.css Vector.js Vector.css Monobook.js Monobook.css Mobile.js Mobile.css' ) + +function sync_resource() { + local resource=$1 + local dbname=$2 + local source=$3 + + echo "Synchronizing $resource with $source" + curl "https://$source/w/index.php?title=MediaWiki:$resource&action=raw" | \ + mwscript edit.php --wiki=$dbname -b -s "Automatic synchronization with $source" "MediaWiki:$resource" +} + +function sync_wiki() { + local dbname=$1 + local source=$2 + + echo "== $dbname ==" + for resource in $RESOURCES + do + sync_resource $resource $dbname $source + done +} + +# TODO: other wikis? +sync_wiki 'enwiki' 'en.wikipedia.org' + diff --git a/manifests/misc/beta.pp b/manifests/misc/beta.pp index 31bf660..1ec830c 100644 --- a/manifests/misc/beta.pp +++ b/manifests/misc/beta.pp @@ -62,3 +62,22 @@ } } + +class misc::beta::sync-site-resources { + file { "/usr/local/bin/sync-site-resources": + ensure => present, + owner => root, + group => root, + mode => 0555, + source => "puppet:///files/misc/beta/sync-site-resources" + } + + cron { "sync-site-resources": + command => "/usr/local/bin/sync-site-resources >/dev/null 2>&1", + require => File["/usr/local/bin/sync-site-resources"], + hour => 12, + user => apache, + ensure => present, + } +} + -- To view, visit https://gerrit.wikimedia.org/r/68309 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e1c55c47ba073016823551341437a9c2f6737b4 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits