Skip to content

Commit b9dbf2f

Browse files
committed
Multi tenant
1 parent 2e57ab2 commit b9dbf2f

File tree

416 files changed

+8267
-14686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

416 files changed

+8267
-14686
lines changed

Common/EntityMutation.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22
namespace Minds\Common;
33

4+
use Minds\Entities\EntityInterface;
45
use Minds\Entities\MutatableEntityInterface;
56
use Minds\Helpers;
67

78
class EntityMutation
89
{
9-
/** @var MutatableEntityInterface */
10+
/** @var EntityInterface */
1011
protected $originalEntity;
1112

12-
/** @var MutatableEntityInterface */
13+
/** @var EntityInterface */
1314
protected $mutatedEntity;
1415

1516
/** @var array */
@@ -118,7 +119,7 @@ public function getMutatedValues(): array
118119
* Returns the original entity
119120
* @return MutatableEntityInterface
120121
*/
121-
public function getOriginalEntity(): MutatableEntityInterface
122+
public function getOriginalEntity(): EntityInterface
122123
{
123124
return $this->originalEntity;
124125
}
@@ -127,7 +128,7 @@ public function getOriginalEntity(): MutatableEntityInterface
127128
* Returns the fully mutated entity
128129
* @return MutatableEntityInterface
129130
*/
130-
public function getMutatedEntity(): MutatableEntityInterface
131+
public function getMutatedEntity(): EntityInterface
131132
{
132133
return $this->mutatedEntity;
133134
}

Common/IpAddress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function get(): string
3636
if (is_array($ipHeader) && count($ipHeader)) {
3737
$ip = strtok($ipHeader[0], ",");
3838
} else {
39-
$ip = 'local';
39+
$ip = '127.0.0.1';
4040
}
4141
return $ip;
4242
}

Controllers/Cli/AbuseGuard.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

Controllers/Cli/Blockchain.php

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Minds\Core\Blockchain\EthPrice;
1414
use Minds\Core\Blockchain\Events\BoostEvent;
1515
use Minds\Core\Blockchain\Services;
16-
use Minds\Core\Blockchain\Purchase\Delegates\EthRate;
1716
use Minds\Core\Blockchain\Transactions\Transaction;
1817
use Minds\Core\Config\Config;
1918
use Minds\Core\Di\Di;
@@ -133,66 +132,6 @@ protected function filterCleanup()
133132
}
134133
}
135134

136-
public function testMul()
137-
{
138-
$manager = Di::_()->get('Blockchain\Purchase\Manager');
139-
$amount = "0.006868131868131868";
140-
$weiAmount = BigNumber::toPlain($amount, 18)->mul($manager->getEthTokenRate()); //convert to tokens
141-
var_dump($weiAmount);
142-
}
143-
144-
public function setRate()
145-
{
146-
error_reporting(E_ALL);
147-
ini_set('display_errors', 1);
148-
while (true) {
149-
$ethereum = Di::_()->get('Blockchain\Services\Ethereum');
150-
$config = Di::_()->get('Config');
151-
$ethRate = new EthRate;
152-
$ethPrice = new EthPrice;
153-
$ethPrice->setFrom(strtotime('24 hours ago'))
154-
->setTo(time())
155-
->get();
156-
157-
$eth = round($ethPrice->getNearestPrice(strtotime('1 minute ago')));
158-
$usd = 1.25;
159-
160-
$rate = round($eth/$usd);
161-
if ($rate % 2 !== 0) {
162-
$rate++;
163-
}
164-
165-
$txHash = $ethereum->sendRawTransaction($config->blockchain['contracts']['token_sale_event']['rate_pkey'], [
166-
'from' => $config->blockchain['contracts']['token_sale_event']['rate_address'],
167-
'to' => $config->blockchain['contracts']['token_sale_event']['contract_address'],
168-
'gasLimit' => BigNumber::_(200000)->toHex(true),
169-
'gasPrice' => BigNumber::_(25000000000)->toHex(true),
170-
'data' => $ethereum->encodeContractMethod('modifyRate(uint256)', [
171-
BigNumber::_($rate)->toHex(true),
172-
])
173-
]);
174-
175-
// Wait until mined before updating our backend
176-
177-
while (true) {
178-
sleep(1);
179-
$receipt = $ethereum->request('eth_getTransactionReceipt', [ $txHash ]);
180-
echo "\n Waiting for $txHash";
181-
if ($receipt && $receipt['status']) {
182-
if ($receipt['status'] !== '0x1') {
183-
echo "\n$txHash failed";
184-
}
185-
break;
186-
}
187-
}
188-
189-
$ethRate->set($rate);
190-
echo "\n Completed: new rate is $rate: $txHash";
191-
echo "\n Now sleeping for one hour";
192-
sleep(3600);
193-
}
194-
}
195-
196135
public function balance()
197136
{
198137
error_reporting(E_ALL);

Controllers/Cli/Email.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
use Minds\Core\Email\V2\Campaigns\Recurring\WireSent\WireSent;
1313
use Minds\Core\Email\V2\Delegates\DigestSender;
1414
use Minds\Core\Reports;
15-
use Minds\Core\Blockchain\Purchase\Delegates\IssuedTokenEmail;
16-
use Minds\Core\Blockchain\Purchase\Delegates\NewPurchaseEmail;
17-
use Minds\Core\Blockchain\Purchase\Purchase;
1815
use Minds\Core\Supermind;
1916
use Minds\Core\Email\V2\Campaigns\Recurring\Supermind\Supermind as SupermindEmail;
2017

@@ -280,28 +277,6 @@ public function testHackedAccount()
280277
}
281278
}
282279

283-
public function testTokenPurchase()
284-
{
285-
$issued = $this->getOpt('issued');
286-
$amount = $this->getOpt('amount') ?: 10 ** 18;
287-
288-
289-
$userGuid = $this->getOpt('userGuid');
290-
$user = new User($userGuid);
291-
292-
$purchase = new Purchase();
293-
$purchase->setUserGuid($userGuid)
294-
->setRequestedAmount($amount);
295-
296-
if ($issued) {
297-
$delegate = new IssuedTokenEmail();
298-
} else {
299-
$delegate = new NewPurchaseEmail();
300-
}
301-
302-
$delegate->send($purchase);
303-
}
304-
305280
public function testDigest()
306281
{
307282
$userGuid = $this->getOpt('userGuid');

Controllers/Cli/Migrations/ImageDimensions.php

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)