-
Notifications
You must be signed in to change notification settings - Fork 1
/
reset.php
39 lines (35 loc) · 864 Bytes
/
reset.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
$data = file("/root/btct.password");
$config = array();
foreach($data as $d){
$d = preg_split('/\s+/', $d, 3);
$config[$d[1]] = stripcslashes(substr($d[2], 1, -2));
}
$m = new MongoClient("mongodb://{$config['MONGO_USER']}:{$config['MONGO_PASSWORD']}@{$config['MONGO_IP']}", array('db' => $config['MONGO_SOURCE']));
try{
$m->btct->orders->drop();
}catch(Exception $e){}
try{
$m->btct->currencies->drop();
}catch(Exception $e){}
try{
$m->btct->markets->drop();
}catch(Exception $e){}
try{
$m->btct->transactions->drop();
}catch(Exception $e){}
$currencies = $m->selectCollection('btct', 'currencies');
$markets = $m->selectCollection('btct', 'markets');
$currencies->insert(array(
'_id' => 0,
'name' => 'usd'
));
$currencies->insert(array(
'_id' => 1,
'name' => 'btc'
));
$markets->insert(array(
'_id' => 1,
'c1' => 'usd',
'c2' => 'btc',
));