From 487693ffee16f654acd91f919ac463a2b01940cc Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 14 Oct 2010 21:15:16 -0400 Subject: [PATCH] Add knowledge of desired parallel AWL version to setup. Also add caching of getUserByEmail() since we'll be doing more of that in the scheduling code. --- htdocs/always.php | 20 ++++++++++---------- inc/always.php.in | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/always.php b/htdocs/always.php index 36776b1f..04558c35 100644 --- a/htdocs/always.php +++ b/htdocs/always.php @@ -49,6 +49,8 @@ $c->base_url = preg_replace('#/[^/]+\.php.*$#', '', $_SERVER['SCRIPT_NAME']); $c->base_directory = preg_replace('#/[^/]*$#', '', $_SERVER['DOCUMENT_ROOT']); $c->default_privileges = array('read-free-busy', 'schedule-deliver'); +$c->enable_auto_schedule = true; + $c->stylesheets = array( $c->base_url.'/davical.css' ); $c->images = $c->base_url . '/images'; @@ -166,7 +168,8 @@ init_gettext( 'davical', $c->locale_path ); * */ $c->code_version = 0; -$c->version_string = '0.9.9.3'; // The actual version # is replaced into that during the build /release process +$c->want_awl_version = 0.46; +$c->version_string = '0.9.9.4'; // The actual version # is replaced into that during the build /release process if ( isset($c->version_string) && preg_match( '/(\d+)\.(\d+)\.(\d+)(.*)/', $c->version_string, $matches) ) { $c->code_major = $matches[1]; $c->code_minor = $matches[2]; @@ -200,9 +203,10 @@ if ( $qry->Exec('always',__LINE__,__FILE__) && $row = $qry->Fetch() ) { } -$_known_users_name = array(); -$_known_users_id = array(); -$_known_users_pid = array(); +$_known_users_name = array(); +$_known_users_id = array(); +$_known_users_pid = array(); +$_known_users_email = array(); function _davical_get_principal_query_cached( $where, $parameter ) { global $c, $session, $_known_users_name, $_known_users_id, $_known_users_pid; @@ -225,6 +229,7 @@ function _davical_get_principal_query_cached( $where, $parameter ) { $_known_users_name[$row->username] = $row; $_known_users_id[$row->user_no] = $row; $_known_users_pid[$row->principal_id] = $row; + $_known_users_email[$row->email] = $row; } return $row; } @@ -253,12 +258,7 @@ function getUserByName( $username, $use_cache = true ) { function getUserByEMail( $email, $use_cache = true ) { global $_known_users_name; - if ( $use_cache ) { - /** We don't actually maintain a cache-access by e-mail, since it's rare */ - foreach( $_known_users_name AS $k => $v ) { - if ( strtolower($email) == strtolower($v->email) ) return $v; - } - } + if ( $use_cache && isset( $_known_users_email[$email] ) ) return $_known_users_email[$email]; return _davical_get_principal_query_cached( 'lower(email) = lower(:param)', $email ); } diff --git a/inc/always.php.in b/inc/always.php.in index 58b97f32..a799a93c 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -49,6 +49,8 @@ $c->base_url = preg_replace('#/[^/]+\.php.*$#', '', $_SERVER['SCRIPT_NAME']); $c->base_directory = preg_replace('#/[^/]*$#', '', $_SERVER['DOCUMENT_ROOT']); $c->default_privileges = array('read-free-busy', 'schedule-deliver'); +$c->enable_auto_schedule = true; + $c->stylesheets = array( $c->base_url.'/davical.css' ); $c->images = $c->base_url . '/images'; @@ -166,6 +168,7 @@ init_gettext( 'davical', $c->locale_path ); * */ $c->code_version = 0; +$c->want_awl_version = 0.46; // The actual version # is replaced into that during the build /release process $c->version_string = '0.9.8.3'; // The actual version # is replaced into that during the build /release process if ( isset($c->version_string) && preg_match( '/(\d+)\.(\d+)\.(\d+)(.*)/', $c->version_string, $matches) ) { $c->code_major = $matches[1]; @@ -200,9 +203,10 @@ if ( $qry->Exec('always',__LINE__,__FILE__) && $row = $qry->Fetch() ) { } -$_known_users_name = array(); -$_known_users_id = array(); -$_known_users_pid = array(); +$_known_users_name = array(); +$_known_users_id = array(); +$_known_users_pid = array(); +$_known_users_email = array(); function _davical_get_principal_query_cached( $where, $parameter ) { global $c, $session, $_known_users_name, $_known_users_id, $_known_users_pid; @@ -225,6 +229,7 @@ function _davical_get_principal_query_cached( $where, $parameter ) { $_known_users_name[$row->username] = $row; $_known_users_id[$row->user_no] = $row; $_known_users_pid[$row->principal_id] = $row; + $_known_users_email[$row->email] = $row; } return $row; } @@ -253,12 +258,7 @@ function getUserByName( $username, $use_cache = true ) { function getUserByEMail( $email, $use_cache = true ) { global $_known_users_name; - if ( $use_cache ) { - /** We don't actually maintain a cache-access by e-mail, since it's rare */ - foreach( $_known_users_name AS $k => $v ) { - if ( strtolower($email) == strtolower($v->email) ) return $v; - } - } + if ( $use_cache && isset( $_known_users_email[$email] ) ) return $_known_users_email[$email]; return _davical_get_principal_query_cached( 'lower(email) = lower(:param)', $email ); }