Improve test behaviour
This commit is contained in:
parent
271b6cb8f9
commit
69db696ab1
|
@ -955,6 +955,8 @@ class dba {
|
||||||
* @return boolean Was the command executed successfully?
|
* @return boolean Was the command executed successfully?
|
||||||
*/
|
*/
|
||||||
public static function rollback() {
|
public static function rollback() {
|
||||||
|
$ret = false;
|
||||||
|
|
||||||
switch (self::$driver) {
|
switch (self::$driver) {
|
||||||
case 'pdo':
|
case 'pdo':
|
||||||
if (!self::$db->inTransaction()) {
|
if (!self::$db->inTransaction()) {
|
||||||
|
|
12
src/App.php
12
src/App.php
|
@ -412,11 +412,17 @@ class App
|
||||||
public function set_baseurl($url)
|
public function set_baseurl($url)
|
||||||
{
|
{
|
||||||
$parsed = @parse_url($url);
|
$parsed = @parse_url($url);
|
||||||
|
$hostname = '';
|
||||||
|
|
||||||
if (x($parsed)) {
|
if (x($parsed)) {
|
||||||
$this->scheme = $parsed['scheme'];
|
if (!empty($parsed['scheme'])) {
|
||||||
|
$this->scheme = $parsed['scheme'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($parsed['host'])) {
|
||||||
|
$hostname = $parsed['host'];
|
||||||
|
}
|
||||||
|
|
||||||
$hostname = $parsed['host'];
|
|
||||||
if (x($parsed, 'port')) {
|
if (x($parsed, 'port')) {
|
||||||
$hostname .= ':' . $parsed['port'];
|
$hostname .= ':' . $parsed['port'];
|
||||||
}
|
}
|
||||||
|
@ -432,7 +438,7 @@ class App
|
||||||
$this->hostname = Config::get('config', 'hostname');
|
$this->hostname = Config::get('config', 'hostname');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->hostname) || ( $this->hostname == '')) {
|
if (!isset($this->hostname) || ($this->hostname == '')) {
|
||||||
$this->hostname = $hostname;
|
$this->hostname = $hostname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -781,22 +781,23 @@ class Image
|
||||||
$img_str = Network::fetchUrl($url, true, $redirects, 4);
|
$img_str = Network::fetchUrl($url, true, $redirects, 4);
|
||||||
$filesize = strlen($img_str);
|
$filesize = strlen($img_str);
|
||||||
|
|
||||||
// The tests are failing with an read error. This can be caused by memory shortage
|
try {
|
||||||
// See https://stackoverflow.com/questions/10175758/getimagesize-read-error
|
if (function_exists("getimagesizefromstring")) {
|
||||||
// So we use the alternate method instead
|
$data = getimagesizefromstring($img_str);
|
||||||
//if (function_exists("getimagesizefromstring")) {
|
} else {
|
||||||
// $data = getimagesizefromstring($img_str);
|
$tempfile = tempnam(get_temppath(), "cache");
|
||||||
//} else {
|
|
||||||
$tempfile = tempnam(get_temppath(), "cache");
|
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
file_put_contents($tempfile, $img_str);
|
file_put_contents($tempfile, $img_str);
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->save_timestamp($stamp1, "file");
|
||||||
|
|
||||||
$data = getimagesize($tempfile);
|
$data = getimagesize($tempfile);
|
||||||
unlink($tempfile);
|
unlink($tempfile);
|
||||||
//}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$data["size"] = $filesize;
|
$data["size"] = $filesize;
|
||||||
|
|
Loading…
Reference in a new issue