Skip to content

Commit

Permalink
generateExtensionDatabaseList: support a --directory option (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
paladox authored Oct 23, 2023
1 parent 8fe6508 commit 494ba85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions maintenance/generateExtensionDatabaseList.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand All @@ -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 );
}
}
}
Expand Down

0 comments on commit 494ba85

Please sign in to comment.