Skip to content

Upgrade CI to 4.1.3 (Old) - #3271

Closed
objecttothis wants to merge 177 commits into
masterfrom
CodeIgniter_4_upgrade
Closed

objecttothis wants to merge 177 commits into
masterfrom
CodeIgniter_4_upgrade

Conversation

- Changed PHP version to 7.3
- Changed CodeIgniter to 4.1.3
@objecttothis objecttothis added this to the 4.0.0 milestone Aug 10, 2021
@objecttothis objecttothis self-assigned this Aug 10, 2021
@daN4cat

daN4cat commented Aug 10, 2021

Copy link
Copy Markdown
Collaborator

Is this all we need to switch to CI 4?

I would have expected more changes than this but I might be wrong.

- Updated composer.lock file
- Updated composer.LICENSES file
- Updated composer.lock file
- Updated composer.lock file to fix incorrect packagist repo
@objecttothis

Copy link
Copy Markdown
Member Author

Is this all we need to switch to CI 4?

I would have expected more changes than this but I might be wrong.

hehe. No, there is a lot more. It's a draft pull request right now. I'm working on the changes now. The good news is that it's mostly syntax and naming changes. The bad news is that it's going to touch just about every file, so yay for refactoring!

- Renamed application to app
- Added writable
- Deleted application/core
- Capitalised core folder names inside app/
- Renamed third_party to ThirdParty
- Moved application/cache to /writable/cache
- Moved application/logs to /writable/logs
- Moved application/migrations to app/Database/Migrations/
- Added app/Filters
- Added Common.php
- Added system folder
@daN4cat

daN4cat commented Aug 10, 2021

Copy link
Copy Markdown
Collaborator

Indeed what I was expecting

@daN4cat

daN4cat commented Aug 10, 2021 •

Copy link
Copy Markdown
Collaborator

Why are the My_ files removed?

@objecttothis

Copy link
Copy Markdown
Member Author

Why are the My_ files removed?

This is from the upgrade guide

"There is no longer a nested application/core folder, as we have a different mechanism for extending framework components (see below)."

I haven't gotten to the part where the replacement mechanism is explained. I'm working through it methodically so that I don't miss anything.

- Moved public/uploads/item_pics to writable/uploads/item_pics
- Deleted public/uploads
- Added system files
- Removed basepath if check
- Added namespacing
- Refactored extends CI_model to extends Model
- Replaced $this->load->model('') with CI4 syntax.
- Corrected namespacing on nested models.
- Added namespacing for tokens
- Replaced $this->load->view('') with echo view('')
- Added namespacing to controllers.
- replaced extends CI_Controller with extends BaseController.
- Removed BASEPATH if check.
- Added namespacing to libraries.
- replaced $this->load->library() with CI4 variant.
- Removed BASEPATH if check.
- Refactored model and library loading.
- Refactored helper() loading calls.
- Renamed enum, reports, tokens to PascalCase
- Corrected namespace declarations
- Ported changes from CI3 config.php to App.php
- Added Boot folder with default file contents.
- Added config files not found in CI3.
- Ported changes from CI3 autoload.php to Autoload.php
- Added BaseController.php controller
@objecttothis objecttothis linked an issue Aug 12, 2021 that may be closed by this pull request
@objecttothis

Copy link
Copy Markdown
Member Author

closes #842

objecttothis and others added 2 commits August 13, 2021 01:39
- Ported over changes to Constants.php
- Renamed constants.php to Constants.php
- Ported over changes to Database.php
- Renamed database.php to Database.php
- Ported over changes to DocTypes.php
- Renamed doctypes.php to DocTypes.php
- Replaced CI3 email.php with Email.php from CI4
- Replaced foreign_chars.php with ForeignCharacters.php
- Renamed hooks to Events
- Refactored save_hook.php and renamed to Save_Event.php
- converted hooks to events
- memcached.php deleted and replaced with Cache.php
- Replaced mimes.php with Mimes.php from CI4
- namespaced pagination.php
- namespaced smileys.php
- Deprecated cookie_secure and used Cookie->secure instead
- Ported over default log-file permissions
- Ported over Encryption Key location
- Ported over exclusion uri to csrf and enabled
@jekkos

jekkos commented Aug 14, 2021

Copy link
Copy Markdown
Member

@objecttothis Here my first contribution. I have updated the composer buildbox and moved it to opensourcepos organization. Also have added the intl and mbstring dependencies to the buildbox. Let's see if it can install CI using composer now.

I have temporarily removed some of the unix commands for updating the version in the config files (as they were changes as you said).

@objecttothis

Copy link
Copy Markdown
Member Author

@objecttothis Here my first contribution. I have updated the composer buildbox and moved it to opensourcepos organization. Also have added the intl and mbstring dependencies to the buildbox. Let's see if it can install CI using composer now.

I have temporarily removed some of the unix commands for updating the version in the config files (as they were changes as you said).

Thanks for doing that. I'd say let's keep both working in the same branch and I can just fetch commits when I work on it. I think when/if people take parts of the refactoring work, they can just do the same.

objecttothis and others added 7 commits October 28, 2022 16:29
- Removed calls to $this-> where not necessary
- Added in explicit model creation
- correct capitalization of model()
- renamed variable so that it did not conflict with model name and matched convention
- Replaced get_instance() calls with model instantiation.
- Removed calls to $this-> where not necessary
- Added in explicit model creation
- Fixed private field that should be public
- Simplified reference in config()
@objecttothis

Copy link
Copy Markdown
Member Author

The exception handler for CI4 is super sexy. Obviously, that's only helpful for development and we will not want it to display exceptions in all their glory for production, but I suppose that is what the env file is for.
image

Comment thread app/Config/Filters.php Outdated
public $globals = [
'before' => [
// 'honeypot',
'honeypot',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

interesting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

5 participants