Skip to content

Commit 4110441

Browse files
authored
Merge pull request #7186 from kenjis/fix-docs-upgrade_4xx-BASEPATH
docs: improve Upgrading from 3.x to 4.x
2 parents 9402481 + 7d08abd commit 4110441

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

user_guide_src/source/installation/upgrade_4xx.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Application Structure
4949
- The **application** folder is renamed as **app** and the framework still has **system** folders,
5050
with the same interpretation as before.
5151
- The framework now provides for a **public** folder, intended as the document root for your app.
52+
- The ``defined('BASEPATH') OR exit('No direct script access allowed');`` line is not necessary
53+
because files outside the **public** folder are not accessible in the standard configuration.
54+
And CI4 no longer defines the constant ``BASEPATH``, so remove the line in all files.
5255
- There is also a **writable** folder, to hold cache data, logs, and session data.
5356
- The **app** folder looks very similar to **application** for CI3, with some
5457
name changes, and some subfolders moved to the **writable** folder.
@@ -132,8 +135,8 @@ Helpers
132135
- `redirect() Documentation CodeIgniter 3.X <https://codeigniter.com/userguide3/helpers/url_helper.html#redirect>`_
133136
- `redirect() Documentation CodeIgniter 4.X <../general/common_functions.html#redirect>`_
134137

135-
Events
136-
======
138+
Hooks
139+
=====
137140

138141
- `Hooks <https://www.codeigniter.com/userguide3/general/hooks.html>`_ have been
139142
replaced by :doc:`../extending/events`.

user_guide_src/source/installation/upgrade_controllers.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Upgrade Guide
2727
1. First, move all controller files to the folder **app/Controllers**.
2828
2. Add this line just after the opening php tag: ``namespace App\Controllers;``
2929
3. Replace ``extends CI_Controller`` with ``extends BaseController``.
30+
4. Remove the line ``defined('BASEPATH') OR exit('No direct script access allowed');`` if it exists.
3031

3132
| If you use sub-directories in your controller structure, you have to change the namespace according to that.
3233
| For example, you have a version 3 controller located in **application/controllers/users/auth/Register.php**,

user_guide_src/source/installation/upgrade_migrations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Upgrade Guide
2626

2727
1. If your v3 project uses sequential migration names you have to change those to timestamp names.
2828
2. You have to move all migration files to the new folder **app/Database/Migrations**.
29-
3. Remove the following line ``defined('BASEPATH') OR exit('No direct script access allowed');``.
29+
3. Remove the line ``defined('BASEPATH') OR exit('No direct script access allowed');`` if it exists.
3030
4. Add this line just after the opening php tag: ``namespace App\Database\Migrations;``.
3131
5. Below the ``namespace App\Database\Migrations;`` line add this line: ``use CodeIgniter\Database\Migration;``
3232
6. Replace ``extends CI_Migration`` with ``extends Migration``.

user_guide_src/source/installation/upgrade_views.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Upgrade Guide
2828
- from ``$this->load->view('directory_name/file_name')`` to ``return view('directory_name/file_name');``
2929
- from ``$content = $this->load->view('file', $data, TRUE);`` to ``$content = view('file', $data);``
3030
3. (optional) You can change the echo syntax in views from ``<?php echo $title; ?>`` to ``<?= $title ?>``
31+
4. Remove the line ``defined('BASEPATH') OR exit('No direct script access allowed');`` if it exists.
3132

3233
Code Example
3334
============

0 commit comments

Comments
 (0)