Mercurial > hg > ywww
comparison us/index.php @ 15:385ddd7c4b55 testing
use test_db.php to get mysqld_test instance
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Sun, 19 Feb 2017 16:17:53 +0000 |
| parents | 226f00d9f6f5 |
| children |
comparison
equal
deleted
inserted
replaced
| 14:1477b5e6dd16 | 15:385ddd7c4b55 |
|---|---|
| 122 $chars = explode("/",$isbn); | 122 $chars = explode("/",$isbn); |
| 123 $isbn = $chars[0]; | 123 $isbn = $chars[0]; |
| 124 $ret = 1; | 124 $ret = 1; |
| 125 $countryCode = 0; | 125 $countryCode = 0; |
| 126 | 126 |
| 127 include "../../private/db.php"; | 127 include "../../../private/db_test.php"; |
| 128 $query = "CALL b_getBookInfo('$isbn', $countryCode)"; | 128 $query = "CALL b_getBookInfo('$isbn', $countryCode)"; |
| 129 //echo $query; | 129 //echo $query; |
| 130 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); | 130 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); |
| 131 include "../xml/aws_signed_request.php"; | 131 include "../xml/aws_signed_request.php"; |
| 132 include "../xml/getAmazonInfo.php"; | 132 include "../xml/getAmazonInfo.php"; |
| 142 $bookXML = new SimpleXMLElement($bookDetails); | 142 $bookXML = new SimpleXMLElement($bookDetails); |
| 143 // HST added this | 143 // HST added this |
| 144 if (preg_match("<Error>",$bookDetails)) { | 144 if (preg_match("<Error>",$bookDetails)) { |
| 145 $resName=$bookXML->getName(); | 145 $resName=$bookXML->getName(); |
| 146 $code=$bookXML->Error->Code; | 146 $code=$bookXML->Error->Code; |
| 147 file_put_contents('/var/ywww/debug/phpDebug',"Losing 3: $resName, ". | 147 file_put_contents('/var/test/ywww/debug/testDebug',"Losing 3: $resName, ". |
| 148 $code."\n",FILE_APPEND); | 148 $code."\n",FILE_APPEND); |
| 149 if ($code=='RequestThrottled') { | 149 if ($code=='RequestThrottled') { |
| 150 usleep(200000); // Try to reduce throttling until we get a | 150 usleep(200000); // Try to reduce throttling until we get a |
| 151 // principled solution in place | 151 // principled solution in place |
| 152 } | 152 } |
| 163 | 163 |
| 164 $recommended = ""; | 164 $recommended = ""; |
| 165 $linkedRecommended = ""; | 165 $linkedRecommended = ""; |
| 166 for($i=0;$i<sizeof($xml->isbn);$i++){ | 166 for($i=0;$i<sizeof($xml->isbn);$i++){ |
| 167 $linkedISBN = $xml->isbn[$i]; | 167 $linkedISBN = $xml->isbn[$i]; |
| 168 include "../../private/db.php"; | 168 include "../../../private/db_test.php"; |
| 169 $query = "CALL b_getBookInfo('$linkedISBN', $countryCode)"; | 169 $query = "CALL b_getBookInfo('$linkedISBN', $countryCode)"; |
| 170 //echo $query; | 170 //echo $query; |
| 171 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); | 171 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); |
| 172 set_error_handler(function () { | 172 set_error_handler(function () { |
| 173 global $bookLDetails, $linkedISBN; | 173 global $bookLDetails, $linkedISBN; |
| 174 file_put_contents('/var/ywww/debug/phpDebug', | 174 file_put_contents('/var/test/ywww/debug/testDebug', |
| 175 "Caught other one?: ".$linkedISBN, | 175 "Caught other one?: ".$linkedISBN, |
| 176 FILE_APPEND); | 176 FILE_APPEND); |
| 177 //file_put_contents('/var/ywww/debug/phpDebug', | 177 //file_put_contents('/var/test/ywww/debug/testDebug', |
| 178 // print_r($bookLDetails, TRUE)."\n", | 178 // print_r($bookLDetails, TRUE)."\n", |
| 179 // FILE_APPEND); | 179 // FILE_APPEND); |
| 180 } ); | 180 } ); |
| 181 if ( mysqli_num_rows( $res ) > 0 ) | 181 if ( mysqli_num_rows( $res ) > 0 ) |
| 182 { | 182 { |
| 191 $bookLXML = new SimpleXMLElement($bookLDetails); | 191 $bookLXML = new SimpleXMLElement($bookLDetails); |
| 192 // HST added this | 192 // HST added this |
| 193 if (preg_match("<Error>",$bookLDetails)) { | 193 if (preg_match("<Error>",$bookLDetails)) { |
| 194 $resName=$bookLXML->getName(); | 194 $resName=$bookLXML->getName(); |
| 195 $code=$bookLXML->Error->Code; | 195 $code=$bookLXML->Error->Code; |
| 196 file_put_contents('/var/ywww/debug/phpDebug',"Losing 2: $resName, ". | 196 file_put_contents('/var/test/ywww/debug/testDebug',"Losing 2: $resName, ". |
| 197 $code."\n",FILE_APPEND); | 197 $code."\n",FILE_APPEND); |
| 198 if ($code=='RequestThrottled') { | 198 if ($code=='RequestThrottled') { |
| 199 usleep(200000); // Try to reduce throttling until we get a | 199 usleep(200000); // Try to reduce throttling until we get a |
| 200 // principled solution in place | 200 // principled solution in place |
| 201 } | 201 } |
