phpbb\controller\provider SOLVED

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
Wirral Talk
Registered User
Posts: 74
Joined: Mon Jun 09, 2014 12:29 am
Location: Wirral, UK
Contact:

phpbb\controller\provider SOLVED

Post by Wirral Talk »

Can anyone tell me what changed with this class between 3.1.10 and 3.2.5 please.

I'm getting a not found error???
Last edited by Wirral Talk on Thu Jan 24, 2019 1:44 pm, edited 1 time in total.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53400
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: phpbb\controller\provider

Post by Brf »

There is no phpbb\controller\provider.php in phpBB 3.2
Wirral Talk
Registered User
Posts: 74
Joined: Mon Jun 09, 2014 12:29 am
Location: Wirral, UK
Contact:

Re: phpbb\controller\provider

Post by Wirral Talk »

Was there in 3.1 and if so what is its replacement/equivalence in 3.2?

I've looked around and got confused, I'm not OOP.

Depending where I look class not found error is

phpbb\controller\provider
phpbb\controller\ provider()
Wirral Talk
Registered User
Posts: 74
Joined: Mon Jun 09, 2014 12:29 am
Location: Wirral, UK
Contact:

Re: phpbb\controller\provider

Post by Wirral Talk »

Brf wrote: Tue Jan 22, 2019 3:28 pm There is no phpbb\controller\provider.php in phpBB 3.2
You are correct but the existence of the following page is highly misleading https://area51.phpbb.com/docs/code/3.2. ... vider.html

I've found out more and currently trying to figure out what $routing_helper is in phpbb\controller\helper, or more importantly how to construct it?
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6673
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: phpbb\controller\provider

Post by HiFiKabin »

It would help us to help you if you explained what you were hoping to achieve

Moved to Custom Coding
Wirral Talk
Registered User
Posts: 74
Joined: Mon Jun 09, 2014 12:29 am
Location: Wirral, UK
Contact:

Re: phpbb\controller\provider

Post by Wirral Talk »

Thanks for the move, I wasn't aware of this section - yes, I miss the obvious quite often.

I'm trying to fix an unsupported extension that was working at 3.1.10 and doesn't work at 3.2.5.

Although I program a lot in php I am a really old fashioned procedural programmer, object orientated stuff is just too much for my brain and I don't use things like Symphony, twig etc.

The bit that I realise is causing the problem is

Code: Select all

global $db, $config, $user, $template, $request, $auth, $cache;
		global $phpbb_root_path, $phpbb_admin_path, $phpEx;
		global $phpbb_extension_manager, $table_prefix, $phpbb_container, $phpbb_path_helper;

		$provider = new \phpbb\controller\ provider();
		$symphony_request = new \phpbb\ symfony_request($request);
		$filesystem = new \phpbb\ filesystem();
		$helper = new \phpbb\controller\ helper($template, $user, $config, $provider, $phpbb_extension_manager, $symphony_request, $request, $filesystem, $phpbb_root_path, $phpEx);
"helper" has clearly changed in 3.2.5 and has fewer arguments and provider class no longer exists, I got so far last night but wasn't too sure what I was doing after I "robbed" some code from somewhere else .....

Code: Select all

	$mock_config = new \phpbb\config\config(array('force_server_vars' => false, 'enable_mod_rewrite' => ''));
    $mock_router = $this->getMockBuilder('\\phpbb\\routing\\router')->setMethods(array('setContext', 'generate'))->disableOriginalConstructor()->getMock();
    $mock_router->method('setContext')->willReturn(true);
    $mock_router->method('generate')->willReturn('foobar');
	$routing_helper = new \phpbb\routing\helper($mock_config, $mock_router, new \phpbb\symfony_request($request), $request, new \phpbb\filesystem\filesystem(), $phpbb_root_path, $phpEx);
	$helper = new \phpbb\controller\ helper($template, $user, $config, $symphony_request, $request, $routing_helper);
But at this point I hadn't got a clue whether what I was doing was right or just a load of nonsense. I battle with things and its not often I ask for help but on this occasion I am way out my depth and pretty desperate. Unfortunately another disaster happened last night and by the time I got back to this I had completely lost my train of thought (goldfish memory).

Thanks for any clues/pointers anyone can give.

EDIT: Perhaps I should mention this is the main_module in ACP
Last edited by Wirral Talk on Thu Jan 24, 2019 1:19 pm, edited 1 time in total.
User avatar
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs
Contact:

Re: phpbb\controller\provider

Post by mrgoldy »

You're still not really explaining what you're trying to achieve.
Moreover, mocking a class is used for testing, not for a live environment.

If you just want the controller helper to generate a route, you can do something like this:

Code: Select all

global $phpbb_container
$helper = $phpbb_container->get('controller.helper');

$route = $helper->route('route_to_extension_path');
phpBB Studio / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
Wirral Talk
Registered User
Posts: 74
Joined: Mon Jun 09, 2014 12:29 am
Location: Wirral, UK
Contact:

Re: phpbb\controller\provider

Post by Wirral Talk »

Thank you, it gives me something to work from.

It is part of the oxpus feed reader extension (which was produced from the smix mod), there are no longer any links to a download. When I started using it I had problems with it interfering with other php sessions and I made some changes to the session management, in this process I think I lost my virgin copy (if I knew what the file was called I might have it in one of my backup systems) but as it worked fine for years in its modified form I was happy.

The extension produces two setup pages in ACP, one of these is blank in 3.2.5, error was provider class missing (which makes sense) so basically I'm trying to work round whatever provider did.

Not sure what else I can say, I don't know what is relevant and what isn't, I fix bits of code when I have to, I don't often understand whole systems.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: phpbb\controller\provider

Post by Lumpy Burgertushie »

have you looked at this:
viewtopic.php?f=456&t=2411596
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
Wirral Talk
Registered User
Posts: 74
Joined: Mon Jun 09, 2014 12:29 am
Location: Wirral, UK
Contact:

Re: phpbb\controller\provider

Post by Wirral Talk »

Lumpy Burgertushie wrote: Wed Jan 23, 2019 8:03 pm have you looked at this:
viewtopic.php?f=456&t=2411596
Yes thanks, I was planning on using that when I upgraded to 3.2 but unfortunately its not flexible enough for multiple feeds as it doesn't have individual settings for each feed. For a small number of feeds I would recommend it, it worked well when I did a trial.
Wirral Talk
Registered User
Posts: 74
Joined: Mon Jun 09, 2014 12:29 am
Location: Wirral, UK
Contact:

Re: phpbb\controller\provider SOLVED

Post by Wirral Talk »

mrgoldy wrote: Wed Jan 23, 2019 6:11 pm You're still not really explaining what you're trying to achieve.
Moreover, mocking a class is used for testing, not for a live environment.

If you just want the controller helper to generate a route, you can do something like this:

Code: Select all

global $phpbb_container
$helper = $phpbb_container->get('controller.helper');

$route = $helper->route('route_to_extension_path');
Brilliant, I can't thank you enough for that, just needed the $helper line you quoted.
Post Reply

Return to “phpBB Custom Coding”