public function getAvailableAddons(): array
{
return array_map(
- function(array $item) {
+ function (array $item) {
return $item[0];
},
Addon::getAvailableList()
if (file_exists($configName)) {
return $this->loadConfigFile($configName);
- } else if (file_exists($iniName)) {
+ } elseif (file_exists($iniName)) {
return $this->loadINIConfigFile($iniName);
} else {
return [];
$addonInfo = $addonHelper->getAddonInfo($addonId);
$info = [
- 'name' => $addonInfo->getName(),
+ 'name' => $addonInfo->getName(),
'description' => $addonInfo->getDescription(),
- 'version' => $addonInfo->getVersion(),
+ 'version' => $addonInfo->getVersion(),
];
$addons[] = [
// not part of $aside to make the template more adjustable
$aside_sub = [
'information' => [DI::l10n()->t('Information'), [
- 'overview' => ['admin' , DI::l10n()->t('Overview') , 'overview'],
- 'federation' => ['admin/federation' , DI::l10n()->t('Federation Statistics') , 'federation']
+ 'overview' => ['admin' , DI::l10n()->t('Overview') , 'overview'],
+ 'federation' => ['admin/federation' , DI::l10n()->t('Federation Statistics') , 'federation']
]],
'configuration' => [DI::l10n()->t('Configuration'), [
- 'site' => ['admin/site' , DI::l10n()->t('Site') , 'site'],
- 'storage' => ['admin/storage' , DI::l10n()->t('Storage') , 'storage'],
- 'addons' => ['admin/addons' , DI::l10n()->t('Addons') , 'addons'],
- 'themes' => ['admin/themes' , DI::l10n()->t('Themes') , 'themes'],
- 'features' => ['admin/features' , DI::l10n()->t('Additional features') , 'features'],
- 'tos' => ['admin/tos' , DI::l10n()->t('Terms of Service') , 'tos'],
+ 'site' => ['admin/site' , DI::l10n()->t('Site') , 'site'],
+ 'storage' => ['admin/storage' , DI::l10n()->t('Storage') , 'storage'],
+ 'addons' => ['admin/addons' , DI::l10n()->t('Addons') , 'addons'],
+ 'themes' => ['admin/themes' , DI::l10n()->t('Themes') , 'themes'],
+ 'features' => ['admin/features' , DI::l10n()->t('Additional features') , 'features'],
+ 'tos' => ['admin/tos' , DI::l10n()->t('Terms of Service') , 'tos'],
]],
'database' => [DI::l10n()->t('Database'), [
- 'dbsync' => ['admin/dbsync' , DI::l10n()->t('DB updates') , 'dbsync'],
- 'deferred' => ['admin/queue/deferred', DI::l10n()->t('Inspect Deferred Workers'), 'deferred'],
- 'workerqueue' => ['admin/queue' , DI::l10n()->t('Inspect worker Queue') , 'workerqueue'],
+ 'dbsync' => ['admin/dbsync' , DI::l10n()->t('DB updates') , 'dbsync'],
+ 'deferred' => ['admin/queue/deferred', DI::l10n()->t('Inspect Deferred Workers'), 'deferred'],
+ 'workerqueue' => ['admin/queue' , DI::l10n()->t('Inspect worker Queue') , 'workerqueue'],
]],
'logs' => [DI::l10n()->t('Logs'), [
- 'logsconfig' => ['admin/logs/', DI::l10n()->t('Logs') , 'logs'],
- 'logsview' => ['admin/logs/view' , DI::l10n()->t('View Logs') , 'viewlogs'],
+ 'logsconfig' => ['admin/logs/', DI::l10n()->t('Logs') , 'logs'],
+ 'logsview' => ['admin/logs/view' , DI::l10n()->t('View Logs') , 'viewlogs'],
]],
'diagnostics' => [DI::l10n()->t('Diagnostics'), [
- 'phpinfo' => ['admin/phpinfo?t=' . self::getFormSecurityToken('phpinfo'), DI::l10n()->t('PHP Info') , 'phpinfo'],
- 'probe' => ['probe' , DI::l10n()->t('probe address') , 'probe'],
- 'webfinger' => ['webfinger' , DI::l10n()->t('check webfinger') , 'webfinger'],
- 'babel' => ['babel' , DI::l10n()->t('Babel') , 'babel'],
- 'debug/ap' => ['debug/ap' , DI::l10n()->t('ActivityPub Conversion') , 'debug/ap'],
+ 'phpinfo' => ['admin/phpinfo?t=' . self::getFormSecurityToken('phpinfo'), DI::l10n()->t('PHP Info') , 'phpinfo'],
+ 'probe' => ['probe' , DI::l10n()->t('probe address') , 'probe'],
+ 'webfinger' => ['webfinger' , DI::l10n()->t('check webfinger') , 'webfinger'],
+ 'babel' => ['babel' , DI::l10n()->t('Babel') , 'babel'],
+ 'debug/ap' => ['debug/ap' , DI::l10n()->t('ActivityPub Conversion') , 'debug/ap'],
]],
];
$t = Renderer::getMarkupTemplate('admin/aside.tpl');
DI::page()['aside'] .= Renderer::replaceMacros($t, [
- '$admin' => ['addons_admin' => $addons_admin],
- '$subpages' => $aside_sub,
- '$admtxt' => DI::l10n()->t('Admin'),
+ '$admin' => ['addons_admin' => $addons_admin],
+ '$subpages' => $aside_sub,
+ '$admtxt' => DI::l10n()->t('Admin'),
'$plugadmtxt' => DI::l10n()->t('Addon Features'),
- '$h_pending' => DI::l10n()->t('User registrations waiting for confirmation'),
- '$admurl' => 'admin/'
+ '$h_pending' => DI::l10n()->t('User registrations waiting for confirmation'),
+ '$admurl' => 'admin/'
]);
return '';
use Friendica\Database\Definition\ViewDefinition;
use Friendica\Test\DatabaseTestTrait;
use Friendica\Test\Util\Database\StaticDatabase;
-use Friendica\Util\Profiler;
-use Psr\Log\NullLogger;
trait CreateDatabaseTrait
{
$this->root->url() . '/config',
$this->root->url() . '/static'
);
- $config = new ReadOnlyFileConfig(new Cache([
+ $config = new ReadOnlyFileConfig(new Cache([
'database' => [
'disable_pdo' => true
],
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileLoader->setupCache($configCache);
}
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileLoader->setupCache($configCache);
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileLoader->setupCache($configCache);
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileLoader->setupCache($configCache);
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileLoader->setupCache($configCache);
$this->root->url() . DIRECTORY_SEPARATOR . Config::CONFIG_DIR,
$this->root->url() . DIRECTORY_SEPARATOR . Config::STATIC_DIR
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileLoader->setupCache($configCache);
$this->root->url() . '/addon',
['FRIENDICA_CONFIG_DIR' => '/a/wrong/dir/'],
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileManager->setupCache($configCache);
$this->root->url() . '/addon',
['FRIENDICA_CONFIG_DIR' => $this->root->getChild('config2')->url()],
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileManager->setupCache($configCache);
$this->root->url(),
$this->root->url() . '/addon',
);
- $configCache = new Cache();
+ $configCache = new Cache();
$configFileManager->setupCache($configCache);
}
use Friendica\Test\DatabaseTestCase;
use Friendica\Test\Util\CreateDatabaseTrait;
use Friendica\Test\Util\VFSTrait;
-use org\bovigo\vfs\vfsStream;
class ConfigTest extends DatabaseTestCase
{
parent::setUp();
- $this->configCache = new Cache();
+ $this->configCache = new Cache();
$this->configFileManager = new ConfigFileManager(
$this->root->url(),
$this->root->url() . '/addon',
'key1' => 'value1a',
'key4' => 'value4',
],
- 'other' => [
+ 'other' => [
'key5' => 'value5',
'key6' => 'value6',
],
'config',
'other'
],
- 'load' => [
+ 'load' => [
'system',
],
],
- 'other' => [
+ 'other' => [
'data' => $data,
'possibleCats' => [
'system',
'config',
'other'
],
- 'load' => [
+ 'load' => [
'other',
],
],
'config',
'other'
],
- 'load' => [
+ 'load' => [
'config',
],
],
- 'all' => [
+ 'all' => [
'data' => $data,
'possibleCats' => [
'system',
'config',
'other'
],
- 'load' => [
+ 'load' => [
'system',
'config',
'other'
*/
public function testSetUp(array $data)
{
- $this->loadDirectFixture($this->configToDbArray($data) , $this->getDbInstance());
+ $this->loadDirectFixture($this->configToDbArray($data), $this->getDbInstance());
$this->testedConfig = $this->getInstance();
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
{
return [
'config' => [
- 'data1' => [
+ 'data1' => [
'config' => [
'key1' => 'value1',
'key2' => 'value2',
],
],
- 'data2' => [
+ 'data2' => [
'config' => [
'key1' => 'overwritten!',
'key3' => 'value3',
],
],
],
- 'other' => [
- 'data1' => [
+ 'other' => [
+ 'data1' => [
'config' => [
'key12' => 'data4',
'key45' => 7,
],
- 'other' => [
+ 'other' => [
'key1' => 'value1',
'key2' => 'value2',
],
],
- 'data2' => [
- 'other' => [
+ 'data2' => [
+ 'other' => [
'key1' => 'overwritten!',
'key3' => 'value3',
],
]
],
'expect' => [
- 'other' => [
+ 'other' => [
// load should overwrite values everytime!
'key1' => 'overwritten!',
'key2' => 'value2',
public function dataTestCat()
{
return [
- 'test_with_hashmap' => [
- 'data' => [
+ 'test_with_hashmap' => [
+ 'data' => [
'test_with_hashmap' => [
'notifyall' => [
'last_update' => 1671051565,
'admin' => true,
],
- 'blockbot' => [
+ 'blockbot' => [
'last_update' => 1658952852,
'admin' => true,
],
],
- 'config' => [
+ 'config' => [
'register_policy' => 2,
'register_text' => '',
'sitename' => 'Friendica Social Network23',
'hostname' => 'friendica.local',
'private_addons' => false,
],
- 'system' => [
+ 'system' => [
'dbclean_expire_conversation' => 90,
],
],
'last_update' => 1671051565,
'admin' => true,
],
- 'blockbot' => [
+ 'blockbot' => [
'last_update' => 1658952852,
'admin' => true,
],
],
],
- 'test_with_keys' => [
- 'data' => [
+ 'test_with_keys' => [
+ 'data' => [
'test_with_keys' => [
[
'last_update' => 1671051565,
'admin' => true,
],
],
- 'config' => [
+ 'config' => [
'register_policy' => 2,
'register_text' => '',
'sitename' => 'Friendica Social Network23',
'hostname' => 'friendica.local',
'private_addons' => false,
],
- 'system' => [
+ 'system' => [
'dbclean_expire_conversation' => 90,
],
],
],
],
'test_with_inner_array' => [
- 'data' => [
+ 'data' => [
'test_with_inner_array' => [
'notifyall' => [
'last_update' => 1671051565,
'no' => 1.5,
],
],
- 'blogbot' => [
+ 'blogbot' => [
'last_update' => 1658952852,
'admin' => true,
],
],
- 'config' => [
+ 'config' => [
'register_policy' => 2,
'register_text' => '',
'sitename' => 'Friendica Social Network23',
'hostname' => 'friendica.local',
'private_addons' => false,
],
- 'system' => [
+ 'system' => [
'dbclean_expire_conversation' => 90,
],
],
'no' => 1.5,
],
],
- 'blogbot' => [
+ 'blogbot' => [
'last_update' => 1658952852,
'admin' => true,
],
public function testGetCategory(array $data, string $category, array $assertion)
{
$this->configCache = new Cache($data);
- $config = new ReadOnlyFileConfig($this->configCache);
+ $config = new ReadOnlyFileConfig($this->configCache);
self::assertEquals($assertion, $config->get($category));
}
{
return [
'default' => [
- 'value' => ['test' => ['array']],
+ 'value' => ['test' => ['array']],
'assertion' => ['test' => ['array']],
],
'issue-12803' => [
- 'value' => 's:48:"s:40:"s:32:"https://punkrock-underground.com";";";',
+ 'value' => 's:48:"s:40:"s:32:"https://punkrock-underground.com";";";',
'assertion' => 'https://punkrock-underground.com',
],
'double-serialized-array' => [
- 'value' => 's:53:"a:1:{s:9:"testArray";a:1:{s:4:"with";s:7:"entries";}}";',
+ 'value' => 's:53:"a:1:{s:9:"testArray";a:1:{s:4:"with";s:7:"entries";}}";',
'assertion' => ['testArray' => ['with' => 'entries']],
],
];
$data = [
'config' => [
'admin_email' => 'value1',
- 'timezone' => 'value2',
- 'language' => 'value3',
- 'sitename' => 'value',
+ 'timezone' => 'value2',
+ 'language' => 'value3',
+ 'sitename' => 'value',
],
'system' => [
- 'url' => 'value1a',
+ 'url' => 'value1a',
'debugging' => true,
- 'logfile' => 'value4',
- 'loglevel' => 'notice',
- 'proflier' => true,
+ 'logfile' => 'value4',
+ 'loglevel' => 'notice',
+ 'proflier' => true,
],
- 'proxy' => [
+ 'proxy' => [
'trusted_proxies' => 'value5',
],
];
return [
'empty' => [
- 'data' => $data,
- 'server' => [],
+ 'data' => $data,
+ 'server' => [],
'assertDisabled' => [],
],
'mixed' => [
'data' => $data,
'server' => [
'FRIENDICA_ADMIN_MAIL' => 'test@friendica.local',
- 'FRIENDICA_DEBUGGING' => true,
+ 'FRIENDICA_DEBUGGING' => true,
],
'assertDisabled' => [
'config' => [
use Friendica\Core\Config\Capability\ISetConfigValuesTransactionally;
use Friendica\Core\Config\Model\DatabaseConfig;
-use Friendica\Core\Config\Model\ReadOnlyFileConfig;
use Friendica\Core\Config\Model\ConfigTransaction;
use Friendica\Core\Config\Util\ConfigFileManager;
use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Database\Database;
-use Friendica\Test\DatabaseTestCase;
use Friendica\Test\FixtureTestCase;
-use Friendica\Test\MockedTest;
-use Friendica\Test\Util\Database\StaticDatabase;
-use Friendica\Test\Util\VFSTrait;
use Mockery\Exception\InvalidCountException;
class ConfigTransactionTest extends FixtureTestCase
{
$this->configFileManager = \Mockery::spy(ConfigFileManager::class);
- $config = new DatabaseConfig($this->dice->create(Database::class), new Cache());
+ $config = new DatabaseConfig($this->dice->create(Database::class), new Cache());
$configTransaction = new ConfigTransaction($config);
// commit empty transaction
use Friendica\Core\Storage\Type\Filesystem;
use Friendica\Core\Storage\Type\SystemResource;
use Friendica\Database\Database;
-use Friendica\Database\Definition\DbaDefinition;
-use Friendica\Database\Definition\ViewDefinition;
use Friendica\DI;
use Friendica\Core\Config\Factory\Config;
use Friendica\Core\Storage\Type;
use Friendica\Test\DatabaseTestCase;
use Friendica\Test\Util\CreateDatabaseTrait;
use Friendica\Test\Util\Database\StaticDatabase;
-use Friendica\Test\Util\VFSTrait;
-use Friendica\Util\Profiler;
use org\bovigo\vfs\vfsStream;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
vfsStream::newDirectory(Type\FilesystemConfig::DEFAULT_BASE_FOLDER, 0777)->at($this->root);
- $this->logger = new NullLogger();
+ $this->logger = new NullLogger();
$this->database = $this->getDbInstance();
$configFactory = new Config();
$this->root->url(),
$this->root->url() . '/addon',
);
- $configCache = $configFactory->createCache($configFileManager);
+ $configCache = $configFactory->createCache($configFileManager);
$this->config = new \Friendica\Core\Config\Model\DatabaseConfig($this->database, $configCache);
$this->config->set('storage', 'name', 'Database');
public function dataStorages()
{
return [
- 'empty' => [
+ 'empty' => [
'name' => '',
'valid' => false,
'interface' => ICanReadFromStorage::class,
'assert' => null,
'assertName' => '',
],
- 'database' => [
+ 'database' => [
'name' => Type\Database::NAME,
'valid' => true,
'interface' => ICanWriteToStorage::class,
'assert' => Type\Database::class,
'assertName' => Type\Database::NAME,
],
- 'filesystem' => [
+ 'filesystem' => [
'name' => Filesystem::NAME,
'valid' => true,
'interface' => ICanWriteToStorage::class,
'assert' => SystemResource::class,
'assertName' => SystemResource::NAME,
],
- 'invalid' => [
+ 'invalid' => [
'name' => 'invalid',
'valid' => false,
'interface' => null,
self::assertTrue($db->update('gserver', ['active-week-users' => 0, 'registered-users' => 0], ['nurl' => 'http://friendica.local']));
- $fields = ["`registered-users` = `registered-users` + 1"];
+ $fields = ["`registered-users` = `registered-users` + 1"];
$fields[] = "`active-week-users` = `active-week-users` + 2";
self::assertTrue($db->update('gserver', $fields, ['nurl' => 'http://friendica.local']));