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

refactor: create spark.php in system/, require by spark #8779

Closed
wants to merge 5 commits into from

Conversation

samsonasik
Copy link
Member

Description

Reduce repetitive copy paste manual when run composer update.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@samsonasik
Copy link
Member Author

Ready to review 👍 , we can have index.php in system as well in separate PR if this is accepted so reduce more manual upgrade.

@kenjis kenjis added the refactor Pull requests that refactor code label Apr 13, 2024
spark Outdated Show resolved Hide resolved
@kenjis
Copy link
Member

kenjis commented Apr 14, 2024

I don't think we need to have index.php in system.

  1. CI4 is slower than CI3. So I don't want to increase the file to load.
  2. We have created Boot class. So now index.php will not be broken as before.

Comment on lines +82 to +85
// LOAD OUR PATHS CONFIG FILE
// This is the line that might need to be changed, depending on your folder structure.
require FCPATH . '../app/Config/Paths.php';
// ^^^ Change this line if you move your application folder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we cannot modify system/spark.php.
How do we do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, the idea is to reduce manual change

The another way is make php requirment in single file under system, can also read CodeIgniter composer.json (yes, it make another include/read file, but reduce maintenance needs), eg: system/requirement.php so it included in both spark and public/index.php so once requirement change, it will only require composer up

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way is make app/Config/Paths.php as an .env value, eg

APP_CONFIG_PATHS = "app/Config/Paths.php"

so it configurable there, default no data, fallback to default path

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think including system/requirement.php is better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, $paths->systemDirectory is not needed here, as already inside the directory, I will create new commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it needed on exit(Boot::bootSpark($paths)); as pass Paths object

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the Paths instance first.
.env is loaded in Boot class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, closing for now.

@kenjis kenjis added the docs needed Pull requests needing documentation write-ups and/or revisions. label Apr 14, 2024
@samsonasik samsonasik closed this Apr 14, 2024
@samsonasik samsonasik deleted the spark-system branch April 14, 2024 02:50
@MGatner
Copy link
Member

MGatner commented May 23, 2024

I like the concept but I see the issues with implementation. Not opposed to another attempt but I think @kenjis' recent changes to Boot help a lot already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs needed Pull requests needing documentation write-ups and/or revisions. refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants