Skip to content

Commit 8ad55e3

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 38f7a59 + f6ce13b commit 8ad55e3

File tree

7 files changed

+100
-104
lines changed

7 files changed

+100
-104
lines changed

system/CLI/CLI.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,19 @@ class CLI
4242
* Is the readline library on the system?
4343
*
4444
* @var bool
45+
*
46+
* @deprecated 4.4.2 Should be protected.
47+
* @TODO Fix to camelCase in the next major version.
4548
*/
4649
public static $readline_support = false;
4750

4851
/**
4952
* The message displayed at prompts.
5053
*
5154
* @var string
55+
*
56+
* @deprecated 4.4.2 Should be protected.
57+
* @TODO Fix to camelCase in the next major version.
5258
*/
5359
public static $wait_msg = 'Press any key to continue...';
5460

@@ -63,6 +69,8 @@ class CLI
6369
* Foreground color list
6470
*
6571
* @var array<string, string>
72+
*
73+
* @TODO Fix to camelCase in the next major version.
6674
*/
6775
protected static $foreground_colors = [
6876
'black' => '0;30',
@@ -88,6 +96,8 @@ class CLI
8896
* Background color list
8997
*
9098
* @var array<string, string>
99+
*
100+
* @TODO Fix to camelCase in the next major version.
91101
*/
92102
protected static $background_colors = [
93103
'black' => '40',

tests/system/Commands/RoutesTest.php

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -198,46 +198,28 @@ public function testRoutesCommandRouteLegacy(): void
198198
$routes->loadRoutes();
199199

200200
$routes->setAutoRoute(true);
201-
$namespace = 'Tests\Support\Controllers';
202-
$routes->setDefaultNamespace($namespace);
203201

204202
command('routes');
205203

206204
$expected = <<<'EOL'
207-
+---------+-------------------------------+---------------+-----------------------------------------------------+----------------+---------------+
208-
| Method | Route | Name | Handler | Before Filters | After Filters |
209-
+---------+-------------------------------+---------------+-----------------------------------------------------+----------------+---------------+
210-
| GET | / | » | \App\Controllers\Home::index | | toolbar |
211-
| GET | closure | » | (Closure) | | toolbar |
212-
| GET | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
213-
| HEAD | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
214-
| POST | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
215-
| PUT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
216-
| DELETE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
217-
| OPTIONS | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
218-
| TRACE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
219-
| CONNECT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
220-
| CLI | testing | testing-index | \App\Controllers\TestController::index | | |
221-
| auto | hello | | \Tests\Support\Controllers\Hello::index | | toolbar |
222-
| auto | hello/index[/...] | | \Tests\Support\Controllers\Hello::index | | toolbar |
223-
| auto | newautorouting/getIndex[/...] | | \Tests\Support\Controllers\Newautorouting::getIndex | | toolbar |
224-
| auto | newautorouting/postSave[/...] | | \Tests\Support\Controllers\Newautorouting::postSave | | toolbar |
225-
| auto | popcorn | | \Tests\Support\Controllers\Popcorn::index | | toolbar |
226-
| auto | popcorn/index[/...] | | \Tests\Support\Controllers\Popcorn::index | | toolbar |
227-
| auto | popcorn/pop[/...] | | \Tests\Support\Controllers\Popcorn::pop | | toolbar |
228-
| auto | popcorn/popper[/...] | | \Tests\Support\Controllers\Popcorn::popper | | toolbar |
229-
| auto | popcorn/weasel[/...] | | \Tests\Support\Controllers\Popcorn::weasel | | toolbar |
230-
| auto | popcorn/oops[/...] | | \Tests\Support\Controllers\Popcorn::oops | | toolbar |
231-
| auto | popcorn/goaway[/...] | | \Tests\Support\Controllers\Popcorn::goaway | | toolbar |
232-
| auto | popcorn/index3[/...] | | \Tests\Support\Controllers\Popcorn::index3 | | toolbar |
233-
| auto | popcorn/canyon[/...] | | \Tests\Support\Controllers\Popcorn::canyon | | toolbar |
234-
| auto | popcorn/cat[/...] | | \Tests\Support\Controllers\Popcorn::cat | | toolbar |
235-
| auto | popcorn/json[/...] | | \Tests\Support\Controllers\Popcorn::json | | toolbar |
236-
| auto | popcorn/xml[/...] | | \Tests\Support\Controllers\Popcorn::xml | | toolbar |
237-
| auto | popcorn/toindex[/...] | | \Tests\Support\Controllers\Popcorn::toindex | | toolbar |
238-
| auto | popcorn/echoJson[/...] | | \Tests\Support\Controllers\Popcorn::echoJson | | toolbar |
239-
| auto | remap[/...] | | \Tests\Support\Controllers\Remap::_remap | | toolbar |
240-
+---------+-------------------------------+---------------+-----------------------------------------------------+----------------+---------------+
205+
+---------+------------------+---------------+----------------------------------------+----------------+---------------+
206+
| Method | Route | Name | Handler | Before Filters | After Filters |
207+
+---------+------------------+---------------+----------------------------------------+----------------+---------------+
208+
| GET | / | » | \App\Controllers\Home::index | | toolbar |
209+
| GET | closure | » | (Closure) | | toolbar |
210+
| GET | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
211+
| HEAD | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
212+
| POST | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
213+
| PUT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
214+
| DELETE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
215+
| OPTIONS | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
216+
| TRACE | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
217+
| CONNECT | testing | testing-index | \App\Controllers\TestController::index | | toolbar |
218+
| CLI | testing | testing-index | \App\Controllers\TestController::index | | |
219+
| auto | / | | \App\Controllers\Home::index | | toolbar |
220+
| auto | home | | \App\Controllers\Home::index | | toolbar |
221+
| auto | home/index[/...] | | \App\Controllers\Home::index | | toolbar |
222+
+---------+------------------+---------------+----------------------------------------+----------------+---------------+
241223
EOL;
242224
$this->assertStringContainsString($expected, $this->getBuffer());
243225
}

user_guide_src/source/changelogs/v4.4.2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Deprecations
3232
- **Filters:** The Auto-Discovery for Filters and ``Filters::discoverFilters()``
3333
is deprecated. Use :ref:`registrars` instead. See :ref:`modules-filters` for
3434
details.
35+
- **CLI:** The public property ``CLI::$readline_support`` and ``CLI::$wait_msg``
36+
are deprecated. These methods will be protected.
3537

3638
Bugs Fixed
3739
**********

user_guide_src/source/installation/upgrade_440.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ When Passing Classname with Namespace to Factories
9191
The behavior of passing a classname with a namespace to Factories has been changed.
9292
See :ref:`ChangeLog <v440-factories>` for details.
9393

94-
If you have code like ``model('\Myth\Auth\Models\UserModel::class')`` or
94+
If you have code like ``model(\Myth\Auth\Models\UserModel::class)`` or
9595
``model('Myth\Auth\Models\UserModel')`` (the code may be in the third-party packages),
9696
and you expect to load your ``App\Models\UserModel``, you need to define the
9797
classname to be loaded before the first loading of that class::

user_guide_src/source/tutorial/create_news_items.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ You can read more about the CSRF protection in :doc:`Security <../libraries/secu
2626
because :ref:`auto-routing-legacy` permits any HTTP method to access a controller.
2727
Accessing the controller with a method you don't expect could bypass the filter.
2828

29+
Adding Routing Rules
30+
********************
31+
32+
Before you can start adding news items into your CodeIgniter application
33+
you have to add an extra rule to **app/Config/Routes.php** file. Make sure your
34+
file contains the following:
35+
36+
.. literalinclude:: create_news_items/004.php
37+
38+
The route directive for ``'news/new'`` is placed before the directive for ``'news/(:segment)'`` to ensure that the form to create a news item is displayed.
39+
40+
The ``$routes->post()`` line defines the router for a POST request. It matches
41+
only a POST request to the URI path **/news**, and it maps to the ``create()`` method of
42+
the ``News`` class.
43+
44+
You can read more about different routing types in :ref:`defined-route-routing`.
45+
2946
Create a Form
3047
*************
3148

@@ -151,23 +168,6 @@ never need to do that, since it is an auto-incrementing field in the database.
151168
This helps protect against Mass Assignment Vulnerabilities. If your model is
152169
handling your timestamps, you would also leave those out.
153170

154-
Adding Routing Rules
155-
********************
156-
157-
Before you can start adding news items into your CodeIgniter application
158-
you have to add an extra rule to **app/Config/Routes.php** file. Make sure your
159-
file contains the following:
160-
161-
.. literalinclude:: create_news_items/004.php
162-
163-
The route directive for ``'news/new'`` is placed before the directive for ``'news/(:segment)'`` to ensure that the form to create a news item is displayed.
164-
165-
The ``$routes->post()`` line defines the router for a POST request. It matches
166-
only a POST request to the URI path **/news**, and it maps to the ``create()`` method of
167-
the ``News`` class.
168-
169-
You can read more about different routing types in :ref:`defined-route-routing`.
170-
171171
Create a News Item
172172
******************
173173

user_guide_src/source/tutorial/news_section.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ that are going to display the news items to the user. This could be done
120120
in our ``Pages`` controller created earlier, but for the sake of clarity,
121121
a new ``News`` controller is defined.
122122

123+
Adding Routing Rules
124+
====================
125+
126+
Modify your **app/Config/Routes.php** file, so it looks as follows:
127+
128+
.. literalinclude:: news_section/008.php
129+
130+
This makes sure the requests reach the ``News`` controller instead of
131+
going directly to the ``Pages`` controller. The second ``$routes->get()`` line
132+
routes URI's with a slug to the ``show()`` method in the ``News`` controller.
133+
123134
Create News Controller
124135
======================
125136

@@ -200,17 +211,6 @@ The only thing left to do is create the corresponding view at
200211

201212
.. literalinclude:: news_section/007.php
202213

203-
Adding Routing Rules
204-
********************
205-
206-
Modify your **app/Config/Routes.php** file, so it looks as follows:
207-
208-
.. literalinclude:: news_section/008.php
209-
210-
This makes sure the requests reach the ``News`` controller instead of
211-
going directly to the ``Pages`` controller. The second ``$routes->get()`` line
212-
routes URI's with a slug to the ``show()`` method in the ``News`` controller.
213-
214214
Point your browser to your "news" page, i.e., **localhost:8080/news**,
215215
you should see a list of the news items, each of which has a link
216216
to display just the one article.

user_guide_src/source/tutorial/static_pages.rst

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,51 @@ Static Pages
99
:doc:`installed the framework <../installation/index>` in your
1010
development environment.
1111

12-
The first thing you're going to do is set up a **controller** to handle
13-
static pages. A controller is simply a class that helps delegate work.
14-
It is the glue of your web application.
12+
The first thing you're going to do is set up routing rules to handle static pages.
13+
14+
Setting Routing Rules
15+
*********************
16+
17+
Routing associates a URI with a controller's method. A controller is simply a
18+
class that helps delegate work. We will create a controller later.
19+
20+
Let's set up routing rules. Open the routes file located at **app/Config/Routes.php**.
21+
22+
The only route directive there to start with should be:
23+
24+
.. literalinclude:: static_pages/003.php
25+
26+
This directive says that any incoming request without any content
27+
specified should be handled by the ``index()`` method inside the ``Home`` controller.
28+
29+
Add the following lines, **after** the route directive for ``'/'``.
30+
31+
.. literalinclude:: static_pages/004.php
32+
:lines: 2-
33+
34+
CodeIgniter reads its routing rules from top to bottom and routes the
35+
request to the first matching rule. Each rule is a regular expression
36+
(left-side) mapped to a controller and method name
37+
(right-side). When a request comes in, CodeIgniter looks for the first
38+
match, and calls the appropriate controller and method, possibly with
39+
arguments.
40+
41+
More information about routing can be found in the :doc:`../incoming/routing`.
42+
43+
Here, the second rule in the ``$routes`` object matches a GET request
44+
to the URI path **/pages**, and it maps to the ``index()`` method of the ``Pages`` class.
45+
46+
The third rule in the ``$routes`` object matches a GET request to a URI segment
47+
using the placeholder ``(:segment)``, and passes the parameter to the
48+
``view()`` method of the ``Pages`` class.
1549

1650
Let's Make our First Controller
1751
*******************************
1852

53+
The next thing you're going to do is set up a **controller** to handle
54+
static pages. A controller is simply a class that helps delegate work.
55+
It is the glue of your web application.
56+
1957
Create Pages Controller
2058
=======================
2159

@@ -141,42 +179,6 @@ view.
141179
throw errors on case-sensitive platforms. You can read more about it in
142180
:doc:`../outgoing/views`.
143181

144-
Setting Routing Rules
145-
*********************
146-
147-
We have made the controller. The next thing is to set routing rules.
148-
Routing associates a URI with a controller's method.
149-
150-
Let's do that. Open the routes file located at **app/Config/Routes.php**.
151-
152-
The only route directive there to start with should be:
153-
154-
.. literalinclude:: static_pages/003.php
155-
156-
This directive says that any incoming request without any content
157-
specified should be handled by the ``index()`` method inside the ``Home`` controller.
158-
159-
Add the following lines, **after** the route directive for ``'/'``.
160-
161-
.. literalinclude:: static_pages/004.php
162-
:lines: 2-
163-
164-
CodeIgniter reads its routing rules from top to bottom and routes the
165-
request to the first matching rule. Each rule is a regular expression
166-
(left-side) mapped to a controller and method name
167-
(right-side). When a request comes in, CodeIgniter looks for the first
168-
match, and calls the appropriate controller and method, possibly with
169-
arguments.
170-
171-
More information about routing can be found in the :doc:`../incoming/routing`.
172-
173-
Here, the second rule in the ``$routes`` object matches a GET request
174-
to the URI path **/pages**, and it maps to the ``index()`` method of the ``Pages`` class.
175-
176-
The third rule in the ``$routes`` object matches a GET request to a URI segment
177-
using the placeholder ``(:segment)``, and passes the parameter to the
178-
``view()`` method of the ``Pages`` class.
179-
180182
Running the App
181183
***************
182184

0 commit comments

Comments
 (0)