phpBB

Code Changes

File: phpbb/extension/manager.php

  Unmodified   Added   Modified   Removed
Line 152Line 152
	*/
public function create_extension_metadata_manager($name)
{

	*/
public function create_extension_metadata_manager($name)
{

		return new \phpbb\extension\metadata_manager($name, $this->config, $this, $this->phpbb_root_path);






		if (!isset($this->extensions[$name]['metadata']))
{
$metadata = new \phpbb\extension\metadata_manager($name, $this->get_extension_path($name, true));
$this->extensions[$name]['metadata'] = $metadata;
}
return $this->extensions[$name]['metadata'];

	}

/**

	}

/**

Line 168Line 173
	public function enable_step($name)
{
// ignore extensions that are already enabled

	public function enable_step($name)
{
// ignore extensions that are already enabled

		if (isset($this->extensions[$name]) && $this->extensions[$name]['ext_active'])

		if ($this->is_enabled($name))

		{
return false;
}

		{
return false;
}

Line 257Line 262
	*/
public function disable_step($name)
{

	*/
public function disable_step($name)
{

		// ignore extensions that are already disabled
if (!isset($this->extensions[$name]) || !$this->extensions[$name]['ext_active'])

		// ignore extensions that are not enabled
if (!$this->is_enabled($name))

		{
return false;
}

		{
return false;
}

Line 336Line 341
	*/
public function purge_step($name)
{

	*/
public function purge_step($name)
{

		// ignore extensions that do not exist
if (!isset($this->extensions[$name]))

		// ignore extensions that are not configured
if (!$this->is_configured($name))

		{
return false;
}

		{
return false;
}

Line 431Line 436
			if ($file_info->isFile() && $file_info->getFilename() == 'composer.json')
{
$ext_name = $iterator->getInnerIterator()->getSubPath();

			if ($file_info->isFile() && $file_info->getFilename() == 'composer.json')
{
$ext_name = $iterator->getInnerIterator()->getSubPath();

				$composer_file = $iterator->getPath() . '/composer.json';

// Ignore the extension if there is no composer.json.
if (!is_readable($composer_file) || !($ext_info = file_get_contents($composer_file)))
{
continue;
}

$ext_info = json_decode($ext_info, true);

 
				$ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name);

				$ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name);


// Ignore the extension if directory depth is not correct or if the directory structure
// does not match the name value specified in composer.json.
if (substr_count($ext_name, '/') !== 1 || !isset($ext_info['name']) || $ext_name != $ext_info['name'])

				if ($this->is_available($ext_name))




				{

				{

					continue;

					$available[$ext_name] = $this->get_extension_path($ext_name, true);

				}

				}


$available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/';

 
			}
}
ksort($available);

			}
}
ksort($available);

Line 472Line 463
		$configured = array();
foreach ($this->extensions as $name => $data)
{

		$configured = array();
foreach ($this->extensions as $name => $data)
{

 
			if ($this->is_configured($name))
{
unset($data['metadata']);

			$data['ext_path'] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path'];
$configured[$name] = $data;

			$data['ext_path'] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path'];
$configured[$name] = $data;

 
			}

		}
return $configured;
}

		}
return $configured;
}

Line 490Line 485
		$enabled = array();
foreach ($this->extensions as $name => $data)
{

		$enabled = array();
foreach ($this->extensions as $name => $data)
{

			if ($data['ext_active'])

			if ($this->is_enabled($name))

			{
$enabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path'];
}

			{
$enabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path'];
}

Line 511Line 506
		$disabled = array();
foreach ($this->extensions as $name => $data)
{

		$disabled = array();
foreach ($this->extensions as $name => $data)
{

			if (!$data['ext_active'])

			if ($this->is_disabled($name))

			{
$disabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path'];
}

			{
$disabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path'];
}

Line 527Line 522
	*/
public function is_available($name)
{

	*/
public function is_available($name)
{

		return file_exists($this->get_extension_path($name, true));









		$md_manager = $this->create_extension_metadata_manager($name);
try
{
return $md_manager->get_metadata('all') && $md_manager->validate_enable();
}
catch (\phpbb\extension\exception $e)
{
return false;
}

	}

/**

	}

/**

Line 538Line 541
	*/
public function is_enabled($name)
{

	*/
public function is_enabled($name)
{

		return isset($this->extensions[$name]) && $this->extensions[$name]['ext_active'];

		return isset($this->extensions[$name]['ext_active']) && $this->extensions[$name]['ext_active'];

	}

/**

	}

/**

Line 549Line 552
	*/
public function is_disabled($name)
{

	*/
public function is_disabled($name)
{

		return isset($this->extensions[$name]) && !$this->extensions[$name]['ext_active'];

		return isset($this->extensions[$name]['ext_active']) && !$this->extensions[$name]['ext_active'];

	}

/**

	}

/**

Line 563Line 566
	*/
public function is_configured($name)
{

	*/
public function is_configured($name)
{

		return isset($this->extensions[$name]);

		return isset($this->extensions[$name]['ext_active']);

	}

/**

	}

/**

Line 573Line 576
	* @param bool $force_update Ignores cached data. Defaults to false.
* @param bool $force_cache Force the use of the cache. Override $force_update.
* @param string $stability Force the stability (null by default).

	* @param bool $force_update Ignores cached data. Defaults to false.
* @param bool $force_cache Force the use of the cache. Override $force_update.
* @param string $stability Force the stability (null by default).

	* @return string

	* @return array

	* @throws runtime_exception
*/
public function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false, $stability = null)

	* @throws runtime_exception
*/
public function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false, $stability = null)

Line 589Line 592

$version_helper = new \phpbb\version_helper($this->cache, $this->config, new file_downloader());
$version_helper->set_current_version($meta['version']);


$version_helper = new \phpbb\version_helper($this->cache, $this->config, new file_downloader());
$version_helper->set_current_version($meta['version']);

		$version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename']);

		$version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false);

		$version_helper->force_stability($stability);


		$version_helper->force_stability($stability);


		return $updates = $version_helper->get_suggested_updates($force_update, $force_cache);

		return $version_helper->get_ext_update_on_branch($force_update, $force_cache);

	}

/**

	}

/**