Skip to content

Commit

Permalink
Fix deprecated ReplicatedBagOStuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewKostka committed Feb 25, 2025
1 parent 33ad72f commit a0b1d50
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 110 deletions.
67 changes: 12 additions & 55 deletions dist-persist/wbstack/src/Settings/ProductionCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,21 @@
$wgSessionCacheType = 'redis';
// NOTE Passwords are set further down in config
$wgObjectCaches['redis'] = [
'class' => 'ReplicatedBagOStuff',
'readFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_SERVER_READ') ]
] ]
],
'writeFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_SERVER_WRITE') ]
] ]
],
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_SERVER_WRITE') ],
'loggroup' => 'RedisBagOStuff',
'reportDupes' => false
];
$wgObjectCaches['redis2'] = [
'class' => 'ReplicatedBagOStuff',
'readFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_CACHE_SERVER_READ') ]
] ]
],
'writeFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_CACHE_SERVER_WRITE') ]
] ]
],
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_CACHE_SERVER_WRITE') ],
'loggroup' => 'RedisBagOStuff',
'reportDupes' => false
];
if(getenv('MW_REDIS_PASSWORD') !== '') {
// Only set the password if not empty
// TODO do this optional password setting in a less evil way...
$wgObjectCaches['redis']['readFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis']['writeFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis2']['readFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis2']['writeFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis']['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis2']['password'] = getenv('MW_REDIS_PASSWORD');
}
}

Expand All @@ -77,25 +48,11 @@
] ]
];
$wgObjectCaches['db-replicated'] = [
'class' => ReplicatedBagOStuff::class,
'readFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => SqlBagOStuff::class,
'replicaOnly' => true,
'purgePeriod' => 5,
'purgeLimit' => 1000,
] ]
],
'writeFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => SqlBagOStuff::class,
'replicaOnly' => false,
'purgePeriod' => 5,
'purgeLimit' => 1000,
] ]
],
'class' => SqlBagOStuff::class,
'loggroup' => 'SQLBagOStuff',
'reportDupes' => false
'reportDupes' => false,
'args' => [ [
'purgePeriod' => 5,
'purgeLimit' => 1000,
] ]
];
67 changes: 12 additions & 55 deletions dist/wbstack/src/Settings/ProductionCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,21 @@
$wgSessionCacheType = 'redis';
// NOTE Passwords are set further down in config
$wgObjectCaches['redis'] = [
'class' => 'ReplicatedBagOStuff',
'readFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_SERVER_READ') ]
] ]
],
'writeFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_SERVER_WRITE') ]
] ]
],
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_SERVER_WRITE') ],
'loggroup' => 'RedisBagOStuff',
'reportDupes' => false
];
$wgObjectCaches['redis2'] = [
'class' => 'ReplicatedBagOStuff',
'readFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_CACHE_SERVER_READ') ]
] ]
],
'writeFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_CACHE_SERVER_WRITE') ]
] ]
],
'class' => 'RedisBagOStuff',
'servers' => [ getenv('MW_REDIS_CACHE_SERVER_WRITE') ],
'loggroup' => 'RedisBagOStuff',
'reportDupes' => false
];
if(getenv('MW_REDIS_PASSWORD') !== '') {
// Only set the password if not empty
// TODO do this optional password setting in a less evil way...
$wgObjectCaches['redis']['readFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis']['writeFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis2']['readFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis2']['writeFactory']['args'][0]['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis']['password'] = getenv('MW_REDIS_PASSWORD');
$wgObjectCaches['redis2']['password'] = getenv('MW_REDIS_PASSWORD');
}
}

Expand All @@ -77,25 +48,11 @@
] ]
];
$wgObjectCaches['db-replicated'] = [
'class' => ReplicatedBagOStuff::class,
'readFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => SqlBagOStuff::class,
'replicaOnly' => true,
'purgePeriod' => 5,
'purgeLimit' => 1000,
] ]
],
'writeFactory' => [
'factory' => [ 'ObjectCache', 'newFromParams' ],
'args' => [ [
'class' => SqlBagOStuff::class,
'replicaOnly' => false,
'purgePeriod' => 5,
'purgeLimit' => 1000,
] ]
],
'class' => SqlBagOStuff::class,
'loggroup' => 'SQLBagOStuff',
'reportDupes' => false
'reportDupes' => false,
'args' => [ [
'purgePeriod' => 5,
'purgeLimit' => 1000,
] ]
];

0 comments on commit a0b1d50

Please sign in to comment.