mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-30 19:03:25 +01:00
Add migrate access_codes
This commit is contained in:
+1
-1
@@ -102,7 +102,7 @@ if (!isset(CoreUtilities::$rRequest['update'])):
|
||||
$odb->query("SHOW TABLES LIKE 'access_codes';");
|
||||
|
||||
if ($odb->num_rows() > 0) {
|
||||
$rCount = array('users' => array('Users & Resellers', 0), 'blocked_ips' => array('Blocked IP Addresses', 0), 'blocked_uas' => array('Blocked User-Agents', 0), 'blocked_isps' => array("Blocked ISP's", 0), 'bouquets' => array('Bouquets', 0), 'enigma2_devices' => array('Device Info - Engima2', 0), 'mag_devices' => array('Device Info - MAG', 0), 'epg' => array('EPG Providers ', 0), 'users_groups' => array('User Groups', 0), 'users_packages' => array('User Packages', 0), 'rtmp_ips' => array("RTMP IP's", 0), 'streams_series' => array('TV Series', 0), 'streams_episodes' => array('TV Episodes', 0), 'servers' => array('Servers - Load Balancers', 0), 'streams' => array('Streams - Live, Radio, Created & VOD', 0), 'streams_options' => array('Stream Options', 0), 'streams_servers' => array('Stream Servers', 0), 'streams_categories' => array('Stream Categories', 0), 'tickets' => array('Tickets', 0), 'tickets_replies' => array('Ticket Replies', 0), 'profiles' => array('Transcoding Profile', 0), 'lines' => array('Lines - Standard, MAG & Enigma2 Devices', 0), 'watch_folders' => array('Watch Folders', 0));
|
||||
$rCount = array('access_codes' => array('Access Codes', 0), 'users' => array('Users & Resellers', 0), 'blocked_ips' => array('Blocked IP Addresses', 0), 'blocked_uas' => array('Blocked User-Agents', 0), 'blocked_isps' => array("Blocked ISP's", 0), 'bouquets' => array('Bouquets', 0), 'enigma2_devices' => array('Device Info - Engima2', 0), 'mag_devices' => array('Device Info - MAG', 0), 'epg' => array('EPG Providers ', 0), 'users_groups' => array('User Groups', 0), 'users_packages' => array('User Packages', 0), 'rtmp_ips' => array("RTMP IP's", 0), 'streams_series' => array('TV Series', 0), 'streams_episodes' => array('TV Episodes', 0), 'servers' => array('Servers - Load Balancers', 0), 'streams' => array('Streams - Live, Radio, Created & VOD', 0), 'streams_options' => array('Stream Options', 0), 'streams_servers' => array('Stream Servers', 0), 'streams_categories' => array('Stream Categories', 0), 'tickets' => array('Tickets', 0), 'tickets_replies' => array('Ticket Replies', 0), 'profiles' => array('Transcoding Profile', 0), 'lines' => array('Lines - Standard, MAG & Enigma2 Devices', 0), 'watch_folders' => array('Watch Folders', 0));
|
||||
} else {
|
||||
$rCount = array('reg_users' => array('Users & Resellers', 0), 'users' => array('Lines - Standard, MAG & Enigma2 Devices', 0), 'enigma2_devices' => array('Device Info - Engima2', 0), 'mag_devices' => array('Device Info - MAG', 0), 'user_output' => array('Line Output - HLS, MPEG-TS & RTMP', 0), 'streaming_servers' => array('Servers - Load Balancers', 0), 'series' => array('TV Series', 0), 'series_episodes' => array('TV Episodes', 0), 'streams' => array('Streams - Live, Radio, Created & VOD', 0), 'streams_sys' => array('Stream Servers', 0), 'streams_options' => array('Stream Options', 0), 'stream_categories' => array('Stream Categories', 0), 'bouquets' => array('Bouquets', 0), 'member_groups' => array('Member Groups', 0), 'packages' => array('Reseller Packages', 0), 'rtmp_ips' => array("RTMP IP's", 0), 'epg' => array('EPG Providers ', 0), 'blocked_ips' => array('Blocked IP Addresses', 0), 'blocked_user_agents' => array('Blocked User-Agents', 0), 'isp_addon' => array("Blocked ISP's", 0), 'tickets' => array('Tickets', 0), 'tickets_replies' => array('Ticket Replies', 0), 'transcoding_profiles' => array('Transcoding Profile', 0), 'watch_folders' => array('Watch Folders', 0), 'members' => array('Users & Resellers', 0), 'epg_sources' => array('EPG Providers', 0), 'blocked_isps' => array("Blocked ISP's", 0), 'categories' => array('Stream Categories', 0), 'groups' => array('Member Groups', 0), 'servers' => array('Servers - Load Balancers', 0), 'stream_servers' => array('Stream Servers', 0));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ ini_set('memory_limit', -1);
|
||||
if (!$argc) {
|
||||
exit(0);
|
||||
}
|
||||
$rXUITableList = array('users', 'blocked_ips', 'blocked_uas', 'blocked_isps', 'bouquets', 'enigma2_devices', 'mag_devices', 'epg', 'users_groups', 'users_packages', 'rtmp_ips', 'streams_series', 'streams_episodes', 'servers', 'streams', 'streams_options', 'streams_servers', 'streams_categories', 'tickets', 'tickets_replies', 'profiles', 'lines', 'watch_folders');
|
||||
$rXUITableList = array('access_codes', 'users', 'blocked_ips', 'blocked_uas', 'blocked_isps', 'bouquets', 'enigma2_devices', 'mag_devices', 'epg', 'users_groups', 'users_packages', 'rtmp_ips', 'streams_series', 'streams_episodes', 'servers', 'streams', 'streams_options', 'streams_servers', 'streams_categories', 'tickets', 'tickets_replies', 'profiles', 'lines', 'watch_folders');
|
||||
$rTableList = array('reg_users', 'users', 'enigma2_devices', 'mag_devices', 'user_output', 'streaming_servers', 'series', 'series_episodes', 'streams', 'streams_sys', 'streams_options', 'stream_categories', 'bouquets', 'member_groups', 'packages', 'rtmp_ips', 'epg', 'blocked_ips', 'blocked_user_agents', 'isp_addon', 'tickets', 'tickets_replies', 'transcoding_profiles', 'watch_folders', 'categories', 'epg_sources', 'members', 'blocked_isps', 'groups', 'servers', 'stream_servers');
|
||||
$rMigrateOptions = (json_decode(file_get_contents(TMP_PATH . '.migration.options'), true) ?: array());
|
||||
|
||||
@@ -20,6 +20,7 @@ if (!$odb->connected) {
|
||||
echo 'Connected to migration database.' . "\n";
|
||||
$odb->query("SHOW TABLES LIKE 'access_codes';");
|
||||
if ($odb->num_rows() > 0) {
|
||||
$AdminAccesCode = '';
|
||||
if (count($rMigrateOptions) == 0) {
|
||||
$rMigrateOptions = $rXUITableList;
|
||||
}
|
||||
@@ -37,6 +38,28 @@ if ($odb->num_rows() > 0) {
|
||||
}
|
||||
echo "\n" . 'Migrating database to XC_VM...' . "\n\n";
|
||||
|
||||
if (in_array('access_codes', $rMigrateOptions)) {
|
||||
$odb->query('SELECT * FROM `access_codes`;');
|
||||
$rResults = $odb->get_rows();
|
||||
if (count($rResults) > 0) {
|
||||
$db->query('TRUNCATE `access_codes`;');
|
||||
echo 'Add ' . number_format(count($rResults), 0) . ' access codes.' . "\n";
|
||||
foreach ($rResults as $rResult) {
|
||||
try {
|
||||
if ($rResult['type'] == 0) {
|
||||
$AdminAccesCode = $rResult['code'];
|
||||
}
|
||||
$rResult = verifyPostTable('access_codes', $rResult);
|
||||
$rPrepare = prepareArray($rResult);
|
||||
$rQuery = 'INSERT INTO `access_codes`(' . $rPrepare['columns'] . ') VALUES(' . $rPrepare['placeholder'] . ');';
|
||||
$db->query($rQuery, ...$rPrepare['data']);
|
||||
updateCodes();
|
||||
} catch (Exception $e) {
|
||||
echo 'Error: ' . $e . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (in_array('users', $rMigrateOptions)) {
|
||||
$odb->query('SELECT COUNT(*) AS `count` FROM `users`;');
|
||||
$rCount = $odb->get_row()['count'];
|
||||
@@ -1537,7 +1560,11 @@ try {
|
||||
} catch (Exception $e) {
|
||||
echo 'Error: ' . $e . "\n";
|
||||
}
|
||||
if (in_array('access_codes', $rMigrateOptions)) {
|
||||
echo "\n".'Admin acces code: ' . $AdminAccesCode;
|
||||
}
|
||||
echo "\n" . 'Migration has been completed!' . "\n\n" . 'Your settings have been reset to the XC_VM default, please take some time to review the settings page and make the desired changes.' . "\n";
|
||||
|
||||
file_put_contents(TMP_PATH . '.migration.status', 2);
|
||||
if (is_object($odb)) {
|
||||
$odb->close_mysql();
|
||||
|
||||
Reference in New Issue
Block a user