1
0
Fork 0

Merge remote-tracking branch 'upstream/2021.03-rc' into issue-10019

This commit is contained in:
Michael 2021-03-13 12:30:41 +00:00
commit acffafe6b9
5 changed files with 28 additions and 7 deletions

View file

@ -23,6 +23,7 @@ namespace Friendica\Console;
use Asika\SimpleConsole\CommandArgsException;
use Friendica\Core\StorageManager;
use Friendica\Model\Storage\StorageException;
/**
* tool to manage storage backend and stored data from CLI
@ -165,6 +166,10 @@ HELP;
$current = $this->storageManager->getBackend();
$total = 0;
if (is_null($current)) {
throw new StorageException(sprintf("Cannot move to legacy storage. Please select a storage backend."));
}
do {
$moved = $this->storageManager->move($current, $tables, $this->getOption('n', 5000));
if ($moved) {

View file

@ -305,13 +305,13 @@ class StorageManager
$data = $source->get($sourceRef);
}
$this->logger->info('Save data to new backend.', ['newBackend' => $destination]);
$this->logger->info('Save data to new backend.', ['newBackend' => $destination::getName()]);
$destinationRef = $destination->put($data);
$this->logger->info('Saved data.', ['newReference' => $destinationRef]);
if ($destinationRef !== '') {
$this->logger->info('update row');
if ($this->dba->update($table, ['backend-class' => $destination, 'backend-ref' => $destinationRef, 'data' => ''], ['id' => $id])) {
if ($this->dba->update($table, ['backend-class' => $destination::getName(), 'backend-ref' => $destinationRef, 'data' => ''], ['id' => $id])) {
if (!empty($source)) {
$this->logger->info('Delete data from old backend.', ['oldBackend' => $source, 'oldReference' => $sourceRef]);
$source->delete($sourceRef);

View file

@ -26,6 +26,7 @@ use Friendica\BaseModule;
use Friendica\Core;
use Friendica\Core\Config\Cache;
use Friendica\Core\Renderer;
use Friendica\Core\Theme;
use Friendica\DI;
use Friendica\Network\HTTPException;
use Friendica\Util\BasePath;
@ -162,6 +163,16 @@ class Install extends BaseModule
}
self::$installer->installDatabase($configCache->get('system', 'basepath'));
// install allowed themes to register theme hooks
// this is same as "Reload active theme" in /admin/themes
$allowed_themes = Theme::getAllowedList();
$allowed_themes = array_unique($allowed_themes);
foreach ($allowed_themes as $theme) {
Theme::uninstall($theme);
Theme::install($theme);
}
Theme::setAllowedList($allowed_themes);
break;
}

View file

@ -127,13 +127,16 @@ class Proxy extends BaseModule
}
$basepath = $a->getBasePath();
$filepermission = DI::config()->get('system', 'proxy_file_chmod');
// Store original image
if ($direct_cache) {
// direct cache , store under ./proxy/
$filename = $basepath . '/proxy/' . ProxyUtils::proxifyUrl($request['url'], true);
file_put_contents($filename, $image->asString());
chmod($filename, DI::config()->get('system', 'proxy_file_chmod'));
if (!empty($filepermission)) {
chmod($filename, $filepermission);
}
} elseif($cachefile !== '') {
// cache file
file_put_contents($cachefile, $image->asString());
@ -153,7 +156,9 @@ class Proxy extends BaseModule
if ($direct_cache && $request['sizetype'] != '') {
$filename = $basepath . '/proxy/' . ProxyUtils::proxifyUrl($request['url'], true) . $request['sizetype'];
file_put_contents($filename, $image->asString());
chmod($filename, DI::config()->get('system', 'proxy_file_chmod'));
if (!empty($filepermission)) {
chmod($filename, $filepermission);
}
}
self::responseImageHttpCache($image);

View file

@ -571,9 +571,9 @@ return [
// Timeout in seconds for fetching the XRD links.
'xrd_timeout' => 20,
// proxy_file_chmod (Integer)
// Access rights for downloaded files in /proxy/ directory
'proxy_file_chmod' => 0640,
// proxy_file_chmod (Octal Integer like 0640)
// If set, defines the files permissions for downloaded files in the /proxy/ directory, default is system-dependent
'proxy_file_chmod' => 0,
],
'experimental' => [
// exp_themes (Boolean)