[misc] Memcache-related fixes.

This commit is contained in:
Solomon Peachy 2013-04-16 21:42:43 -04:00
parent eb1b563f6b
commit 0360837de1
5 changed files with 26 additions and 12 deletions

View File

@ -8,11 +8,12 @@ For further information about Photo Organizer, see its web site at:
v2.38 (Unreleased)
[fix] Newer versions of memcached had issues with our code
[misc] Get rid of "IE7" compatibility library.
[themes] Use CSS3 to style radio buttons and checkboxes
[themes] Use CSS3 drop-shadows for images.
[themes] Use CSS styling for menus instead of the graphics hack.
[themes] Convert the action buttons to using spans instead of tables.
[themes] Use CSS styling for menus instead of the graphics hack
[themes] Convert the action buttons to using spans instead of tables
[misc] Update to tagcloud v3
[themes] Use CSS3 to style slide selection
[misc] Better memcache logging

View File

@ -76,10 +76,12 @@ function get_generic_row_query($database, $query, $key = FALSE, $assoc = FALSE)
if ($key === FALSE)
$key = "query.$query";
$key = str_replace(" ", "", "$assoc.$key");
if ($memcache) {
po_log("memcache: get $key", PEAR_LOG_DEBUG);
$val = $memcache->get($key);
if ($val)
if ($val !== FALSE)
return $val;
}
@ -106,10 +108,12 @@ function get_generic_query_all($database, $query, $key = FALSE) {
if ($key === FALSE)
$key = "queryall.$query";
$key = str_replace(" ", "", $key);
if ($memcache) {
po_log("memcache: get $key", PEAR_LOG_DEBUG);
$val = $memcache->get($key);
if ($val)
if ($val !== FALSE)
return $val;
}

View File

@ -76,11 +76,11 @@ $po_session_handler = "";
$po_cookie_path = "/";
// Once can use memcached instead. For example:
// $po_session_path = "tcp://localhost:11211/";
// $po_session_handler = "memcache";
// $po_session_path = "localhost:11211";
// $po_session_handler = "memcached";
// If you want to use memcache to cache non-session data, set it here:
//$po_memcache = array(array("localhost", 11211), array("localhost",11212));
//$po_memcache = array(array("localhost", 11211, 1), array("localhost",11212, 2));
$po_memcache = array();
// absolute path to your temporary directory which

View File

@ -87,7 +87,9 @@ function site_prolog($min_type = PO_USER_TYPE_DISABLED) {
/* Connect to the memcache */
if (count($po_memcache)) {
$memcache = new Memcached($site_url);
$memcache->addServers($po_memcache);
if (!count($memcache->getServerList())) {
$memcache->addServers($po_memcache);
}
}
/* Start up session */

View File

@ -408,15 +408,22 @@ switch ($detail_info) {
if ($photo_data['location']) {
$location = get_generic_assoc_query($database, "select place, city, state, country, latitude, longitude from view_location where identifier=$photo_data[location]", "location.$photo_data[location]");
if ($location['place'] != "" && ($location['city'] != "" || $location['state'] != "" || $location['country'] != "")) { $location['place'] .= ","; }
if ($location['city'] != "" && ($location['state'] != "" || $location['country'] != "")) { $location['city'] .= ","; }
if ($location['state'] != "" && ($location['country'] != "")) { $location['state'] .= ","; }
$foo = array();
if ($location['place'] != "")
$foo[] = $location['place'];
if ($location['city'] != "")
$foo[] = $location['city'];
if ($location['state'] != "")
$foo[] = $location['state'];
if ($location['country'] != "")
$foo[] = $location['country'];
print "<tr>".emit_td($strings['generic_location']);
if ($location['place'] == 'Unknown') {
$foo = $strings['generic_unknown'];
} else {
$foo = "$location[place] $location[city] $location[state] $location[country]";
$foo = implode(", ", $foo);
if ($location['latitude'] || $location['longitude']) {
$foo = emit_a("http://maps.google.com/maps?q=$location[latitude]+$location[longitude]($foo)&amp;t=h", $foo, "target=\"_new\"");
} else {