mirror of
https://github.com/friendica/friendica
synced 2024-11-17 20:23:40 +00:00
forumlist: dbupdate - new try
This commit is contained in:
parent
666e1198d4
commit
dd2ed42863
1 changed files with 33 additions and 20 deletions
53
update.php
53
update.php
|
@ -1662,48 +1662,61 @@ function update_1188() {
|
||||||
|
|
||||||
function update_1190() {
|
function update_1190() {
|
||||||
|
|
||||||
require_once('include/plugins.php');
|
require_once('include/plugin.php');
|
||||||
|
|
||||||
|
set_config('system', 'maintenance', 1);
|
||||||
|
|
||||||
if (plugin_enabled('forumlist')) {
|
if (plugin_enabled('forumlist')) {
|
||||||
$plugin = 'forumlist';
|
$plugin = 'forumlist';
|
||||||
$plugins = get_config('system','addon');
|
$plugins = get_config('system','addon');
|
||||||
$plugins_arr = array();
|
$plugins_arr = array();
|
||||||
|
|
||||||
if($plugins) {
|
if($plugins) {
|
||||||
$plugins_arr = explode(',',str_replace(' ', '',$plugins));
|
$plugins_arr = explode(",",str_replace(" ", "",$plugins));
|
||||||
|
|
||||||
$idx = array_search($plugin, $plugins_arr);
|
$idx = array_search($plugin, $plugins_arr);
|
||||||
if ($idx !== false){
|
if ($idx !== false){
|
||||||
unset($plugins_arr[$idx]);
|
unset($plugins_arr[$idx]);
|
||||||
uninstall_plugin($plugin);
|
uninstall_plugin($plugin);
|
||||||
set_config('system','addon', implode(', ',$plugins_arr));
|
set_config('system','addon', implode(", ",$plugins_arr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `uid`, `cat`, `k`, `v` FROM `pconfig` WHERE `cat` = '%d' ",
|
// select old formlist addon entries
|
||||||
|
$r = q("SELECT `uid`, `cat`, `k`, `v` FROM `pconfig` WHERE `cat` = '%s' ",
|
||||||
dbesc('forumlist')
|
dbesc('forumlist')
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($r as $rr) {
|
// convert old forumlist addon entries in new config entries
|
||||||
$uid = $rr['uid'];
|
if (count($r)) {
|
||||||
$family = $rr['cat'];
|
foreach ($r as $rr) {
|
||||||
$key = $rr['k'];
|
$uid = $rr['uid'];
|
||||||
$value = $rr['v'];
|
$family = $rr['cat'];
|
||||||
|
$key = $rr['k'];
|
||||||
|
$value = $rr['v'];
|
||||||
|
|
||||||
if ($key === 'randomize')
|
if ($key === 'randomise')
|
||||||
del_pconfig($uid,$family,$key);
|
del_pconfig($uid,$family,$key);
|
||||||
|
|
||||||
if ($key === 'show_on_profile') {
|
if ($key === 'show_on_profile') {
|
||||||
if ($value)
|
if ($value)
|
||||||
set_pconfig($uid,feature,forumlist_profile,$value);
|
set_pconfig($uid,feature,forumlist_profile,$value);
|
||||||
|
|
||||||
del_pconfig($uid,$family,$key);
|
del_pconfig($uid,$family,$key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($key === 'show_on_network') {
|
if ($key === 'show_on_network') {
|
||||||
if ($value)
|
if ($value)
|
||||||
set_pconfig($uid,feature,forumlist,$value);
|
set_pconfig($uid,feature,forumlist_widget,$value);
|
||||||
|
|
||||||
del_pconfig($uid,$family,$key);
|
del_pconfig($uid,$family,$key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_config('system', 'maintenance', 0);
|
||||||
|
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue