making update really work ...
This commit is contained in:
parent
dbd5b5bb6e
commit
d6fab6b06b
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2020.03-dev (Dalmatian Bellflower)
|
-- Friendica 2020.03-dev (Dalmatian Bellflower)
|
||||||
-- DB_UPDATE_VERSION 1329
|
-- DB_UPDATE_VERSION 1330
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1329);
|
define('DB_UPDATE_VERSION', 1330);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
27
update.php
27
update.php
|
@ -12,6 +12,7 @@ use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
use Friendica\Model\Storage;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Worker\Delivery;
|
use Friendica\Worker\Delivery;
|
||||||
|
|
||||||
|
@ -408,24 +409,30 @@ function update_1327()
|
||||||
return Update::SUCCESS;
|
return Update::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_1329()
|
function update_1330()
|
||||||
{
|
{
|
||||||
$currStorage = Config::get('storage', 'class', '');
|
$currStorage = Config::get('storage', 'class', '');
|
||||||
|
|
||||||
if (!empty($currStorage)) {
|
if (!empty($currStorage)) {
|
||||||
$storageName = array_key_first(\Friendica\Core\StorageManager::DEFAULT_BACKENDS, $currStorage);
|
$storageName = array_key_first(\Friendica\Core\StorageManager::DEFAULT_BACKENDS, $currStorage);
|
||||||
Config::set('storage', 'name', $storageName);
|
if (!Config::set('storage', 'name', $storageName) ||
|
||||||
Config::delete('storage', 'class');
|
!Config::delete('storage', 'class')) {
|
||||||
|
return Update::FAILED;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$photos = DBA::select('photos', ['backend-class', 'id'], ['backend-class IS NOT NULL']);
|
// Update photos
|
||||||
foreach ($photos as $photo) {
|
if (!DBA::update('photo', ['backend-class' => Storage\Filesystem::NAME], ['backend-class' => 'Friendica\Model\Storage\Filesystem']) ||
|
||||||
DBA::update('photos', ['backend-class' => $photo['backend-class']::NAME], ['id' => $photo['id']]);
|
!DBA::update('photo', ['backend-class' => Storage\Database::NAME], ['backend-class' => 'Friendica\Model\Storage\Database']) ||
|
||||||
}
|
!DBA::update('photo', ['backend-class' => Storage\SystemResource::NAME], ['backend-class' => 'Friendica\Model\Storage\SystemResource'])) {
|
||||||
|
return Update::FAILED;
|
||||||
|
};
|
||||||
|
|
||||||
$attachs = DBA::select('attach', ['backend-class', 'id'], ['backend-class IS NOT NULL']);
|
// update attachments
|
||||||
foreach ($attachs as $attach) {
|
if (!DBA::update('attach', ['backend-class' => Storage\Filesystem::NAME], ['backend-class' => 'Friendica\Model\Storage\Filesystem']) ||
|
||||||
DBA::update('photos', ['backend-class' => $attach['backend-class']::NAME], ['id' => $attach['id']]);
|
!DBA::update('attach', ['backend-class' => Storage\Database::NAME], ['backend-class' => 'Friendica\Model\Storage\Database']) ||
|
||||||
|
!DBA::update('attach', ['backend-class' => Storage\SystemResource::NAME], ['backend-class' => 'Friendica\Model\Storage\SystemResource'])) {
|
||||||
|
return Update::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Update::SUCCESS;
|
return Update::SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user