From 494ba858cb44b78894295c24e5c1852ec398560d Mon Sep 17 00:00:00 2001 From: paladox Date: Mon, 23 Oct 2023 13:51:03 +0100 Subject: [PATCH] generateExtensionDatabaseList: support a --directory option (#426) --- maintenance/generateExtensionDatabaseList.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/maintenance/generateExtensionDatabaseList.php b/maintenance/generateExtensionDatabaseList.php index 87fbd4d07..178d049d5 100644 --- a/maintenance/generateExtensionDatabaseList.php +++ b/maintenance/generateExtensionDatabaseList.php @@ -13,6 +13,7 @@ public function __construct() { $desc = 'Extension or skin to generate database list for. ' . 'This option may be passed multiple times to generate multiple database lists at once.'; + $this->addOption( 'directory', 'Directory to store the json file in.', true, true ); $this->addOption( 'extension', $desc, true, true, false, true ); } @@ -39,9 +40,9 @@ public function execute() { } } - $shellUser = posix_getpwuid( posix_geteuid() )['name']; + $directory = $this->getOption( 'directory' ); foreach ( $extArray as $ext ) { - file_put_contents( "/home/{$shellUser}/{$ext}.json", json_encode( [ 'combi' => $lists[$ext] ] ), LOCK_EX ); + file_put_contents( "{$directory}/{$ext}.json", json_encode( [ 'combi' => $lists[$ext] ] ), LOCK_EX ); } } }