phpBB

Code Changes

File: phpbb/install/module/update_filesystem/task/diff_files.php

  Unmodified   Added   Modified   Removed
Line 103Line 103
		$old_path = $this->update_helper->get_path_to_old_update_files();
$new_path = $this->update_helper->get_path_to_new_update_files();


		$old_path = $this->update_helper->get_path_to_old_update_files();
$new_path = $this->update_helper->get_path_to_new_update_files();


		$files_to_diff = $this->installer_config->get('update_files', array());
$files_to_diff = $files_to_diff['update_with_diff'];

		$update_files = $this->installer_config->get('update_files', array());
$files_to_diff = $update_files['update_with_diff'];


// Set progress bar
$this->iohandler->set_task_count(count($files_to_diff), true);


// Set progress bar
$this->iohandler->set_task_count(count($files_to_diff), true);

Line 132Line 132
			$file_contents = array();

// Handle the special case when user created a file with the filename that is now new in the core

			$file_contents = array();

// Handle the special case when user created a file with the filename that is now new in the core

			$file_contents[0] = (file_exists($old_path . $filename)) ? file_get_contents($old_path . $filename) : '';



			if (file_exists($old_path . $filename))
{
$file_contents[0] = file_get_contents($old_path . $filename);


$filenames = array(
$this->phpbb_root_path . $filename,


$filenames = array(
$this->phpbb_root_path . $filename,

Line 143Line 145
			{
$file_contents[] = file_get_contents($file_to_diff);


			{
$file_contents[] = file_get_contents($file_to_diff);


				if ($file_contents[sizeof($file_contents) - 1] === false)

					if ($file_contents[count($file_contents) - 1] === false)

				{
$this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff));
unset($file_contents);

				{
$this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff));
unset($file_contents);

Line 152Line 154
			}

$diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]);

			}

$diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]);

			unset($file_contents);

 

// Handle conflicts
if ($diff->get_num_conflicts() !== 0)


// Handle conflicts
if ($diff->get_num_conflicts() !== 0)

Line 160Line 161
				$merge_conflicts[] = $filename;
}


				$merge_conflicts[] = $filename;
}


 
				if ($diff->merged_output() !== $file_contents[1])
{

			// Save merged output
$this->cache->put(
'_file_' . md5($filename),
base64_encode(implode("\n", $diff->merged_output()))
);

			// Save merged output
$this->cache->put(
'_file_' . md5($filename),
base64_encode(implode("\n", $diff->merged_output()))
);

 
				}
else
{
unset($update_files['update_with_diff'][$key]);
}





 
				unset($file_contents);

			unset($diff);

			unset($diff);

 
			}
else
{
$new_file_content = file_get_contents($new_path . $filename);

if ($new_file_content === false)
{
$this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff));
unset($new_file_content );
throw new user_interaction_required_exception();
}

// Save new file content to cache
$this->cache->put(
'_file_' . md5($filename),
base64_encode($new_file_content)
);
unset($new_file_content);
}


$progress_count++;
$this->iohandler->set_progress('UPDATE_FILE_DIFF', $progress_count);


$progress_count++;
$this->iohandler->set_progress('UPDATE_FILE_DIFF', $progress_count);

Line 177Line 205
				$this->installer_config->set('differ_progress_key', $key);
$this->installer_config->set('merge_conflict_list', $merge_conflicts);
$this->installer_config->set('file_diff_update_count', $progress_count);

				$this->installer_config->set('differ_progress_key', $key);
$this->installer_config->set('merge_conflict_list', $merge_conflicts);
$this->installer_config->set('file_diff_update_count', $progress_count);

 

foreach ($update_files as $type => $files)
{
if (empty($files))
{
unset($update_files[$type]);
}
}

$this->installer_config->set('update_files', $update_files);


// Request refresh
throw new resource_limit_reached_exception();


// Request refresh
throw new resource_limit_reached_exception();

Line 185Line 223

$this->iohandler->finish_progress('ALL_FILES_DIFFED');
$this->installer_config->set('merge_conflict_list', $merge_conflicts);


$this->iohandler->finish_progress('ALL_FILES_DIFFED');
$this->installer_config->set('merge_conflict_list', $merge_conflicts);

 

foreach ($update_files as $type => $files)
{
if (empty($files))
{
unset($update_files[$type]);
}
}

$this->installer_config->set('update_files', $update_files);

	}

/**

	}

/**