AvocadoAmber/AvocadoEdition_Light/classes/community/community.class.php

90 lines
2.3 KiB
PHP

<?php
class Community extends Module
{
/**
* @var bool $is_init
*/
protected static $is_init;
public static function getCommunityDatabases()
{
global $g5;
if (!isset($g5)) {
return [];
}
return [
"인트로" => $g5['intro_table'],
"호출" => $g5['call_table'],
"캐릭터" => $g5['character_table'],
"캐릭터: 추가 필드 설정" => $g5["article_table"],
"캐릭터: 추가 필드 기본값" => $g5["article_default_table"],
"캐릭터: 추가 필드 값" => $g5["value_table"],
"캐릭터: 관계 설정" => $g5['relation_table'],
"캐릭터: 클래스" => $g5['class_table'],
"캐릭터: 소속" => $g5['side_table'],
"캐릭터: 타이틀" => $g5['title_table'],
"캐릭터: 보유 타이틀" => $g5['title_has_table'],
"캐릭터: 커플" => $g5['couple_table'],
"캐릭터: 경험치" => $g5['exp_table'],
"캐릭터: 인벤토리" => $g5['inventory_table'],
"캐릭터: 옷장" => $g5['closthes_table'],
"캐릭터: 레벨" => $g5['level_table'],
"캐릭터: 상태" => $g5['status_config_table'],
"캐릭터: 보유 상태" => $g5['status_table'],
"캐릭터: 퀘스트" => $g5['quest_table'],
"아이템" => $g5['item_table'],
"아이템: 사용 기록" => $g5['item_modify_table'],
"아이템: 획득 기록" => $g5['explorer_table'],
"아이템: 구매 기록" => $g5['order_table'],
"아이템: 레시피" => $g5['recepi_table'],
"아이템: 상점" => $g5['shop_table']
];
}
public static function isInitCommunity()
{
global $g5;
if (!isset($g5)) {
return false;
}
if (isset(self::$is_init)) {
return self::$is_init;
}
$items = self::getCommunityDatabases();
foreach($items as $item) {
if (!sql_table_exists($item)) {
self::$is_init = false;
return false;
}
}
self::$is_init = true;
return true;
}
public static function checkDatabase()
{
global $g5;
if (!isset($g5)) {
return [];
}
$items = self::getCommunityDatabases();
$not_installed = [];
foreach($items as $key => $item) {
if (!sql_table_exists($item)) {
$not_installed[$key] = $item;
}
}
return $not_installed;
}
}