{"action":"created","comment":{"url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/comments/36059698","id":36059698,"diff_hunk":"@@ -78,53 +80,72 @@\n \n \t\ttry\n \t\t{\n-\t\t\t$client = new Zend_Http_Client(\"https://ui.codisto.com/create\", array( 'keepalive' => true, 'maxredirects' => 0 ));\n-\t\t\t$client->setHeaders('Content-Type', 'application/json');\n+\t\t\t$createLockFile = Mage::getBaseDir('var') . '/codisto-create-lock';\n+\n+\t\t\t$createLockDb = new PDO('sqlite:' . $createLockFile);\n+\t\t\t$createLockDb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n+\t\t\t$createLockDb->setAttribute(PDO::ATTR_TIMEOUT, 60);\n+\t\t\t$createLockDb->exec('BEGIN EXCLUSIVE TRANSACTION');\n+\n+\t\t\tMage::app()->getStore(0)->resetConfig();\n \n-\t\t\tfor($retry = 0; ; $retry++)\n+\t\t\t$MerchantID = Mage::getStoreConfig('codisto/merchantid', 0);\n+\t\t\t$HostKey = Mage::getStoreConfig('codisto/hostkey', 0);\n+\t\t\t\n+\t\t\tif(!isset($MerchantID) || !isset($HostKey))\n \t\t\t{\n-\t\t\t\ttry\n-\t\t\t\t{\n-\t\t\t\t\t$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);\n-\t\t\t\t\t$version = Mage::getVersion();\n-\t\t\t\t\t$storename = Mage::getStoreConfig('general/store_information/name', 0);\n-\t\t\t\t\t$email = $user->getEmail();\n+\t\t\t\t$client = new Zend_Http_Client(\"https://ui.codisto.com/create\", array( 'keepalive' => true, 'maxredirects' => 0 ));\n+\t\t\t\t$client->setHeaders('Content-Type', 'application/json');\n \n-\t\t\t\t\t$remoteResponse = $client->setRawData(json_encode(array( 'type' => 'magento', 'version' => Mage::getVersion(), 'url' => $url, 'email' => $email, 'storename' => $storename )))->request('POST');\n+\t\t\t\tfor($retry = 0; ; $retry++)\n+\t\t\t\t{\n+\t\t\t\t\ttry\n+\t\t\t\t\t{\n+\t\t\t\t\t\t$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);\n+\t\t\t\t\t\t$version = Mage::getVersion();\n+\t\t\t\t\t\t$storename = Mage::getStoreConfig('general/store_information/name', 0);\n+\t\t\t\t\t\t$email = $user->getEmail();\n \n-\t\t\t\t\tif(!$remoteResponse->isSuccessful())\n-\t\t\t\t\t\tthrow new Exception('Error Creating Account');\n+\t\t\t\t\t\t$remoteResponse = $client->setRawData(json_encode(array( 'type' => 'magento', 'version' => Mage::getVersion(), 'url' => $url, 'email' => $email, 'storename' => $storename )))->request('POST');\n \n-\t\t\t\t\t$data = json_decode($remoteResponse->getRawBody(), true);\n+\t\t\t\t\t\tif(!$remoteResponse->isSuccessful())\n+\t\t\t\t\t\t\tthrow new Exception('Error Creating Account');\n \n-\t\t\t\t\tif(isset($data['merchantid']) && $data['merchantid'] &&\n-\t\t\t\t\t\tisset($data['hostkey']) && $data['hostkey'])\n-\t\t\t\t\t{\n-\t\t\t\t\t\tMage::getModel(\"core/config\")->saveConfig(\"codisto/merchantid\", $data['merchantid']);\n-\t\t\t\t\t\tMage::getModel(\"core/config\")->saveConfig(\"codisto/hostkey\", $data['hostkey']);\n+\t\t\t\t\t\t// @codingStandardsIgnoreStart\n+\t\t\t\t\t\t$data = json_decode($remoteResponse->getRawBody(), true);\n+\t\t\t\t\t\t// @codingStandardsIgnoreEnd\n \n-\t\t\t\t\t\tunlink($lockFile);\n+\t\t\t\t\t\tif(isset($data['merchantid']) && $data['merchantid'] &&\n+\t\t\t\t\t\t\tisset($data['hostkey']) && $data['hostkey'])\n+\t\t\t\t\t\t{\n+\t\t\t\t\t\t\tMage::getModel(\"core/config\")->saveConfig(\"codisto/merchantid\", $data['merchantid']);\n+\t\t\t\t\t\t\tMage::getModel(\"core/config\")->saveConfig(\"codisto/hostkey\", $data['hostkey']);\n \n-\t\t\t\t\t\t$reindexRequired = true;\n+\t\t\t\t\t\t\t$reindexRequired = true;\n+\t\t\t\t\t\t}\n \t\t\t\t\t}\n-\t\t\t\t}\n-\t\t\t\tcatch(Exception $e)\n-\t\t\t\t{\n-\t\t\t\t\tif($retry < 3)\n+\t\t\t\t\tcatch(Exception $e)\n \t\t\t\t\t{\n-\t\t\t\t\t\tusleep(1000000);\n-\t\t\t\t\t\tcontinue;\n+\t\t\t\t\t\tif($retry < 3)\n+\t\t\t\t\t\t{\n+\t\t\t\t\t\t\tusleep(1000000);\n+\t\t\t\t\t\t\tcontinue;\n+\t\t\t\t\t\t}\n+\n+\t\t\t\t\t\tthrow $e;\n \t\t\t\t\t}\n \n-\t\t\t\t\tthrow $e;","path":"code/community/Codisto/Sync/data/codisto_setup/data-install-1.1.15.php","position":109,"original_position":109,"commit_id":"280e52bc8bfdb2d4a25bd9cd1b1c7c481b128efb","original_commit_id":"280e52bc8bfdb2d4a25bd9cd1b1c7c481b128efb","user":{"login":"bradmccormack","id":778979,"avatar_url":"https://avatars.githubusercontent.com/u/778979?v=3","gravatar_id":"","url":"https://api.github.com/users/bradmccormack","html_url":"https://github.com/bradmccormack","followers_url":"https://api.github.com/users/bradmccormack/followers","following_url":"https://api.github.com/users/bradmccormack/following{/other_user}","gists_url":"https://api.github.com/users/bradmccormack/gists{/gist_id}","starred_url":"https://api.github.com/users/bradmccormack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradmccormack/subscriptions","organizations_url":"https://api.github.com/users/bradmccormack/orgs","repos_url":"https://api.github.com/users/bradmccormack/repos","events_url":"https://api.github.com/users/bradmccormack/events{/privacy}","received_events_url":"https://api.github.com/users/bradmccormack/received_events","type":"User","site_admin":false},"body":"BOT ->  The function json_encode is not present in PHP version 5.1 or earlier","created_at":"2015-08-03T06:51:33Z","updated_at":"2015-08-03T06:51:33Z","html_url":"https://github.com/CodistoConnect/CodistoConnect/pull/60#discussion_r36059698","pull_request_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/comments/36059698"},"html":{"href":"https://github.com/CodistoConnect/CodistoConnect/pull/60#discussion_r36059698"},"pull_request":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60","id":41439129,"html_url":"https://github.com/CodistoConnect/CodistoConnect/pull/60","diff_url":"https://github.com/CodistoConnect/CodistoConnect/pull/60.diff","patch_url":"https://github.com/CodistoConnect/CodistoConnect/pull/60.patch","issue_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/60","number":60,"state":"open","locked":false,"title":"applies locking to account creation in Router","user":{"login":"lamery","id":253658,"avatar_url":"https://avatars.githubusercontent.com/u/253658?v=3","gravatar_id":"","url":"https://api.github.com/users/lamery","html_url":"https://github.com/lamery","followers_url":"https://api.github.com/users/lamery/followers","following_url":"https://api.github.com/users/lamery/following{/other_user}","gists_url":"https://api.github.com/users/lamery/gists{/gist_id}","starred_url":"https://api.github.com/users/lamery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lamery/subscriptions","organizations_url":"https://api.github.com/users/lamery/orgs","repos_url":"https://api.github.com/users/lamery/repos","events_url":"https://api.github.com/users/lamery/events{/privacy}","received_events_url":"https://api.github.com/users/lamery/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-03T06:51:27Z","updated_at":"2015-08-03T06:51:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7507b694178f3549a14d42a7986009c6d279985","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60/commits","review_comments_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60/comments","review_comment_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/60/comments","statuses_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/statuses/280e52bc8bfdb2d4a25bd9cd1b1c7c481b128efb","head":{"label":"CodistoConnect:lra-serialize-setup","ref":"lra-serialize-setup","sha":"280e52bc8bfdb2d4a25bd9cd1b1c7c481b128efb","user":{"login":"CodistoConnect","id":12947060,"avatar_url":"https://avatars.githubusercontent.com/u/12947060?v=3","gravatar_id":"","url":"https://api.github.com/users/CodistoConnect","html_url":"https://github.com/CodistoConnect","followers_url":"https://api.github.com/users/CodistoConnect/followers","following_url":"https://api.github.com/users/CodistoConnect/following{/other_user}","gists_url":"https://api.github.com/users/CodistoConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/CodistoConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodistoConnect/subscriptions","organizations_url":"https://api.github.com/users/CodistoConnect/orgs","repos_url":"https://api.github.com/users/CodistoConnect/repos","events_url":"https://api.github.com/users/CodistoConnect/events{/privacy}","received_events_url":"https://api.github.com/users/CodistoConnect/received_events","type":"Organization","site_admin":false},"repo":{"id":37691314,"name":"CodistoConnect","full_name":"CodistoConnect/CodistoConnect","owner":{"login":"CodistoConnect","id":12947060,"avatar_url":"https://avatars.githubusercontent.com/u/12947060?v=3","gravatar_id":"","url":"https://api.github.com/users/CodistoConnect","html_url":"https://github.com/CodistoConnect","followers_url":"https://api.github.com/users/CodistoConnect/followers","following_url":"https://api.github.com/users/CodistoConnect/following{/other_user}","gists_url":"https://api.github.com/users/CodistoConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/CodistoConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodistoConnect/subscriptions","organizations_url":"https://api.github.com/users/CodistoConnect/orgs","repos_url":"https://api.github.com/users/CodistoConnect/repos","events_url":"https://api.github.com/users/CodistoConnect/events{/privacy}","received_events_url":"https://api.github.com/users/CodistoConnect/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CodistoConnect/CodistoConnect","description":"Magento to eBay Integration","fork":false,"url":"https://api.github.com/repos/CodistoConnect/CodistoConnect","forks_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/forks","keys_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/teams","hooks_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/hooks","issue_events_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/events{/number}","events_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/events","assignees_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/assignees{/user}","branches_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/branches{/branch}","tags_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/tags","blobs_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/refs{/sha}","trees_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/statuses/{sha}","languages_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/languages","stargazers_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/stargazers","contributors_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/contributors","subscribers_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/subscribers","subscription_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/subscription","commits_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/commits{/sha}","git_commits_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/commits{/sha}","comments_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/comments{/number}","issue_comment_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/comments{/number}","contents_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/contents/{+path}","compare_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/merges","archive_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/downloads","issues_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues{/number}","pulls_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls{/number}","milestones_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/milestones{/number}","notifications_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/labels{/name}","releases_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/releases{/id}","created_at":"2015-06-18T23:40:03Z","updated_at":"2015-07-29T06:22:57Z","pushed_at":"2015-08-03T06:51:27Z","git_url":"git://github.com/CodistoConnect/CodistoConnect.git","ssh_url":"git@github.com:CodistoConnect/CodistoConnect.git","clone_url":"https://github.com/CodistoConnect/CodistoConnect.git","svn_url":"https://github.com/CodistoConnect/CodistoConnect","homepage":null,"size":1517,"stargazers_count":7,"watchers_count":7,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":7,"default_branch":"master"}},"base":{"label":"CodistoConnect:development","ref":"development","sha":"0de1968e3dbff266883346a955e98e2fd288b8cb","user":{"login":"CodistoConnect","id":12947060,"avatar_url":"https://avatars.githubusercontent.com/u/12947060?v=3","gravatar_id":"","url":"https://api.github.com/users/CodistoConnect","html_url":"https://github.com/CodistoConnect","followers_url":"https://api.github.com/users/CodistoConnect/followers","following_url":"https://api.github.com/users/CodistoConnect/following{/other_user}","gists_url":"https://api.github.com/users/CodistoConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/CodistoConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodistoConnect/subscriptions","organizations_url":"https://api.github.com/users/CodistoConnect/orgs","repos_url":"https://api.github.com/users/CodistoConnect/repos","events_url":"https://api.github.com/users/CodistoConnect/events{/privacy}","received_events_url":"https://api.github.com/users/CodistoConnect/received_events","type":"Organization","site_admin":false},"repo":{"id":37691314,"name":"CodistoConnect","full_name":"CodistoConnect/CodistoConnect","owner":{"login":"CodistoConnect","id":12947060,"avatar_url":"https://avatars.githubusercontent.com/u/12947060?v=3","gravatar_id":"","url":"https://api.github.com/users/CodistoConnect","html_url":"https://github.com/CodistoConnect","followers_url":"https://api.github.com/users/CodistoConnect/followers","following_url":"https://api.github.com/users/CodistoConnect/following{/other_user}","gists_url":"https://api.github.com/users/CodistoConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/CodistoConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodistoConnect/subscriptions","organizations_url":"https://api.github.com/users/CodistoConnect/orgs","repos_url":"https://api.github.com/users/CodistoConnect/repos","events_url":"https://api.github.com/users/CodistoConnect/events{/privacy}","received_events_url":"https://api.github.com/users/CodistoConnect/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CodistoConnect/CodistoConnect","description":"Magento to eBay Integration","fork":false,"url":"https://api.github.com/repos/CodistoConnect/CodistoConnect","forks_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/forks","keys_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/teams","hooks_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/hooks","issue_events_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/events{/number}","events_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/events","assignees_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/assignees{/user}","branches_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/branches{/branch}","tags_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/tags","blobs_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/refs{/sha}","trees_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/statuses/{sha}","languages_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/languages","stargazers_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/stargazers","contributors_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/contributors","subscribers_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/subscribers","subscription_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/subscription","commits_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/commits{/sha}","git_commits_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/git/commits{/sha}","comments_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/comments{/number}","issue_comment_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/comments{/number}","contents_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/contents/{+path}","compare_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/merges","archive_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/downloads","issues_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues{/number}","pulls_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls{/number}","milestones_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/milestones{/number}","notifications_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/labels{/name}","releases_url":"https://api.github.com/repos/CodistoConnect/CodistoConnect/releases{/id}","created_at":"2015-06-18T23:40:03Z","updated_at":"2015-07-29T06:22:57Z","pushed_at":"2015-08-03T06:51:27Z","git_url":"git://github.com/CodistoConnect/CodistoConnect.git","ssh_url":"git@github.com:CodistoConnect/CodistoConnect.git","clone_url":"https://github.com/CodistoConnect/CodistoConnect.git","svn_url":"https://github.com/CodistoConnect/CodistoConnect","homepage":null,"size":1517,"stargazers_count":7,"watchers_count":7,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60"},"html":{"href":"https://github.com/CodistoConnect/CodistoConnect/pull/60"},"issue":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/60"},"comments":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/CodistoConnect/CodistoConnect/statuses/280e52bc8bfdb2d4a25bd9cd1b1c7c481b128efb"}}}}