{"id":646,"date":"2020-06-04T18:25:08","date_gmt":"2020-06-04T17:25:08","guid":{"rendered":"http:\/\/blog.magnusmanske.de\/?p=646"},"modified":"2020-06-04T18:25:08","modified_gmt":"2020-06-04T17:25:08","slug":"the-toolforge-composition","status":"publish","type":"post","link":"http:\/\/magnusmanske.de\/wordpress\/archives\/646","title":{"rendered":"The Toolforge Composition"},"content":{"rendered":"<p><a href=\"https:\/\/wikitech.wikimedia.org\/wiki\/Portal:Toolforge\">Toolforge <\/a>, formerly known as <em>wmflabs<\/em>, is <a href=\"https:\/\/wikitech.wikimedia.org\/wiki\/News\/Toolforge.org\">changing its URLs<\/a>. Where there was one host (<em>tools.wmflabs.org<\/em>) before, each tool now gets its own sub-domain (eg <em>mix-n-match.toolforge.org<\/em>).<\/p>\n<p>Until now, I have used my <em>WiDaR<\/em> tool as a universal OAuth login for many of my tools, so users only have to sign in once. However, since this solution only works within the same sub-domain, it is no longer viable with the new Toolforge URL schema.<\/p>\n<p>I am scrambling to port my tools that use OAuth to their own sign-in. To make this easier, I put my <em>WiDaR<\/em> tool into a PHP class, that can be reused across tools; the individual tool API can then pick up the requests that were previously sent to <em>WiDar<\/em>. Some tools, like <a href=\"https:\/\/mix-n-match.toolforge.org\/\">Mix-n-match<\/a>, have already been ported.<\/p>\n<p>This brought me back to something that has been requested of some of my tools before &#8211; portability, namely to MediaWiki\/Wikibase installations other then the Wikimedia ones. A tool with its own <em>WiDaR<\/em> would be much more portable to such installations.<\/p>\n<p>But the new <em>WiDaR<\/em> class is included via the shared file system of Toolforge; how to get it portable? Just copying it seems like a duplication of effort, and it won&#8217;t receive updates etc.<\/p>\n<p>The solution, in the PHP world, is called <a href=\"https:\/\/getcomposer.org\/\">composer<\/a>, a package manager for PHP. While I was at it, I ported several of my often-reused PHP &#8220;library scripts&#8221; to composer, and they are available in code <a href=\"https:\/\/bitbucket.org\/magnusmanske\/magnustools\/\">here<\/a>, or as an installable package <a href=\"https:\/\/packagist.org\/packages\/magnusmanske\/toolforge\">here<\/a>.<\/p>\n<p>Since the source files for composer slightly differ from the ones I use internally on Toolforge, I wrote <a href=\"https:\/\/bitbucket.org\/magnusmanske\/magnustools\/src\/master\/includes2composer_classes.php\">a script<\/a> to &#8220;translate&#8221; my internal scripts into composer-compatible copies.<\/p>\n<p>The first tool I equipped with this composer-based WiDaR is <a href=\"https:\/\/bitbucket.org\/magnusmanske\/tabernacle\">Tabernacle<\/a>. It should be generic enough to be useful on other Wikibase installations, and is very lightweight (the PHP part just contains a small wrapper API around the <em>WiDaR<\/em> class). Installation instructions are in the repo README.<\/p>\n<p>I will continue converting tools to the new URL schema, as time allows. I hope I will beat the hard deadline of June 15.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Toolforge , formerly known as wmflabs, is changing its URLs. Where there was one host (tools.wmflabs.org) before, each tool now gets its own sub-domain (eg mix-n-match.toolforge.org). Until now, I have used my WiDaR tool as a universal OAuth login for many of my tools, so users only have to sign in once. However, since this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-646","post","type-post","status-publish","format-standard","hentry","category-wikimedia-2"],"_links":{"self":[{"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/comments?post=646"}],"version-history":[{"count":1,"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/posts\/646\/revisions"}],"predecessor-version":[{"id":647,"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/posts\/646\/revisions\/647"}],"wp:attachment":[{"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/media?parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/categories?post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/magnusmanske.de\/wordpress\/wp-json\/wp\/v2\/tags?post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}