Installing the EPV

Discussion forum for Extension Writers regarding Extension Development.
User avatar
kylesands
Registered User
Posts: 47
Joined: Sun May 14, 2023 10:48 pm

Installing the EPV

Post by kylesands »

Hi, I recently starting playing around with making some extensions. So far so good, but I thought I would check out the EPV to see how valid my work is for submitting some day perhaps. The EPV readme says it requires at least PHP 5.5 so I thought I'd be good with PHP 8.1.19 since it's good for phpBB.

In running php composer.phar install on the EPV to run locally, I got a lot of warnings and a list of 10 problems similar to the first one on the list here.

Code: Select all

Problem 1
    - Installation request for phpspec/prophecy v1.10.3 -> satisfiable by phpspec/prophecy[v1.10.3].
    - phpspec/prophecy v1.10.3 requires php ^5.3|^7.0 -> your PHP version (8.1.19) does not satisfy that requirement.
Before I revert back to PHP 7.0, I thought I might ask if it should work with 8.1 and I may have some other issue to address or if 7.0 is indeed it for the EPV? Just wondering...

Thanks!
Kyle...
All things Glacier National Park and beyond - https://glacier.nationalparkschat.com
Development stuff for Glacier Park Chat! - https://development.nationalparkschat.com
User avatar
Crizzo
Translations & International Support Teams Manager
Translations & International Support Teams Manager
Posts: 1757
Joined: Thu Apr 23, 2009 1:20 pm
Location: Stuttgart, Germany
Name: Christian

Re: Installing the EPV

Post by Crizzo »

Hi,

In composer.json you can define a php version for the plattform, which is lower than your PHP8.1, see the phpbb/phpbb repository as an example.

Regards
My extensions for phpBB: CDB
German phpBB Support at www.phpbb.de
User avatar
kylesands
Registered User
Posts: 47
Joined: Sun May 14, 2023 10:48 pm

Re: Installing the EPV

Post by kylesands »

Hi Crizzo.... I confess I don't see the composer.json in the phpbb/phpbb repo. I do in the phpbb/phpbb-app repo though... From that, i added this to my local EPV composer.json near the bottom.

Code: Select all

"config": {
		"platform": {
			"php": "7.0"
		}
    }
I also tried just this as well....

Code: Select all

"platform": {
			"php": "7.0"
		}
I seem to have the same results with that on the "php composer.phar install", though I also confess that I don't mess with composer a lot, so I may need to read more about composer and revisit perhaps. I am having good luck with my extensions for my use though, so that's a win! :)

I do appreciate you giving me a hand though....
Thanks Crizzo...

Cheers!
Kyle....
All things Glacier National Park and beyond - https://glacier.nationalparkschat.com
Development stuff for Glacier Park Chat! - https://development.nationalparkschat.com
rxu
Extensions Development Team
Posts: 3958
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation

Re: Installing the EPV

Post by rxu »

Long story short, it's better using PHP 7 for EPV because its current sub-dependencies (f.e. some phpunit 5 dependencies etc.) don't work with PHP 8.
User avatar
kylesands
Registered User
Posts: 47
Joined: Sun May 14, 2023 10:48 pm

Re: Installing the EPV

Post by kylesands »

Ahh Sounds good.... Thanks rxu... I'll take a shot at that.

Thanks guys!
Cheers!
All things Glacier National Park and beyond - https://glacier.nationalparkschat.com
Development stuff for Glacier Park Chat! - https://development.nationalparkschat.com
User avatar
kylesands
Registered User
Posts: 47
Joined: Sun May 14, 2023 10:48 pm

Re: Installing the EPV

Post by kylesands »

Bam! Right on! I tried PHP7.0 first but that appeared to be too far back, so I went with 7.2. It looks like it was PHP 7.2.34 to be exact, and that worked! I've got some file type warnings on some Eclipse project files I'm betting I can ignore and a Packaging Structure error at the moment, but I'm calling that a win for the moment while I find and fix the error one....

Thanks!
Cheers!
All things Glacier National Park and beyond - https://glacier.nationalparkschat.com
Development stuff for Glacier Park Chat! - https://development.nationalparkschat.com
User avatar
kylesands
Registered User
Posts: 47
Joined: Sun May 14, 2023 10:48 pm

Re: Installing the EPV

Post by kylesands »

I'm running it locally like this....

Code: Select all

php src/EPV.php run --dir=/Applications/MAMP/htdocs/glacier/ext/glacierparkchat/glaciermenuinclude
I first thought my Packaging Structure error was due to something I configured incorrectly.. I'm hoping it still is although looking at it further, I'm not sure if I can get anything to pass.

Here's my output with some variable debugs added in to help me see what's happening... (You can ignore the warnings from the Eclipse project files for now)

Code: Select all

Test results for extension:
Warning: Can't detect the file type for .buildpath, handling it as a binary file.
Warning: Can't detect the file type for .project, handling it as a binary file.
Warning: Can't detect the file type for org.eclipse.core.resources.prefs, handling it as a binary file.
Warning: Can't detect the file type for org.eclipse.php.core.prefs, handling it as a binary file.
$this->namespace = glacierparkchat/glaciermenuinclude
$this->opendir = /Applications/MAMP/htdocs/glacier/ext/glacierparkchat/glaciermenuinclude
$dir = /Applications/MAMP/htdocs/glacier/ext/glacierparkchat/glaciermenuinclude/composer.json
$dir = /Applications/MAMP/htdocs/glacier/ext/glacierparkchat/glaciermenuinclude/composer.json
$sp = /Applications/MAMP/htdocs/glacier/ext/glacierparkchat/glaciermenuinclude/composer.json
$sp = /composer.json
$sp =
$sp =
Error: C) Packaging structure doesn't meet the extension DB policies.
Expected: glacierparkchat/glaciermenuinclude
Got:
Here's the EPV/src/Tests/Tests/epv_test_validate_directory_structure.php code with my added debugs around original lines 75-84 being the area of interest. I think line 76 in particular. The double str_replace. (It's a little messy with the added debugs)

Code: Select all

$this->output->addMessage(Output::DEBUG,sprintf("\$this->namespace = " . $this->namespace));
$this->output->addMessage(Output::DEBUG,sprintf("\$this->opendir = " . $this->opendir));
$this->output->addMessage(Output::DEBUG,sprintf("\$dir = " . $dir));
					$sp    = str_replace('\\', '/', $dir);
$this->output->addMessage(Output::DEBUG,sprintf("\$dir = " . $dir));
$this->output->addMessage(Output::DEBUG,sprintf("\$sp = " . $sp));
					$sp    = str_replace(str_replace('\\', '/', $this->opendir), '', $sp);
$this->output->addMessage(Output::DEBUG,sprintf("\$sp = " . $sp));
					$sp    = str_replace('/composer.json', '', $sp);
$this->output->addMessage(Output::DEBUG,sprintf("\$sp = " . $sp));
					if (!empty($sp) && $sp[0] == '/')
					{
					    $this->output->addMessage(Output::DEBUG,sprintf("\$sp !empty = " . !empty($sp)));
						// for some reason, there is a extra / on at least OS X
						$sp = substr($sp, 1, strlen($sp));
					}
$this->output->addMessage(Output::DEBUG,sprintf("\$sp = " . $sp));
					if ($this->namespace != $sp)
					{
						$this->output->addMessage(Output::ERROR,
							sprintf("Packaging structure doesn't meet the extension DB policies.\nExpected: %s\nGot: %s",
							$this->namespace, $sp));
					}
It looks like its goal is to compare $sp with $this->namespace in hopes that they match, but line 76 in the original code looks like it will always make sure they don't by replacing $this->opendir with '' in the double str_replace call for $sp. It seems to make sure that $sp ends up as a blank string in the end which will never match $this->namespace, unless I'm running it incorrectly, which is quite possible.

Any chance I'm doing that wrong perhaps? I'm hoping so, as I don't think I can get anything through that check.

Thanks!
Cheers!
All things Glacier National Park and beyond - https://glacier.nationalparkschat.com
Development stuff for Glacier Park Chat! - https://development.nationalparkschat.com
User avatar
GanstaZ
Registered User
Posts: 1221
Joined: Wed Oct 11, 2017 10:29 pm
Location: GZOverse

Re: Installing the EPV

Post by GanstaZ »

Based on what I see.. all seems to be good.
To be honest.. I wouldn't use it locally. I tested it locally some years ago and faced similar issues.
If I remember correctly, Paul mentioned about that issue somewhere on this forum, but I don't remember in what topic/s it was.

I would suggest to not use php 7 & switch back to 8.1 (there are many reasons for that).
About validation.. Just follow coding guidelines for phpBB & if you have github you can use many checks (many come with phpBB.. EPV included) that would help to keep the code valid.
Usus est magister optimus! phpBB pre-Triton & latest php environment.
When answer lies in the question, question becomes redundant!
User avatar
kylesands
Registered User
Posts: 47
Joined: Sun May 14, 2023 10:48 pm

Re: Installing the EPV

Post by kylesands »

Hey, Thanks GanstaZ.... I see... So the good news is, it sounds like I'm not just overlooking something silly on my end, so that's a relief... Heh...

Yea, I'm with you on sticking with 8+ for development. I plan to do that. Good call. I thought I'd give 7 a shot from the cmd line to see if I could get the EPV to work. I admit I was pretty excited when it actually ran. LOL! I don't currently have a github account so when I saw it had a "run local" option, I thought well that's just perfect, I'll do that. It may be time I finally look into a github account perhaps.

Just to be certain I'm following you, are you saying that the EPV should work from the online version or at least using github as the repo, or just not really bother with the EPV for validating anymore, and just follow the guidelines and call it good? I admit i was hoping to try and validate as best I could, but I guess as long as my extensions work for me, I'm ok with that for now.

Thanks!
Cheers!
All things Glacier National Park and beyond - https://glacier.nationalparkschat.com
Development stuff for Glacier Park Chat! - https://development.nationalparkschat.com
User avatar
GanstaZ
Registered User
Posts: 1221
Joined: Wed Oct 11, 2017 10:29 pm
Location: GZOverse

Re: Installing the EPV

Post by GanstaZ »

There is an EPV check in github tests as well, but it always gave me that namespace error so I disabled it.
I use this EPV tool (if I remember correctly, is limited to master branch only) if I want to check something.
Code sniffer does a pretty good job.. will help with coding guidelines.
You can find out more about tests.yml if you take a look at almost any phpbb extension that is available on github (starting with official extensions).

Even if you don't plan to submit extension/s for CDB, it's still good if code is following coding guidelines.
Usus est magister optimus! phpBB pre-Triton & latest php environment.
When answer lies in the question, question becomes redundant!
User avatar
kylesands
Registered User
Posts: 47
Joined: Sun May 14, 2023 10:48 pm

Re: Installing the EPV

Post by kylesands »

Ahh, right on! Thanks! Yea... Long term, I think I would like to submit some, plus I just like clean code. :)

Cheers!
All things Glacier National Park and beyond - https://glacier.nationalparkschat.com
Development stuff for Glacier Park Chat! - https://development.nationalparkschat.com

Return to “Extension Writers Discussion”