Skip to content

Commit d5d0443

Browse files
committed
toolforge.org fixes
* New homepage in composer.json * Redirect oge/status to sge-jobs.toolforge.org * Process records from Hay's that are using toolforge.org URLs * Connect to host admin.toolforge.org to find active dynamic proxy
1 parent d9b8819 commit d5d0443

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tools/admin",
33
"license": "GPL-3.0+",
4-
"homepage": "https://tools.wmflabs.org/",
4+
"homepage": "https://toolforge.org/",
55
"require": {
66
"ext-redis": ">=2.0",
77
"ezyang/htmlpurifier": "~4.7",

src/App.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ protected function configureSlim( \Slim\Slim $slim ) {
5353
'toolinfo.uri' => Config::getStr( 'TOOLINFO_URI',
5454
'https://hay.toolforge.org/directory/api.php'
5555
),
56-
'tools.base' => Config::getStr( 'TOOLS_BASE',
57-
'https://tools.wmflabs.org/'
58-
),
5956
] );
6057

6158
$slim->configureMode( 'production', function () use ( $slim ) {
@@ -120,8 +117,6 @@ protected function configureIoc( \Slim\Helper\Set $container ) {
120117
$container->singleton( 'purifierConfig', function ( $c ) {
121118
$config = \HTMLPurifier_Config::createDefault();
122119
$config->set( 'HTML.Doctype', 'HTML 4.01 Transitional' );
123-
$config->set( 'URI.Base', 'https://tools.wmflabs.org' );
124-
$config->set( 'URI.MakeAbsolute', true );
125120
$config->set( 'URI.DisableExternalResources', true );
126121
// Strip all css
127122
$config->set( 'HTML.ForbiddenAttributes', [ '*@style' ] );
@@ -290,8 +285,8 @@ function () use ( $slim ) {
290285

291286
$slim->get( 'oge/status', function () use ( $slim ) {
292287
$page = new Pages\Redirect( $slim );
293-
$page->setBaseUrl( $slim->config( 'tools.base' ) );
294-
$page( 'sge-jobs/' );
288+
$page->setBaseUrl( 'https://sge-jobs.toolforge.org' );
289+
$page( '/' );
295290
} )->name( 'oge-status' );
296291
}
297292
); // end group '/'

src/Toolinfo.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,25 @@ private function filterToolinfo( $raw ) {
108108
'author' => static::aGet( 'author', $info ),
109109
'repository' => static::aGet( 'repository', $info ),
110110
];
111+
} elseif ( false !== strpos( $info['url'], 'toolforge.org' ) ) {
112+
preg_match(
113+
'#^(https?:)?//([^.]+).toolforge.org/.*#',
114+
$info['url'],
115+
$m
116+
);
117+
$tool = $m[2];
118+
if ( !array_key_exists( $tool, $toolinfo ) ) {
119+
$toolinfo[$tool] = [];
120+
}
121+
$toolinfo[$tool][] = [
122+
'name' => $info['name'],
123+
'title' => $info['title'],
124+
'description' => $info['description'],
125+
'url' => $info['url'],
126+
'keywords' => static::aGet( 'keywords', $info ),
127+
'author' => static::aGet( 'author', $info ),
128+
'repository' => static::aGet( 'repository', $info ),
129+
];
111130
}
112131
}
113132
return $toolinfo;

src/Tools.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function getActiveWebservices() {
103103
// containers.
104104
// $active_proxy = file_get_contents( '/etc/active-proxy' );
105105
// Split horizon DNS should take us where we need to go
106-
$active_proxy = 'tools.wmflabs.org';
106+
$active_proxy = 'admin.toolforge.org';
107107
$proxy_uri = "http://{$active_proxy}:8081/list";
108108
$client = new Client();
109109
$response = $client->get( $proxy_uri );

0 commit comments

Comments
 (0)