Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instalation problem/issue #54

Closed
Scorpions95 opened this issue Mar 25, 2019 · 1 comment
Closed

Instalation problem/issue #54

Scorpions95 opened this issue Mar 25, 2019 · 1 comment

Comments

@Scorpions95
Copy link

Hi dm
i try to install mchat on my test board but it shows an error
here is it

[quote="kasimi"]Open [c]ext/dmzx/mchat/ext.php[/c], find [c]$config = $this->container->get('config');[/c] and on a new line above, add [c]return true;[/c]

Now enable again. Do you still see any errors?

By the way, the latest mChat is 2.1.2.[/quote]
i did the changes u said in previus post but still see the error

Here is the file and see what's wrong

[code]<?php

/**
*

*/

namespace dmzx\mchat;

use phpbb\extension\base;

class ext extends base
{
/**
* Requires phpBB 3.1.7-PL1 due to usage of \phpbb\session:update_session_infos()
* Requires phpBB 3.1.8-RC1 due to HTTPS in version check
* Requires phpBB 3.2.0 due to EoL of phpBB 3.1
*
* @return bool
* @access public
*/
public function is_enableable()
{
$config = $this->container->get('config');
return true;

	// Here we check if any modules from the mChat MOD for phpBB 3.0.x are still in the database.
	// This is_enableable() method is called multiple times during the installation but we only
	// need to do the following check once. Checking for the absence of the mchat_version value
	// in the config guarantees that we're in the very first step of the installation process.
	// Any later call of this method doesn't need to check this again and in fact will wrongly
	// detect the extension's modules as being remnants.
	if (empty($config['mchat_version']))
	{
		$table_prefix = $this->container->getParameter('core.table_prefix');
		$module_ids = $this->get_old_module_ids($table_prefix);

		if ($module_ids)
		{
			$lang = $this->container->get('language');
			$lang->add_lang('mchat_acp', 'dmzx/mchat');
			$php_ext = $this->container->getParameter('core.php_ext');
			$error_msg = $lang->lang('MCHAT_30X_REMNANTS', $table_prefix, implode($lang->lang('COMMA_SEPARATOR'), $module_ids)) . adm_back_link(append_sid('index.' . $php_ext, ['i' => 'acp_extensions', 'mode' => 'main']));

			trigger_error($error_msg, E_USER_WARNING);
		}
	}

	return phpbb_version_compare(PHPBB_VERSION, '3.2.0', '>=') && phpbb_version_compare(PHP_VERSION, '5.4.7', '>=');
}

/**
 * This method checks whether the phpbb_modules table contains remnants of the 3.0 MOD.
 * It returns an array of the modules' IDs, or an empty array if no old modules are found.
 *
 * @param string $table_prefix
 * @return array
 */
protected function get_old_module_ids($table_prefix)
{
	$db = $this->container->get('dbal.conn');

	$mchat_30x_module_langnames = [
		'ACP_CAT_MCHAT',
		'ACP_MCHAT_CONFIG',
		'ACP_USER_MCHAT',
		'UCP_CAT_MCHAT',
		'UCP_MCHAT_CONFIG',
	];

	$sql = 'SELECT module_id
		FROM ' . $table_prefix . 'modules
		WHERE ' . $db->sql_in_set('module_langname', $mchat_30x_module_langnames);
	$result = $db->sql_query($sql);
	$rows = $db->sql_fetchrowset($result);
	$db->sql_freeresult($result);

	$module_ids = [];

	foreach ($rows as $row)
	{
		$module_ids[] = $row['module_id'];
	}

	return $module_ids;
}

}
[/code]
here is the vers. info
https://i.imgur.com/2Q7QhRl.png

@Scorpions95
Copy link
Author

Screenshot 2019-03-24 16 59 48
Screenshot 2019-03-24 17 05 36
Screenshot 2019-03-24 17 07 43

@dmzx dmzx closed this as completed May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants