forked from GNUsocial/gnu-social
initialize the local_group table
This commit is contained in:
parent
5d54b6019e
commit
f77c850b80
@ -41,8 +41,9 @@ function main()
|
|||||||
fixupNoticeRendered();
|
fixupNoticeRendered();
|
||||||
fixupNoticeConversation();
|
fixupNoticeConversation();
|
||||||
initConversation();
|
initConversation();
|
||||||
fixupGroupURI();
|
|
||||||
initInbox();
|
initInbox();
|
||||||
|
fixupGroupURI();
|
||||||
|
initLocalGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
function tableDefs()
|
function tableDefs()
|
||||||
@ -228,4 +229,33 @@ function initInbox()
|
|||||||
printfnq("DONE.\n");
|
printfnq("DONE.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initLocalGroup()
|
||||||
|
{
|
||||||
|
printfnq("Ensuring all local user groups have a local_group...");
|
||||||
|
|
||||||
|
$group = new User_group();
|
||||||
|
$group->whereAdd('NOT EXISTS (select group_id from local_group where group_id = user_group.id)');
|
||||||
|
$group->find();
|
||||||
|
|
||||||
|
while ($group->fetch()) {
|
||||||
|
try {
|
||||||
|
// Hack to check for local groups
|
||||||
|
if ($group->getUri() == common_local_url('groupbyid', array('id' => $group->id))) {
|
||||||
|
$lg = new Local_group();
|
||||||
|
|
||||||
|
$lg->group_id = $group->id;
|
||||||
|
$lg->nickname = $group->nickname;
|
||||||
|
$lg->created = $group->created; // XXX: common_sql_now() ?
|
||||||
|
$lg->modified = $group->modified;
|
||||||
|
|
||||||
|
$lg->insert();
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
printfv("Error initializing local group for {$group->nickname}:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printfnq("DONE.\n");
|
||||||
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
Loading…
Reference in New Issue
Block a user