phpBB

Code Changes

File: phpbb/db/migration/data/v33x/profilefield_youtube_update.php

  Unmodified   Added   Modified   Removed
Line 15Line 15

class profilefield_youtube_update extends \phpbb\db\migration\migration
{


class profilefield_youtube_update extends \phpbb\db\migration\migration
{

	protected $youtube_url_matcher = 'https:\\/\\/(www\\.)?youtube\\.com\\/.+';

	public static $youtube_url_matcher = 'https:\\/\\/(www\\.)?youtube\\.com\\/.+';


public function effectively_installed()
{


public function effectively_installed()
{

Line 30Line 30
		$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);


		$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);


		return !$row || $row['field_validation'] === $this->youtube_url_matcher;

		return !$row || $row['field_validation'] === self::$youtube_url_matcher;

	}

public static function depends_on()

	}

public static function depends_on()

Line 48Line 48
		$profile_fields = $this->table_prefix . 'profile_fields';
$profile_fields_data = $this->table_prefix . 'profile_fields_data';


		$profile_fields = $this->table_prefix . 'profile_fields';
$profile_fields_data = $this->table_prefix . 'profile_fields_data';


		$field_validation = $this->db->sql_escape($this->youtube_url_matcher);







		$field_data = [
'field_length' => 40,
'field_minlen' => strlen('https://youtube.com/c/') + 1,
'field_maxlen' => 255,
'field_validation' => self::$youtube_url_matcher,
'field_contact_url' => '%s'
];





		$min_length = strlen('https://youtube.com/c/') + 1;

$this->db->sql_query(
"UPDATE $profile_fields SET
field_length = '40',
field_minlen = '$min_length',
field_maxlen = '255',
field_validation = '$field_validation',
field_contact_url = '%s'
WHERE field_name = 'phpbb_youtube'"
);

		$sql = 'UPDATE ' . $profile_fields . '
SET ' . $this->db->sql_build_array('UPDATE', $field_data) . "
WHERE field_name = 'phpbb_youtube'";
$this->db->sql_query($sql);









$yt_profile_field = 'pf_phpbb_youtube';
$prepend_legacy_youtube_url = $this->db->sql_concatenate(


$yt_profile_field = 'pf_phpbb_youtube';
$prepend_legacy_youtube_url = $this->db->sql_concatenate(

Line 71Line 70
				. 'youtube.com/'
. $this->db->get_any_char()
);

				. 'youtube.com/'
. $this->db->get_any_char()
);

 

// We're done if the profile field doesn't exist
if (!$this->db_tools->sql_column_exists($profile_fields_data, $yt_profile_field))
{
return;
}


$this->db->sql_query(
"UPDATE $profile_fields_data SET


$this->db->sql_query(
"UPDATE $profile_fields_data SET