Skip to content

Commit 1229af4

Browse files
committed
Support passing addon optionSpecs in getAll()
1 parent 76864d4 commit 1229af4

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/Options.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,15 @@ public static function getDefaultLineDelimitedBlobValue( string $name ): array {
522522
*
523523
* @return array<string, OptionData> array of option name to option object
524524
*/
525-
public static function getAll() {
525+
public static function getAll(
526+
?array $option_specs = null
527+
) {
526528
global $wpdb;
527529

530+
if ( $option_specs === null ) {
531+
$option_specs = self::optionSpecs();
532+
}
533+
528534
$table_name = self::getTableName();
529535

530536
$sql = "SELECT name, value, blob_value FROM $table_name";
@@ -537,7 +543,7 @@ public static function getAll() {
537543
}
538544

539545
$ret = [];
540-
foreach ( self::optionSpecs() as $opt_spec ) {
546+
foreach ( $option_specs as $opt_spec ) {
541547
$name = $opt_spec->name;
542548
$opt = $options_map[ $name ];
543549
if ( $opt ) {

src/S3/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function renderS3Page(): void {
6767
$view['uploads_path'] = \WP2Static\SiteInfo::getPath( 'uploads' );
6868
$s3_path = \WP2Static\SiteInfo::getPath( 'uploads' ) . 'wp2static-processed-site.s3';
6969

70-
$view['options'] = Options::getAll();
70+
$view['options'] = Options::getAll( S3Options::optionSpecs() );
7171

7272
$view['s3_url'] =
7373
is_file( $s3_path ) ?

0 commit comments

Comments
 (0)