mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-05-14 01:49:20 +02:00
This script will convert premium points already aquired using Modern or Gesior AAC and make it work with the Znote AAC shop.
(Moves points from accounts.premium_points -> znote_account.points)
This commit is contained in:
parent
de5255ba52
commit
19b8b0af5d
32
special/convertoldshoppoints.php
Normal file
32
special/convertoldshoppoints.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
require '../config.php';
|
||||||
|
require '../engine/database/connect.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Gesior and Modern shop points to Znote AAC shop points</h1>
|
||||||
|
<p>Convert donation/shop points from previous Gesior/Modern installation to Znote AAC:</p>
|
||||||
|
<?php
|
||||||
|
$accounts = mysql_select_multi("SELECT `id`, `premium_points` FROM `accounts` WHERE `premium_points`>'0';");
|
||||||
|
$accountids = array();
|
||||||
|
foreach ($accounts as $acc) $accountids[] = $acc['id'];
|
||||||
|
$accidlist = join(',',$accountids);
|
||||||
|
|
||||||
|
if ($accounts !== false) echo "<p>Detected: ". count($accounts) ." accounts who have points in old system.</p>";
|
||||||
|
else die("<h1>All accounts already converted. :)</h1>");
|
||||||
|
|
||||||
|
$znote_accounts = mysql_select_multi("SELECT `account_id`, `points` FROM `znote_accounts` WHERE `account_id` IN ($accidlist);");
|
||||||
|
|
||||||
|
if (count($accounts) !== count($znote_accounts)) die("<h1><font color='red'>Failed to syncronize accounts. You need to convert all accounts to Znote AAC first!</font></h1>");
|
||||||
|
|
||||||
|
// Order old accounts by id.
|
||||||
|
$idaccounts = array();
|
||||||
|
foreach ($accounts as $acc) {
|
||||||
|
$idaccounts[$acc['id']] = $acc['premium_points'];
|
||||||
|
}
|
||||||
|
foreach ($znote_accounts as $acc) {
|
||||||
|
mysql_update("UPDATE `znote_accounts` SET `points`='". ($acc['points'] + $idaccounts[$acc['account_id']]) ."' WHERE `account_id`='". $acc['account_id'] ."' LIMIT 1;");
|
||||||
|
}
|
||||||
|
mysql_update("UPDATE `accounts` SET `premium_points`='0';");
|
||||||
|
|
||||||
|
echo "<h1><font color='green'>Successfully converted all points!</font></h1>";
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user