Comments (12)
This is what I'd expect:
Nonsense folders
A warning in the logs:
Warning: An unrecognized extension was found at
/path/to/that/folder
Missing extensions
A nice message (not an exception):
Symphony could not find "Export Ensemble" extension. Please make sure all files and folders are available at
/extensions/export_ensemble/
(double-check the folder name).
from symphonycms.
If only it was that easy. Symphony finds extension folder first. That is, it gets all the directories in EXTENSIONS
and then looks for the extension.driver.php
. If the extension driver isn't found, an error is thrown.
In your scenario, it's difficult to tell the difference (at least with the current Extension Manager), between an empty directory and an misnamed folder. @rowan-lewis and I spent several hours getting a solution out that involved using Iterators and Reflection classes before just throwing it away. The overhead it added wasn't worth the education.
It's a very difficult thing to accomplish with the current Extension Manager, it would need to be rewritten. I'm not totally against this, but there's definitely more pressing (and exciting) things to focus our efforts on.
In the meantime, #680 is probably the issue you were after.
from symphonycms.
In a first step, wouldn't it be possible to make Symphony skip all folders inside /extensions/
that do not match the naming conventions and log the mentioned warning. So "officially" extensions with wrong folder names (those Github download names) or nonsense folders would not be available in the system.
This should be okay until Symphony requires an extension while executing the backend.
In a second step, couldn't Symphony just throw an error when it actually "misses" an extension? This way the system would not have to determine if an misnamed extension is installed or not when initialising Extension Manager (this is the problem as far as I understand).
from symphonycms.
The first step has actually already been commited. It doesn't log anything though since it uses the General::listDirStructure
which excludes the illnamed folders from being returned to the Extension Manager in the first case.
The second step is currently what happens, Symphony doesn't call an extension until it's required.
from symphonycms.
If the first step is already in the core, how could it be that a plain, empty test
folder breaks the system?
from symphonycms.
I was imprecise in describing my first step: I meant skipping all folders that don't match the naming conventions and do not contain extension.driver.php
. Those folders classified as "something is wrong with this extension".
from symphonycms.
And that's where the overhead kicks in ;)
from symphonycms.
I'm stunned – shouldn't this just require an additional check? First check if the folder name is valid (which is already done as you pointed out) and then check if extension.driver.php
exists inside this folder before continuing.
Apart from that: what about nicer error messages at least? This shouldn't be much overhead, right?
from symphonycms.
The above commit should fix the bug outlined in the title. The check to alert a developer that an extension needed updating was iterating over the entire extensions folder. This wasn't needed, as if an extension isn't installed, there's nothing that can be 'updated' about it, so that part was a big oversight by me in 2.2.
In regards to the nicer error messages, it is actually a challenging problem to solve elegantly. The hardest part is getting the extension name, Export Ensemble
as it's only available through the about()
function, which means the class has to be initialised first. Some of the solutions Rowan and I tried include:
- Parsing the file with regular expressions
- Trying to 'dehandlise' the folder name
- Including the extension driver and comparing the output of
get_included_classes
, using the 'odd' class out and creating an instance of it with Reflection, which then enabled us to callabout()
All added overhead and code to the point where we just said, it's not worth it.
The most elegant solution in my opinion is the one I proposed on the forum, having an extension.meta.xml
file that has the same information as the about
function. In that case there is no class discovery needed, that file would always exist, and if an error occurred loading the extension, it could be relied on to get various details to show the user (Name is the only one I can think of at the moment)
from symphonycms.
I disagree with your objections on the first point, brendo. All you will need is to catch the exception in the listAll function (and other functions listing the extensions), and log the message instead of letting it pass.
from symphonycms.
Sorry mate, but which point were you referring to?
from symphonycms.
Oh yes, sorry for being unclear. I was referring to this:
If only it was that easy. Symphony finds extension folder first. That is, it gets all the directories in EXTENSIONS and then looks for the extension.driver.php. If the extension driver isn't found, an error is thrown.
Because there is no need to distinguish between a proper extension with an invalid folder and an improper extension with a bugus folder, simply catching the exception and writing it to the log should suffice.
As you said later, the missing extension problem is handled somewhere else (hence the different Exception being thrown), so this can also be changed at that location.
I am getting a bit tired - been working all day again - so if I am still unclear, please let me know!
from symphonycms.
Related Issues (20)
- Unable to upload any media HOT 4
- Fatal Error: DatabaseException - SELECT SQL_CACHE- The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0. HOT 6
- Symphony Deprecated Warning: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated HOT 2
- Error installing Symphony 3.0.0 in PHP 7.3.7 HOT 6
- After successful, bare install of 3.0.0, clicking on Preferences -> Trying to access array offset on value of type null error
- Index column size too large. The maximum column size is 767 bytes
- call_user_func() expects parameter 1
- XSS vulnerability HOT 1
- vendor directory missing from 3.0.0 branch HOT 4
- Handle creation is broken in 2.7 HOT 4
- Error updating from 2.6.11 > 2.7.10 HOT 2
- XXE Vulnerability HOT 1
- Another Error updating Symphony 2.7.10 —> 3.0.0 in PHP 7+
- Login button touching password field
- Entries list .actions has no padding - missing body class .page-index
- Spaces missing in different PHP version HOT 3
- A htaccess file in root directory before Symphony CMS install
- Future of Symphony CMS HOT 13
- MySQL v8 Errors HOT 1
- The website is down HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symphonycms.