-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Responsibilities of index.php
and what to do about it
#1001
Labels
Code-Investigation-Needed
Code needs to be investigated
Code-Refactoring
Code refactoring
Need-Info
Additional information required
question
Indicates that an issue or pull request needs more information
Comments
logmanoriginal
added
Code-Refactoring
Code refactoring
question
Indicates that an issue or pull request needs more information
Need-Info
Additional information required
Code-Investigation-Needed
Code needs to be investigated
labels
Jan 8, 2019
logmanoriginal
added a commit
that referenced
this issue
Jun 6, 2019
Default bridges are currently statically defined in index.php, which is not the right place if we want to keep responsibilities separated. This commit introduces a new file whitelist.default.txt that holds the default bridges and which is loaded automatically, if whitelist.txt doesn't exist. Due to this it is also no longer necessary to have write permission for the root directory. References #1001
logmanoriginal
added a commit
that referenced
this issue
Jun 7, 2019
RSS-Bridge currently statically sets the timezone to UTC which can result in incorrect timestamps if the server is hosted in another region. This commit adds a new configuration parameter to allow admins to specify their own timezone for their servers. Invalid values will result in an error message. Example: [system] timezone = "UTC" For compatibility reasons the default value is set to UTC. This parameter accepts any of the supported timezones listed at https://www.php.net/manual/en/timezones.php Closes #956 References #1001
logmanoriginal
added a commit
that referenced
this issue
Jun 18, 2019
RSS-Bridge currently sanitizes the format name only for the display action, which can cause problems if other actions depend on formats as well. It is therefore better to do sanitization in the factory class for formats. Additionally, formats should not require a perfect match, so 'Atom' and 'aToM' make no difference. This will also allow users to define formats in their own style (i.e. only lowercase via CLI). References #1001
logmanoriginal
added a commit
that referenced
this issue
Jun 18, 2019
The bridge factory can be based on the abstract factory class if it wasn't static. This allows for higher abstraction and makes future extensions possible. Also, not all parts of RSS-Bridge need to work on the same instance of the bridge factory. References #1001
logmanoriginal
added a commit
that referenced
this issue
Jun 18, 2019
The cache factory can be based on the abstract factory class if it wasn't static. This allows for higher abstraction and makes future extensions possible. Also, not all parts of RSS-Bridge need to work on the same instance of the factory. References #1001
logmanoriginal
added a commit
that referenced
this issue
Jun 18, 2019
The format factory can be based on the abstract factory class if it wasn't static. This allows for higher abstraction and makes future extensions possible. Also, not all parts of RSS-Bridge need to work on the same instance of the factory. References #1001
All done. |
infominer33
pushed a commit
to web-work-tools/rss-bridge
that referenced
this issue
Apr 17, 2020
Default bridges are currently statically defined in index.php, which is not the right place if we want to keep responsibilities separated. This commit introduces a new file whitelist.default.txt that holds the default bridges and which is loaded automatically, if whitelist.txt doesn't exist. Due to this it is also no longer necessary to have write permission for the root directory. References RSS-Bridge#1001
infominer33
pushed a commit
to web-work-tools/rss-bridge
that referenced
this issue
Apr 17, 2020
RSS-Bridge currently statically sets the timezone to UTC which can result in incorrect timestamps if the server is hosted in another region. This commit adds a new configuration parameter to allow admins to specify their own timezone for their servers. Invalid values will result in an error message. Example: [system] timezone = "UTC" For compatibility reasons the default value is set to UTC. This parameter accepts any of the supported timezones listed at https://www.php.net/manual/en/timezones.php Closes RSS-Bridge#956 References RSS-Bridge#1001
infominer33
pushed a commit
to web-work-tools/rss-bridge
that referenced
this issue
Apr 17, 2020
RSS-Bridge currently sanitizes the format name only for the display action, which can cause problems if other actions depend on formats as well. It is therefore better to do sanitization in the factory class for formats. Additionally, formats should not require a perfect match, so 'Atom' and 'aToM' make no difference. This will also allow users to define formats in their own style (i.e. only lowercase via CLI). References RSS-Bridge#1001
infominer33
pushed a commit
to web-work-tools/rss-bridge
that referenced
this issue
Apr 17, 2020
The bridge factory can be based on the abstract factory class if it wasn't static. This allows for higher abstraction and makes future extensions possible. Also, not all parts of RSS-Bridge need to work on the same instance of the bridge factory. References RSS-Bridge#1001
infominer33
pushed a commit
to web-work-tools/rss-bridge
that referenced
this issue
Apr 17, 2020
The cache factory can be based on the abstract factory class if it wasn't static. This allows for higher abstraction and makes future extensions possible. Also, not all parts of RSS-Bridge need to work on the same instance of the factory. References RSS-Bridge#1001
infominer33
pushed a commit
to web-work-tools/rss-bridge
that referenced
this issue
Apr 17, 2020
The format factory can be based on the abstract factory class if it wasn't static. This allows for higher abstraction and makes future extensions possible. Also, not all parts of RSS-Bridge need to work on the same instance of the factory. References RSS-Bridge#1001
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Code-Investigation-Needed
Code needs to be investigated
Code-Refactoring
Code refactoring
Need-Info
Additional information required
question
Indicates that an issue or pull request needs more information
index.php
has grown quite complex with the addition of new features and continuous effort of the community for improvement. From my point of view it has reached a point where it makes sense to re-factor it into smaller pieces. A task I'm currently working on.This issue is about making the process transparent for everyone and to get some feedback before investing too much of my precious spare time. It also serves as a TODO list for all the things that should be done.
But going into that, find below my summary for the current responsibilities of
index.php
(basically a human friendly interpretation of the file):Show responsibilities of `index.php`
$_GET
arraylist
actionContent-Type
headerdetect
actionLocation
headerdisplay
actionHttp-If-Modified-Since
headerLast-Modified
headererror_log
Content-Type
headererror_log
Content-Type
headererror_log
Content-Type
headerBased on the list of responsibilities I came up with a list of tasks that take the
SOLID
approach a little more serious.The SOLID approach
S
= Single responsibility principleO
= Open/closed principleL
= Liskov substitution principleI
= Interface segregation principleD
= Dependency inversion principle=> Google it
=> Don't take it too seriously 😉
Single responsibility principle
Configuration
class. References Time stamp #956Loading CLI and GET arguments should be handled by aUserInput
class.Setting the user agent is responsibility of theConfiguration
class.Configuration
class.index.php
should work as a controller, as in MVC.*Action
classes.*Action
classes should be initialized by aActionFactory
class.User input data should be cleaned up by theUserInput
class.Configuration
class.Cache
class.CacheAbstract
class.Configuration
class.Open/closed principle
// Mostly covered by previous points
Liskov substitution principle
Interface segregation principle
// Mostly covered by previous points
Dependency inversion principle
// Mostly covered by previous points
Testing
Let me know if you have further suggestions or want to work on any of the points listed above.
The text was updated successfully, but these errors were encountered: