Merge branch 'develop' of https://github.com/shish/shimmie2 into develop
This commit is contained in:
		
						commit
						408b45e4cc
					
				| @ -405,7 +405,7 @@ class MemcachedCache implements CacheEngine { | |||||||
| 		$res = $this->memcache->getResultCode(); | 		$res = $this->memcache->getResultCode(); | ||||||
| 
 | 
 | ||||||
| 		if((DEBUG_CACHE === true) || (is_null(DEBUG_CACHE) && @$_GET['DEBUG_CACHE'])) { | 		if((DEBUG_CACHE === true) || (is_null(DEBUG_CACHE) && @$_GET['DEBUG_CACHE'])) { | ||||||
| 			$hit = $res == Memcached::RES_SUCCESS ? "miss" : "hit"; | 			$hit = $res == Memcached::RES_SUCCESS ? "hit" : "miss"; | ||||||
| 			file_put_contents("data/cache.log", "Cache $hit: $key\n", FILE_APPEND); | 			file_put_contents("data/cache.log", "Cache $hit: $key\n", FILE_APPEND); | ||||||
| 		} | 		} | ||||||
| 		if($res == Memcached::RES_SUCCESS) { | 		if($res == Memcached::RES_SUCCESS) { | ||||||
| @ -690,7 +690,7 @@ class Database { | |||||||
| 	 * @param string $sql | 	 * @param string $sql | ||||||
| 	 */ | 	 */ | ||||||
| 	private function count_execs($db, $sql, $inputarray) { | 	private function count_execs($db, $sql, $inputarray) { | ||||||
| 		if ((defined('DEBUG_SQL') && DEBUG_SQL === true) || (!defined('DEBUG_SQL') && @$_GET['DEBUG_SQL'])) { | 		if((DEBUG_SQL === true) || (is_null(DEBUG_SQL) && @$_GET['DEBUG_SQL'])) { | ||||||
| 			$sql = trim(preg_replace('/\s+/msi', ' ', $sql)); | 			$sql = trim(preg_replace('/\s+/msi', ' ', $sql)); | ||||||
| 			if(isset($inputarray) && is_array($inputarray) && !empty($inputarray)) { | 			if(isset($inputarray) && is_array($inputarray) && !empty($inputarray)) { | ||||||
| 				$text = $sql." -- ".join(", ", $inputarray)."\n"; | 				$text = $sql." -- ".join(", ", $inputarray)."\n"; | ||||||
| @ -707,7 +707,7 @@ class Database { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	private function count_time($method, $start) { | 	private function count_time($method, $start) { | ||||||
| 		if ((defined('DEBUG_SQL') && DEBUG_SQL === true) || (!defined('DEBUG_SQL') && @$_GET['DEBUG_SQL'])) { | 		if((DEBUG_SQL === true) || (is_null(DEBUG_SQL) && @$_GET['DEBUG_SQL'])) { | ||||||
| 			$text = $method.":".(microtime(true) - $start)."\n"; | 			$text = $method.":".(microtime(true) - $start)."\n"; | ||||||
| 			file_put_contents("data/sql.log", $text, FILE_APPEND); | 			file_put_contents("data/sql.log", $text, FILE_APPEND); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -282,8 +282,7 @@ class Image { | |||||||
| 		} | 		} | ||||||
| 		else { | 		else { | ||||||
| 			$querylet = Image::build_search_querylet($tags); | 			$querylet = Image::build_search_querylet($tags); | ||||||
| 			$result = $database->execute($querylet->sql, $querylet->variables); | 			return $database->get_one("SELECT COUNT(*) AS cnt FROM ($querylet->sql) AS tbl", $querylet->variables); | ||||||
| 			return $result->rowCount(); |  | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -265,7 +265,7 @@ class Index extends Extension { | |||||||
| 					$images = $database->cache->get("post-list:$page_number"); | 					$images = $database->cache->get("post-list:$page_number"); | ||||||
| 					if(!$images) { | 					if(!$images) { | ||||||
| 						$images = Image::find_images(($page_number-1)*$page_size, $page_size, $search_terms); | 						$images = Image::find_images(($page_number-1)*$page_size, $page_size, $search_terms); | ||||||
| 						$database->cache->set("post-list:$page_number", $images, 600); | 						$database->cache->set("post-list:$page_number", $images, 60); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				else { | 				else { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user