{"action":"created","comment":{"url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/comments/36849025","id":36849025,"diff_hunk":"@@ -0,0 +1,87 @@\n+<?php\n+\n+use Silex\\Application;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\Process\\Process;\n+use Wikimedia\\ForwardScript\\PageInformationCollector;\n+use Wikimedia\\ForwardScript\\ApplicationException;\n+\n+require __DIR__.'/vendor/autoload.php';\n+\n+\n+$app = new Application();\n+\n+// Settings\n+$app['cache_dir'] = __DIR__.'/cache';\n+$app['commons_api_url'] = 'https://commons.wikimedia.org/w/api.php';\n+$app['wikipedia_api_url'] = 'https://de.wikipedia.org/w/api.php';\n+$app['python_path'] = realpath( __DIR__ . '/../update-bot/' );\n+$app['default_categories_config'] = $app['python_path'] . '/config/commonscat_mapping.json';\n+$app['pageinfo_script'] = 'python -m wlmbots.pageinfo';\n+$app['commons_upload_url'] = 'https://commons.wikimedia.org/wiki/Special:UploadWizard?';\n+\n+// Services\n+$app['cache'] = $app->share( function ( $app ) {\n+\treturn new \\Doctrine\\Common\\Cache\\FilesystemCache( $app['cache_dir'] );\n+} );\n+$app['commons_api'] = $app->share( function ( $app ) {\n+\treturn new \\Mediawiki\\Api\\MediawikiApi( $app[ 'commons_api_url' ] );\n+} );\n+$app['wikipedia_api'] = $app->share( function ( $app ) {\n+\treturn new \\Mediawiki\\Api\\MediawikiApi( $app[ 'wikipedia_api_url' ] );\n+} );\n+$app['campaign_validator'] = $app->share( function ( $app ) {\n+\treturn new \\Wikimedia\\ForwardScript\\CampaignValidator( $app[ 'commons_api' ] );\n+} );\n+$app['pageinfo'] = $app->share( function ( $app ) {\n+\t$defaultCategories = json_decode( file_get_contents( $app['default_categories_config'] ), true );\n+\t$process = new Process( $app['pageinfo_script'], $app['python_path'] );\n+\treturn new PageInformationCollector( $app[ 'wikipedia_api' ], $process, $defaultCategories );\n+} );\n+\n+// Error handling\n+$app->error( function ( ApplicationException $e, $code ) {\n+\t$response = new Response( $e->getMessage() );\n+\t$response->headers->set( 'Content-Type', 'text/plain' );\n+\treturn $response;\n+} );\n+\n+$app->error( function ( \\Symfony\\Component\\Process\\Exception\\RuntimeException $e, $code ) {\n+\t$response = new Response( $e->getMessage() );\n+\t$response->headers->set( 'Content-Type', 'text/plain' );\n+\treturn $response;\n+} );\n+\n+// Routes\n+$app->get( '/', function() {\n+\treturn 'WLM redirect script';\n+} );\n+\n+$app->get( '/redirect/{pageName}/{campaign}/{id}/{lat}/{lon}',","path":"forward_script/app.php","position":60,"original_position":60,"commit_id":"6dfddaf57783b89f8f599038b3cf16ef138ec6ba","original_commit_id":"6dfddaf57783b89f8f599038b3cf16ef138ec6ba","user":{"login":"jakobw","id":453024,"avatar_url":"https://avatars.githubusercontent.com/u/453024?v=3","gravatar_id":"","url":"https://api.github.com/users/jakobw","html_url":"https://github.com/jakobw","followers_url":"https://api.github.com/users/jakobw/followers","following_url":"https://api.github.com/users/jakobw/following{/other_user}","gists_url":"https://api.github.com/users/jakobw/gists{/gist_id}","starred_url":"https://api.github.com/users/jakobw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakobw/subscriptions","organizations_url":"https://api.github.com/users/jakobw/orgs","repos_url":"https://api.github.com/users/jakobw/repos","events_url":"https://api.github.com/users/jakobw/events{/privacy}","received_events_url":"https://api.github.com/users/jakobw/received_events","type":"User","site_admin":false},"body":"Not harmful in this case but I don't think having a nested route is preferable to using GET parameters here.","created_at":"2015-08-12T11:25:16Z","updated_at":"2015-08-12T11:25:16Z","html_url":"https://github.com/wmde/WikiLovesMonuments/pull/58#discussion_r36849025","pull_request_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58","_links":{"self":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/comments/36849025"},"html":{"href":"https://github.com/wmde/WikiLovesMonuments/pull/58#discussion_r36849025"},"pull_request":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58","id":42218052,"html_url":"https://github.com/wmde/WikiLovesMonuments/pull/58","diff_url":"https://github.com/wmde/WikiLovesMonuments/pull/58.diff","patch_url":"https://github.com/wmde/WikiLovesMonuments/pull/58.patch","issue_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/58","number":58,"state":"open","locked":false,"title":"Forward script","user":{"login":"gbirke","id":223326,"avatar_url":"https://avatars.githubusercontent.com/u/223326?v=3","gravatar_id":"","url":"https://api.github.com/users/gbirke","html_url":"https://github.com/gbirke","followers_url":"https://api.github.com/users/gbirke/followers","following_url":"https://api.github.com/users/gbirke/following{/other_user}","gists_url":"https://api.github.com/users/gbirke/gists{/gist_id}","starred_url":"https://api.github.com/users/gbirke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbirke/subscriptions","organizations_url":"https://api.github.com/users/gbirke/orgs","repos_url":"https://api.github.com/users/gbirke/repos","events_url":"https://api.github.com/users/gbirke/events{/privacy}","received_events_url":"https://api.github.com/users/gbirke/received_events","type":"User","site_admin":false},"body":"The forward script is for links from Wikipedia to the Upload wizard. It validates campaign names, IDs and page names and gets category information from the wiki page and builds an Upload Wizard URL from it.\r\n\r\nResolves Task https://phabricator.wikimedia.org/T108163","created_at":"2015-08-12T09:03:09Z","updated_at":"2015-08-12T11:25:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"547131e08a8f7fe445e1cd3d2a3e26bb9b5ed088","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58/commits","review_comments_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58/comments","review_comment_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/58/comments","statuses_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/statuses/6dfddaf57783b89f8f599038b3cf16ef138ec6ba","head":{"label":"wmde:forward-script","ref":"forward-script","sha":"6dfddaf57783b89f8f599038b3cf16ef138ec6ba","user":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"repo":{"id":39148984,"name":"WikiLovesMonuments","full_name":"wmde/WikiLovesMonuments","owner":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wmde/WikiLovesMonuments","description":"Bot for updating the placeholders in lists of monuments on the German Wikipedia","fork":false,"url":"https://api.github.com/repos/wmde/WikiLovesMonuments","forks_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/forks","keys_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/teams","hooks_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/hooks","issue_events_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/events{/number}","events_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/events","assignees_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/assignees{/user}","branches_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/branches{/branch}","tags_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/tags","blobs_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/refs{/sha}","trees_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/statuses/{sha}","languages_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/languages","stargazers_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/stargazers","contributors_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/contributors","subscribers_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/subscribers","subscription_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/subscription","commits_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/commits{/sha}","git_commits_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/commits{/sha}","comments_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/comments{/number}","issue_comment_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/comments{/number}","contents_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/contents/{+path}","compare_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/merges","archive_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/downloads","issues_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues{/number}","pulls_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls{/number}","milestones_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/milestones{/number}","notifications_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/labels{/name}","releases_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/releases{/id}","created_at":"2015-07-15T16:50:22Z","updated_at":"2015-07-22T09:05:53Z","pushed_at":"2015-08-12T11:08:08Z","git_url":"git://github.com/wmde/WikiLovesMonuments.git","ssh_url":"git@github.com:wmde/WikiLovesMonuments.git","clone_url":"https://github.com/wmde/WikiLovesMonuments.git","svn_url":"https://github.com/wmde/WikiLovesMonuments","homepage":"","size":872,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"wmde:master","ref":"master","sha":"aa39262257e718551d124f985ab72ca84de5fd5c","user":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"repo":{"id":39148984,"name":"WikiLovesMonuments","full_name":"wmde/WikiLovesMonuments","owner":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wmde/WikiLovesMonuments","description":"Bot for updating the placeholders in lists of monuments on the German Wikipedia","fork":false,"url":"https://api.github.com/repos/wmde/WikiLovesMonuments","forks_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/forks","keys_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/teams","hooks_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/hooks","issue_events_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/events{/number}","events_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/events","assignees_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/assignees{/user}","branches_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/branches{/branch}","tags_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/tags","blobs_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/refs{/sha}","trees_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/statuses/{sha}","languages_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/languages","stargazers_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/stargazers","contributors_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/contributors","subscribers_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/subscribers","subscription_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/subscription","commits_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/commits{/sha}","git_commits_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/git/commits{/sha}","comments_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/comments{/number}","issue_comment_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/comments{/number}","contents_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/contents/{+path}","compare_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/merges","archive_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/downloads","issues_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues{/number}","pulls_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls{/number}","milestones_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/milestones{/number}","notifications_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/labels{/name}","releases_url":"https://api.github.com/repos/wmde/WikiLovesMonuments/releases{/id}","created_at":"2015-07-15T16:50:22Z","updated_at":"2015-07-22T09:05:53Z","pushed_at":"2015-08-12T11:08:08Z","git_url":"git://github.com/wmde/WikiLovesMonuments.git","ssh_url":"git@github.com:wmde/WikiLovesMonuments.git","clone_url":"https://github.com/wmde/WikiLovesMonuments.git","svn_url":"https://github.com/wmde/WikiLovesMonuments","homepage":"","size":872,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58"},"html":{"href":"https://github.com/wmde/WikiLovesMonuments/pull/58"},"issue":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/58"},"comments":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/wmde/WikiLovesMonuments/statuses/6dfddaf57783b89f8f599038b3cf16ef138ec6ba"}}}}