Skip to content

Commit 42fb5da

Browse files
committed
Added max count for requests to fakester.biz at a time
1 parent 440cedf commit 42fb5da

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

app/code/community/IntegerNet/Anonymizer/Model/Anonymizer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ class IntegerNet_Anonymizer_Model_Anonymizer
1717
protected $_anonymizedQuoteAddressIds = array();
1818
protected $_anonymizedNewsletterSubscriberIds = array();
1919

20+
const MAX_FAKESTER_REQUEST_COUNT = 100;
21+
2022
public function anonymizeAll()
2123
{
2224
/** @var $customers Mage_Customer_Model_Resource_Customer_Collection */
2325
$customers = Mage::getModel('customer/customer')
2426
->getCollection()
2527
->addAttributeToSelect(array('prefix', 'firstname', 'lastname', 'suffix'));
2628

27-
$customerCount = $customers->getSize();
28-
29-
$this->_fetchRandomCustomerData($customerCount * 2);
29+
$this->_fetchRandomCustomerData($customers->getSize() * 2);
3030

3131
$this->_anonymizeCustomers($customers);
3232

@@ -509,6 +509,7 @@ protected function _getRandomData()
509509
*/
510510
protected function _fetchRandomCustomerData($count)
511511
{
512+
$count = min($count, self::MAX_FAKESTER_REQUEST_COUNT);
512513
$url = "http://fakester.biz/json?n=$count";
513514
$json = file_get_contents($url);
514515
if ($json === false) {

0 commit comments

Comments
 (0)