diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2012-11-09 12:41:59 +0100 | 
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2012-11-09 12:41:59 +0100 | 
| commit | 63c64694bc253358a50dce7dce99a7551b5e2b17 (patch) | |
| tree | d42136a8b8bcc569f76d264ddae27aa68d13deb0 | |
| parent | 935bc33268bb062158d6421242335483fcd955bd (diff) | |
| download | forums-63c64694bc253358a50dce7dce99a7551b5e2b17.tar forums-63c64694bc253358a50dce7dce99a7551b5e2b17.tar.gz forums-63c64694bc253358a50dce7dce99a7551b5e2b17.tar.bz2 forums-63c64694bc253358a50dce7dce99a7551b5e2b17.tar.xz forums-63c64694bc253358a50dce7dce99a7551b5e2b17.zip  | |
[ticket/10897] Update by user_id instead of bot_name.
PHPBB3-10897
| -rw-r--r-- | phpBB/install/database_update.php | 15 | 
1 files changed, 8 insertions, 7 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0372b6e608..6496069658 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2132,22 +2132,23 @@ function change_database_data(&$no_updates, $version)  			{  				list($bot_agent, $bot_ip) = $bot_array; -				$bot_name_clean = utf8_clean_string($bot_name); -  				$sql = 'SELECT user_id  					FROM ' . USERS_TABLE . " -					WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'"; +					WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'";  				$result = $db->sql_query($sql); -				$is_user = (bool) $db->sql_fetchfield('user_id'); +				$bot_user_id = (int) $db->sql_fetchfield('user_id');  				$db->sql_freeresult($result); -				if ($is_user) +				if ($bot_user_id)  				{ -					$sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( +					$update_array = array(  						'bot_agent'		=> $bot_agent,  						'bot_ip'		=> $bot_ip, -					)) . " WHERE bot_name = '" . $db->sql_escape($bot_name) . "'"; +					); +					$sql = 'UPDATE ' . BOTS_TABLE . ' +						SET ' . $db->sql_build_array('UPDATE', $update_array) . " +						WHERE user_id = $bot_user_id";  					_sql($sql, $errored, $error_ary);  				}  			}  | 
