Replace PostUpdate key-value config entries with key-value pair entries
This commit is contained in:
parent
47764387b3
commit
10f8631cd9
11 changed files with 112 additions and 101 deletions
|
@ -100,12 +100,12 @@ Examples
|
|||
HELP;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, Cache $configCache, IManageConfigValues $config, Database $dba, array $argv = null)
|
||||
public function __construct(App\Mode $appMode, Cache $keyValueCache, IManageConfigValues $config, Database $dba, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
$this->appMode = $appMode;
|
||||
$this->configCache = $configCache;
|
||||
$this->configCache = $keyValueCache;
|
||||
$this->config = $config;
|
||||
$this->dba = $dba;
|
||||
}
|
||||
|
|
|
@ -94,12 +94,12 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, IManageConfigValues $config, array $argv = null)
|
||||
public function __construct(App\Mode $appMode, IManageConfigValues $keyValue, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
$this->appMode = $appMode;
|
||||
$this->config = $config;
|
||||
$this->config = $keyValue;
|
||||
}
|
||||
|
||||
protected function doExecute(): int
|
||||
|
|
|
@ -69,12 +69,12 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, IManageConfigValues $config, $argv = null)
|
||||
public function __construct(App\Mode $appMode, IManageConfigValues $keyValue, $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
$this->appMode = $appMode;
|
||||
$this->config = $config;
|
||||
$this->config = $keyValue;
|
||||
}
|
||||
|
||||
protected function doExecute(): int
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
namespace Friendica\Console;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\KeyValueStorage\Capabilities\ICanManageKeyValuePairs;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Update;
|
||||
|
||||
|
@ -38,9 +38,9 @@ class PostUpdate extends \Asika\SimpleConsole\Console
|
|||
*/
|
||||
private $appMode;
|
||||
/**
|
||||
* @var IManageConfigValues
|
||||
* @var ICanManageKeyValuePairs
|
||||
*/
|
||||
private $config;
|
||||
private $keyValue;
|
||||
/**
|
||||
* @var L10n
|
||||
*/
|
||||
|
@ -60,13 +60,13 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(App\Mode $appMode, IManageConfigValues $config, L10n $l10n, array $argv = null)
|
||||
public function __construct(App\Mode $appMode, ICanManageKeyValuePairs $keyValue, L10n $l10n, array $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
$this->appMode = $appMode;
|
||||
$this->config = $config;
|
||||
$this->l10n = $l10n;
|
||||
$this->appMode = $appMode;
|
||||
$this->keyValue = $keyValue;
|
||||
$this->l10n = $l10n;
|
||||
}
|
||||
|
||||
protected function doExecute(): int
|
||||
|
@ -83,7 +83,7 @@ HELP;
|
|||
$this->out($this->getHelp());
|
||||
return 0;
|
||||
} elseif ($reset_version) {
|
||||
$this->config->set('system', 'post_update_version', $reset_version);
|
||||
$this->keyValue->set('post_update_version', $reset_version);
|
||||
echo $this->l10n->t('Post update version number has been set to %s.', $reset_version) . "\n";
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class Update
|
|||
}
|
||||
|
||||
// The postupdate has to completed version 1288 for the new post views to take over
|
||||
$postupdate = DI::config()->get('system', 'post_update_version', self::NEW_TABLE_STRUCTURE_VERSION);
|
||||
$postupdate = DI::keyValue()->get('post_update_version') ?? self::NEW_TABLE_STRUCTURE_VERSION;
|
||||
if ($postupdate < self::NEW_TABLE_STRUCTURE_VERSION) {
|
||||
$error = DI::l10n()->t('Updates from postupdate version %s are not supported. Please update at least to version 2021.01 and wait until the postupdate finished version 1383.', $postupdate);
|
||||
if (DI::mode()->getExecutor() == Mode::INDEX) {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica;
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\KeyValueStorage\Capabilities\ICanManageKeyValuePairs;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Navigation\SystemMessages;
|
||||
|
@ -182,7 +181,7 @@ abstract class DI
|
|||
return self::$dice->create(Core\Config\Capability\IManageConfigValues::class);
|
||||
}
|
||||
|
||||
public static function keyValue(): ICanManageKeyValuePairs
|
||||
public static function keyValue(): Core\KeyValueStorage\Capabilities\ICanManageKeyValuePairs
|
||||
{
|
||||
return self::$dice->create(Core\KeyValueStorage\Capabilities\ICanManageKeyValuePairs::class);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class DBStructure
|
|||
throw new \Asika\SimpleConsole\CommandArgsException('The version number must be numeric');
|
||||
}
|
||||
|
||||
DI::config()->set('system', 'build', $version);
|
||||
DI::keyValue()->set( 'build', $version);
|
||||
echo DI::l10n()->t('The database version had been set to %s.', $version);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class DBStructure
|
|||
*/
|
||||
public static function dropTables(bool $execute)
|
||||
{
|
||||
$postupdate = DI::config()->get('system', 'post_update_version', PostUpdate::VERSION);
|
||||
$postupdate = DI::keyValue()->get('post_update_version') ?? PostUpdate::VERSION;
|
||||
if ($postupdate < PostUpdate::VERSION) {
|
||||
echo DI::l10n()->t('The post update is at version %d, it has to be at %d to safely drop the tables.', $postupdate, PostUpdate::VERSION);
|
||||
return;
|
||||
|
@ -176,14 +176,14 @@ class DBStructure
|
|||
public static function performUpdate(bool $enable_maintenance_mode = true, bool $verbose = false): string
|
||||
{
|
||||
if ($enable_maintenance_mode) {
|
||||
DI::config()->set('system', 'maintenance', 1);
|
||||
DI::keyValue()->set( 'maintenance', 1);
|
||||
}
|
||||
|
||||
$status = self::update($verbose, true);
|
||||
|
||||
if ($enable_maintenance_mode) {
|
||||
DI::config()->set('system', 'maintenance', 0);
|
||||
DI::config()->set('system', 'maintenance_reason', '');
|
||||
DI::keyValue()->set( 'maintenance', 0);
|
||||
DI::keyValue()->set( 'maintenance_reason', '');
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
@ -213,7 +213,7 @@ class DBStructure
|
|||
*/
|
||||
private static function update(bool $verbose, bool $action, bool $install = false, array $tables = null, array $definition = null): string
|
||||
{
|
||||
$in_maintenance_mode = DI::config()->get('system', 'maintenance');
|
||||
$in_maintenance_mode = DI::keyValue()->get('system', 'maintenance');
|
||||
|
||||
if ($action && !$install && self::isUpdating()) {
|
||||
return DI::l10n()->t('Another database update is currently running.');
|
||||
|
@ -494,9 +494,9 @@ class DBStructure
|
|||
|
||||
if ($action && !$install) {
|
||||
if ($errors) {
|
||||
DI::config()->set('system', 'dbupdate', self::UPDATE_FAILED);
|
||||
DI::config()->set('system', 'dbupdate', self::UPDATE_FAILED);
|
||||
} else {
|
||||
DI::config()->set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
|
||||
DI::config()->set( 'system', 'dbupdate', self::UPDATE_SUCCESSFUL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,12 +129,12 @@ class PostUpdate
|
|||
private static function update1297()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1297) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1297) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('item-delivery-data')) {
|
||||
DI::config()->set('system', 'post_update_version', 1297);
|
||||
DI::keyValue()->set('post_update_version', 1297);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ class PostUpdate
|
|||
|
||||
Logger::info('Processed rows: ' . DBA::affectedRows());
|
||||
|
||||
DI::config()->set('system', 'post_update_version', 1297);
|
||||
DI::keyValue()->set('post_update_version', 1297);
|
||||
|
||||
Logger::info('Done');
|
||||
|
||||
|
@ -169,7 +169,7 @@ class PostUpdate
|
|||
private static function update1322()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1322) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1322) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ class PostUpdate
|
|||
}
|
||||
|
||||
DBA::close($contact);
|
||||
DI::config()->set('system', 'post_update_version', 1322);
|
||||
DI::keyValue()->set('post_update_version', 1322);
|
||||
|
||||
Logger::info('Done');
|
||||
|
||||
|
@ -204,16 +204,16 @@ class PostUpdate
|
|||
private static function update1329()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1329) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1329) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('item')) {
|
||||
DI::config()->set('system', 'post_update_version', 1329);
|
||||
DI::keyValue()->set('post_update_version', 1329);
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1329_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1329_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['item' => $id]);
|
||||
|
||||
|
@ -237,12 +237,12 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($items);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1329_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1329_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
if ($start_id == $id) {
|
||||
DI::config()->set('system', 'post_update_version', 1329);
|
||||
DI::keyValue()->set('post_update_version', 1329);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -259,16 +259,16 @@ class PostUpdate
|
|||
private static function update1341()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1341) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1341) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('item-content')) {
|
||||
DI::config()->set('system', 'post_update_version', 1342);
|
||||
DI::keyValue()->set('post_update_version', 1342);
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1341_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1341_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['item' => $id]);
|
||||
|
||||
|
@ -288,19 +288,19 @@ class PostUpdate
|
|||
$id = $item['uri-id'];
|
||||
++$rows;
|
||||
if ($rows % 1000 == 0) {
|
||||
DI::config()->set('system', 'post_update_version_1341_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1341_id', $id);
|
||||
}
|
||||
}
|
||||
DBA::close($items);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1341_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1341_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
// When there are less than 1,000 items processed this means that we reached the end
|
||||
// The other entries will then be processed with the regular functionality
|
||||
if ($rows < 1000) {
|
||||
DI::config()->set('system', 'post_update_version', 1341);
|
||||
DI::keyValue()->set('post_update_version', 1341);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -317,16 +317,16 @@ class PostUpdate
|
|||
private static function update1342()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1342) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1342) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('term') || !DBStructure::existsTable('item-content')) {
|
||||
DI::config()->set('system', 'post_update_version', 1342);
|
||||
DI::keyValue()->set('post_update_version', 1342);
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1342_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1342_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['item' => $id]);
|
||||
|
||||
|
@ -364,19 +364,19 @@ class PostUpdate
|
|||
$id = $term['tid'];
|
||||
++$rows;
|
||||
if ($rows % 1000 == 0) {
|
||||
DI::config()->set('system', 'post_update_version_1342_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1342_id', $id);
|
||||
}
|
||||
}
|
||||
DBA::close($terms);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1342_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1342_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
// When there are less than 1,000 items processed this means that we reached the end
|
||||
// The other entries will then be processed with the regular functionality
|
||||
if ($rows < 1000) {
|
||||
DI::config()->set('system', 'post_update_version', 1342);
|
||||
DI::keyValue()->set('post_update_version', 1342);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -393,16 +393,16 @@ class PostUpdate
|
|||
private static function update1345()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1345) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1345) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('item-delivery-data')) {
|
||||
DI::config()->set('system', 'post_update_version', 1345);
|
||||
DI::keyValue()->set('post_update_version', 1345);
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1345_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1345_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['item' => $id]);
|
||||
|
||||
|
@ -427,14 +427,14 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($deliveries);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1345_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1345_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
// When there are less than 100 items processed this means that we reached the end
|
||||
// The other entries will then be processed with the regular functionality
|
||||
if ($rows < 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1345);
|
||||
DI::keyValue()->set('post_update_version', 1345);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -476,16 +476,16 @@ class PostUpdate
|
|||
private static function update1346()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1346) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1346) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('term')) {
|
||||
DI::config()->set('system', 'post_update_version', 1346);
|
||||
DI::keyValue()->set('post_update_version', 1346);
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1346_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1346_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['item' => $id]);
|
||||
|
||||
|
@ -514,19 +514,19 @@ class PostUpdate
|
|||
$id = $term['oid'];
|
||||
++$rows;
|
||||
if ($rows % 100 == 0) {
|
||||
DI::config()->set('system', 'post_update_version_1346_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1346_id', $id);
|
||||
}
|
||||
}
|
||||
DBA::close($terms);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1346_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1346_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
// When there are less than 10 items processed this means that we reached the end
|
||||
// The other entries will then be processed with the regular functionality
|
||||
if ($rows < 10) {
|
||||
DI::config()->set('system', 'post_update_version', 1346);
|
||||
DI::keyValue()->set('post_update_version', 1346);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -544,16 +544,16 @@ class PostUpdate
|
|||
private static function update1347()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1347) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1347) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('item-activity') || !DBStructure::existsTable('item')) {
|
||||
DI::config()->set('system', 'post_update_version', 1347);
|
||||
DI::keyValue()->set('post_update_version', 1347);
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1347_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1347_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['item' => $id]);
|
||||
|
||||
|
@ -588,12 +588,12 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($items);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1347_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1347_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
if ($start_id == $id) {
|
||||
DI::config()->set('system', 'post_update_version', 1347);
|
||||
DI::keyValue()->set('post_update_version', 1347);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -611,11 +611,11 @@ class PostUpdate
|
|||
private static function update1348()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1348) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1348) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1348_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1348_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['contact' => $id]);
|
||||
|
||||
|
@ -641,12 +641,12 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($contacts);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1348_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1348_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
if ($start_id == $id) {
|
||||
DI::config()->set('system', 'post_update_version', 1348);
|
||||
DI::keyValue()->set('post_update_version', 1348);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -664,11 +664,11 @@ class PostUpdate
|
|||
private static function update1349()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1349) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1349) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1349_id', '');
|
||||
$id = DI::keyValue()->get('post_update_version_1349_id') ?? '';
|
||||
|
||||
Logger::info('Start', ['apcontact' => $id]);
|
||||
|
||||
|
@ -694,12 +694,12 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($apcontacts);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1349_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1349_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
if ($start_id == $id) {
|
||||
DI::config()->set('system', 'post_update_version', 1349);
|
||||
DI::keyValue()->set('post_update_version', 1349);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ class PostUpdate
|
|||
private static function update1383()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1383) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1383) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -743,7 +743,7 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($photos);
|
||||
|
||||
DI::config()->set('system', 'post_update_version', 1383);
|
||||
DI::keyValue()->set('post_update_version', 1383);
|
||||
Logger::info('Done', ['deleted' => $deleted]);
|
||||
return true;
|
||||
}
|
||||
|
@ -758,7 +758,7 @@ class PostUpdate
|
|||
private static function update1384()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1384) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1384) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ class PostUpdate
|
|||
Logger::info('Processed', ['rows' => $rows]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1384);
|
||||
DI::keyValue()->set('post_update_version', 1384);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -806,12 +806,12 @@ class PostUpdate
|
|||
private static function update1400()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1400) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1400) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('item')) {
|
||||
DI::config()->set('system', 'post_update_version', 1400);
|
||||
DI::keyValue()->set('post_update_version', 1400);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -835,7 +835,7 @@ class PostUpdate
|
|||
Logger::info('Processed', ['rows' => $rows]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1400);
|
||||
DI::keyValue()->set('post_update_version', 1400);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -853,7 +853,7 @@ class PostUpdate
|
|||
private static function update1424()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1424) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1424) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -877,7 +877,7 @@ class PostUpdate
|
|||
Logger::info('Processed', ['rows' => $rows]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1424);
|
||||
DI::keyValue()->set('post_update_version', 1424);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -895,12 +895,12 @@ class PostUpdate
|
|||
private static function update1425()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1425) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1425) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('fcontact')) {
|
||||
DI::config()->set('system', 'post_update_version', 1425);
|
||||
DI::keyValue()->set('post_update_version', 1425);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -929,7 +929,7 @@ class PostUpdate
|
|||
Logger::info('Processed', ['rows' => $rows]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1425);
|
||||
DI::keyValue()->set('post_update_version', 1425);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ class PostUpdate
|
|||
private static function update1426()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1426) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1426) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -976,7 +976,7 @@ class PostUpdate
|
|||
Logger::info('Processed', ['rows' => $rows]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1426);
|
||||
DI::keyValue()->set('post_update_version', 1426);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ class PostUpdate
|
|||
private static function update1427()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1427) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1427) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ class PostUpdate
|
|||
Logger::info('Processed', ['rows' => $rows]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1427);
|
||||
DI::keyValue()->set('post_update_version', 1427);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -1041,16 +1041,16 @@ class PostUpdate
|
|||
private static function update1452()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1452) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1452) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!DBStructure::existsTable('conversation')) {
|
||||
DI::config()->set('system', 'post_update_version', 1452);
|
||||
DI::keyValue()->set('post_update_version', 1452);
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1452_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1452_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['uri-id' => $id]);
|
||||
|
||||
|
@ -1089,12 +1089,12 @@ class PostUpdate
|
|||
|
||||
DBA::close($conversations);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1452_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1452_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id, 'last-received' => $received]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1452);
|
||||
DI::keyValue()->set('post_update_version', 1452);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -1113,7 +1113,7 @@ class PostUpdate
|
|||
private static function update1483()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1483) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1483) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1129,7 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($posts);
|
||||
|
||||
DI::config()->set('system', 'post_update_version', 1483);
|
||||
DI::keyValue()->set('post_update_version', 1483);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
@ -1144,11 +1144,11 @@ class PostUpdate
|
|||
private static function update1484()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (DI::config()->get('system', 'post_update_version') >= 1484) {
|
||||
if (DI::keyValue()->get('post_update_version') >= 1484) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = DI::config()->get('system', 'post_update_version_1484_id', 0);
|
||||
$id = DI::keyValue()->get('post_update_version_1484_id') ?? 0;
|
||||
|
||||
Logger::info('Start', ['id' => $id]);
|
||||
|
||||
|
@ -1172,12 +1172,12 @@ class PostUpdate
|
|||
}
|
||||
DBA::close($contacts);
|
||||
|
||||
DI::config()->set('system', 'post_update_version_1484_id', $id);
|
||||
DI::keyValue()->set('post_update_version_1484_id', $id);
|
||||
|
||||
Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
|
||||
|
||||
if ($rows <= 100) {
|
||||
DI::config()->set('system', 'post_update_version', 1484);
|
||||
DI::keyValue()->set('post_update_version', 1484);
|
||||
Logger::info('Done');
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -624,7 +624,7 @@ class Contact
|
|||
public static function getPublicAndUserContactID(int $cid, int $uid): array
|
||||
{
|
||||
// We have to use the legacy function as long as the post update hasn't finished
|
||||
if (DI::config()->get('system', 'post_update_version') < 1427) {
|
||||
if (DI::keyValue()->get('post_update_version') < 1427) {
|
||||
return self::legacyGetPublicAndUserContactID($cid, $uid);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ class Friendica extends BaseModule
|
|||
protected function content(array $request = []): string
|
||||
{
|
||||
$config = DI::config();
|
||||
$keyValue = DI::keyValue();
|
||||
|
||||
$visibleAddonList = Addon::getVisibleList();
|
||||
if (!empty($visibleAddonList)) {
|
||||
|
@ -100,7 +101,7 @@ class Friendica extends BaseModule
|
|||
'<strong>' . App::VERSION . '</strong>',
|
||||
DI::baseUrl()->get(),
|
||||
'<strong>' . $config->get('system', 'build') . '/' . DB_UPDATE_VERSION . '</strong>',
|
||||
'<strong>' . $config->get('system', 'post_update_version') . '/' . PostUpdate::VERSION . '</strong>'),
|
||||
'<strong>' . $keyValue->get('post_update_version') . '/' . PostUpdate::VERSION . '</strong>'),
|
||||
'friendica' => DI::l10n()->t('Please visit <a href="https://friendi.ca">Friendi.ca</a> to learn more about the Friendica project.'),
|
||||
'bugs' => DI::l10n()->t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">' . DI::l10n()->t('the bugtracker at github') . '</a>',
|
||||
'info' => DI::l10n()->t('Suggestions, praise, etc. - please email "info" at "friendi - dot - ca'),
|
||||
|
|
13
update.php
13
update.php
|
@ -982,7 +982,7 @@ function update_1429()
|
|||
return Update::FAILED;
|
||||
}
|
||||
|
||||
DI::config()->set('system', 'post_update_version', 1423);
|
||||
DI::keyValue()->set('post_update_version', 1423);
|
||||
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
@ -1145,3 +1145,14 @@ function update_1502()
|
|||
DBA::e("UPDATE `pconfig` SET `cat` = 'calendar' WHERE `k` = 'first_day_of_week'");
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
||||
function update_1505()
|
||||
{
|
||||
$postUpdateEntries = DBA::selectToArray('config', ['k', 'v'], ["`k` LIKE ?", "post_update_%"]);
|
||||
|
||||
foreach ($postUpdateEntries as $postUpdateEntry) {
|
||||
DI::keyValue()->set($postUpdateEntry['k'], $postUpdateEntry['v']);
|
||||
}
|
||||
|
||||
return DBA::delete('config', ["`k` LIKE ?", "post_update_%"]) ? Update::SUCCESS : Update::FAILED;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue