Merge remote-tracking branch 'upstream/develop' into contact-update
This commit is contained in:
commit
c34204cf50
|
@ -95,7 +95,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
|
||||||
|
|
||||||
if ($this->hidePasswordOutput &&
|
if ($this->hidePasswordOutput &&
|
||||||
$key == 'password' &&
|
$key == 'password' &&
|
||||||
!empty($value) && is_string($value)) {
|
is_string($value)) {
|
||||||
$this->config[$cat][$key] = new HiddenString((string) $value);
|
$this->config[$cat][$key] = new HiddenString((string) $value);
|
||||||
} else {
|
} else {
|
||||||
$this->config[$cat][$key] = $value;
|
$this->config[$cat][$key] = $value;
|
||||||
|
|
|
@ -7,8 +7,8 @@ namespace Friendica\Core;
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Friendica\Core\Config\Cache\IConfigCache;
|
use Friendica\Core\Config\Cache\IConfigCache;
|
||||||
use Friendica\Database\DBA;
|
|
||||||
use Friendica\Database\DBStructure;
|
use Friendica\Database\DBStructure;
|
||||||
|
use Friendica\Factory\DBFactory;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\Logger\VoidLogger;
|
use Friendica\Util\Logger\VoidLogger;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
@ -600,23 +600,18 @@ class Installer
|
||||||
*/
|
*/
|
||||||
public function checkDB(IConfigCache $configCache, Profiler $profiler)
|
public function checkDB(IConfigCache $configCache, Profiler $profiler)
|
||||||
{
|
{
|
||||||
$dbhost = $configCache->get('database', 'hostname');
|
$database = DBFactory::init($configCache, $profiler, [], new VoidLogger());
|
||||||
$dbuser = $configCache->get('database', 'username');
|
|
||||||
$dbpass = $configCache->get('database', 'password');
|
|
||||||
$dbdata = $configCache->get('database', 'database');
|
|
||||||
|
|
||||||
if (!DBA::connect($configCache, $profiler, new VoidLogger(), $dbhost, $dbuser, $dbpass, $dbdata)) {
|
if ($database->connected()) {
|
||||||
$this->addCheck(L10n::t('Could not connect to database.'), false, true, '');
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DBA::connected()) {
|
|
||||||
if (DBStructure::existsTable('user')) {
|
if (DBStructure::existsTable('user')) {
|
||||||
$this->addCheck(L10n::t('Database already in use.'), false, true, '');
|
$this->addCheck(L10n::t('Database already in use.'), false, true, '');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->addCheck(L10n::t('Could not connect to database.'), false, true, '');
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -657,27 +657,14 @@ class Receiver
|
||||||
*/
|
*/
|
||||||
public static function switchContact($cid, $uid, $url)
|
public static function switchContact($cid, $uid, $url)
|
||||||
{
|
{
|
||||||
$profile = ActivityPub::probeProfile($url);
|
Contact::updateFromProbe($cid, '', true);
|
||||||
if (empty($profile)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::log('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' to ActivityPub');
|
Logger::log('Switch contact ' . $cid . ' (' . $url . ') for user ' . $uid . ' to ActivityPub');
|
||||||
|
|
||||||
$photo = defaults($profile, 'photo', null);
|
|
||||||
unset($profile['photo']);
|
|
||||||
unset($profile['baseurl']);
|
|
||||||
unset($profile['guid']);
|
|
||||||
|
|
||||||
$profile['nurl'] = Strings::normaliseLink($profile['url']);
|
|
||||||
DBA::update('contact', $profile, ['id' => $cid]);
|
|
||||||
|
|
||||||
Contact::updateAvatar($photo, $uid, $cid);
|
|
||||||
|
|
||||||
// Send a new follow request to be sure that the connection still exists
|
// Send a new follow request to be sure that the connection still exists
|
||||||
if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) {
|
if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) {
|
||||||
ActivityPub\Transmitter::sendActivity('Follow', $profile['url'], $uid);
|
ActivityPub\Transmitter::sendActivity('Follow', $url, $uid);
|
||||||
Logger::log('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, Logger::DEBUG);
|
Logger::log('Send a new follow request to ' . $url . ' for user ' . $uid, Logger::DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@ use org\bovigo\vfs\vfsStream;
|
||||||
use org\bovigo\vfs\vfsStreamFile;
|
use org\bovigo\vfs\vfsStreamFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @runTestsInSeparateProcesses
|
|
||||||
* @preserveGlobalState disabled
|
|
||||||
* @requires PHP 7.0
|
* @requires PHP 7.0
|
||||||
*/
|
*/
|
||||||
class AutomaticInstallationConsoleTest extends ConsoleTest
|
class AutomaticInstallationConsoleTest extends ConsoleTest
|
||||||
|
@ -43,6 +41,8 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
|
$this->markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
|
if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Test\src\Core\Config\Cache;
|
||||||
|
|
||||||
use Friendica\Core\Config\Cache\ConfigCache;
|
use Friendica\Core\Config\Cache\ConfigCache;
|
||||||
use Friendica\Test\MockedTest;
|
use Friendica\Test\MockedTest;
|
||||||
|
use ParagonIE\HiddenString\HiddenString;
|
||||||
|
|
||||||
class ConfigCacheTest extends MockedTest
|
class ConfigCacheTest extends MockedTest
|
||||||
{
|
{
|
||||||
|
@ -322,7 +323,8 @@ class ConfigCacheTest extends MockedTest
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEmpty($configCache->get('database', 'password'));
|
$this->assertNotEmpty($configCache->get('database', 'password'));
|
||||||
|
$this->assertInstanceOf(HiddenString::class, $configCache->get('database', 'password'));
|
||||||
$this->assertEmpty($configCache->get('database', 'username'));
|
$this->assertEmpty($configCache->get('database', 'username'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue