diff options
Diffstat (limited to 'phpBB/install')
| -rw-r--r-- | phpBB/install/database_update.php | 40 | ||||
| -rw-r--r-- | phpBB/install/install_install.php | 20 | ||||
| -rw-r--r-- | phpBB/install/schemas/schema_data.sql | 4 | 
3 files changed, 60 insertions, 4 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 6097341ace..c700b483a5 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2026,7 +2026,7 @@ function change_database_data(&$no_updates, $version)  		// No changes from 3.0.10-RC3 to 3.0.10  		case '3.0.10-RC3':  		break; -		 +  		// Changes from 3.0.10 to 3.0.11-RC1  		case '3.0.10':  			// Updates users having current style a deactivated one @@ -2050,6 +2050,44 @@ function change_database_data(&$no_updates, $version)  				_sql($sql, $errored, $error_ary);  			} +			// Delete orphan private messages +			$batch_size = 500; + +			$sql_array = array( +				'SELECT'	=> 'p.msg_id', +				'FROM'		=> array( +					PRIVMSGS_TABLE	=> 'p', +				), +				'LEFT_JOIN'	=> array( +					array( +						'FROM'	=> array(PRIVMSGS_TO_TABLE => 't'), +						'ON'	=> 'p.msg_id = t.msg_id', +					), +				), +				'WHERE'		=> 't.user_id IS NULL', +			); +			$sql = $db->sql_build_query('SELECT', $sql_array); + +			do +			{ +				$result = $db->sql_query_limit($sql, $batch_size); + +				$delete_pms = array(); +				while ($row = $db->sql_fetchrow($result)) +				{ +					$delete_pms[] = (int) $row['msg_id']; +				} +				$db->sql_freeresult($result); + +				if (!empty($delete_pms)) +				{ +					$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' +						WHERE ' . $db->sql_in_set('msg_id', $delete_pms); +					_sql($sql, $errored, $error_ary); +				} +			} +			while (sizeof($delete_pms) == $batch_size); +  			$no_updates = false;  		break;  	} diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 81dac9ecde..8e3fe0387c 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -53,11 +53,13 @@ class install_install extends module  	function main($mode, $sub)  	{ -		global $lang, $template, $language, $phpbb_root_path; +		global $lang, $template, $language, $phpbb_root_path, $cache;  		switch ($sub)  		{  			case 'intro': +				$cache->purge(); +  				$this->page_title = $lang['SUB_INTRO'];  				$template->assign_vars(array( @@ -105,6 +107,7 @@ class install_install extends module  				$this->add_language($mode, $sub);  				$this->add_bots($mode, $sub);  				$this->email_admin($mode, $sub); +				$this->disable_avatars_if_unwritable();  				// Remove the lock file  				@unlink($phpbb_root_path . 'cache/install_lock'); @@ -1942,6 +1945,21 @@ class install_install extends module  	}  	/** +	* Check if the avatar directory is writable and disable avatars +	* if it isn't writable. +	*/ +	function disable_avatars_if_unwritable() +	{ +		global $phpbb_root_path; + +		if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/')) +		{ +			set_config('allow_avatar', 0); +			set_config('allow_avatar_upload', 0); +		} +	} + +	/**  	* Generate a list of available mail server authentication methods  	*/  	function mail_auth_select($selected_method) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index efc81e37c0..ba2d18da00 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -8,10 +8,10 @@  INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_attachments', '1');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '1');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local', '0');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '1');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote_upload', '0');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1');  | 
