Andrey Andreev | c576995 | 2019-01-16 17:49:35 +0200 | [diff] [blame^] | 1 | |
| 2 | |
| 3 | <!DOCTYPE html> |
| 4 | <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> |
| 5 | <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> |
| 6 | <head> |
| 7 | <meta charset="utf-8"> |
| 8 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 9 | |
| 10 | <title>Upgrading from 2.2.x to 3.0.x — CodeIgniter 3.1.10 documentation</title> |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | <link rel="shortcut icon" href="../_static/ci-icon.ico"/> |
| 16 | |
| 17 | |
| 18 | |
| 19 | <link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'> |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> |
| 30 | |
| 31 | |
| 32 | |
| 33 | <link rel="index" title="Index" |
| 34 | href="../genindex.html"/> |
| 35 | <link rel="search" title="Search" href="../search.html"/> |
| 36 | <link rel="top" title="CodeIgniter 3.1.10 documentation" href="../index.html"/> |
| 37 | <link rel="up" title="Upgrading From a Previous Version" href="upgrading.html"/> |
| 38 | <link rel="next" title="Upgrading from 2.2.2 to 2.2.3" href="upgrade_223.html"/> |
| 39 | <link rel="prev" title="Upgrading from 3.0.0 to 3.0.1" href="upgrade_301.html"/> |
| 40 | |
| 41 | |
| 42 | <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
| 43 | |
| 44 | </head> |
| 45 | |
| 46 | <body class="wy-body-for-nav" role="document"> |
| 47 | |
| 48 | <div id="nav"> |
| 49 | <div id="nav_inner"> |
| 50 | |
| 51 | |
| 52 | |
| 53 | <div id="pulldown-menu" class="ciNav"> |
| 54 | <ul> |
| 55 | <li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> |
| 56 | </ul> |
| 57 | <ul class="current"> |
| 58 | <li class="toctree-l1 current"><a class="reference internal" href="index.html">Installation Instructions</a><ul class="current"> |
| 59 | <li class="toctree-l2"><a class="reference internal" href="downloads.html">Downloading CodeIgniter</a></li> |
| 60 | <li class="toctree-l2"><a class="reference internal" href="index.html">Installation Instructions</a></li> |
| 61 | <li class="toctree-l2 current"><a class="reference internal" href="upgrading.html">Upgrading From a Previous Version</a></li> |
| 62 | <li class="toctree-l2"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li> |
| 63 | </ul> |
| 64 | </li> |
| 65 | </ul> |
| 66 | <ul> |
| 67 | <li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> |
| 68 | <li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> |
| 69 | <li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> |
| 70 | <li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> |
| 71 | <li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> |
| 72 | <li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> |
| 73 | <li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> |
| 74 | </ul> |
| 75 | </li> |
| 76 | </ul> |
| 77 | <ul> |
| 78 | <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> |
| 79 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> |
| 80 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> |
| 81 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> |
| 82 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> |
| 83 | </ul> |
| 84 | </li> |
| 85 | </ul> |
| 86 | <ul> |
| 87 | <li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> |
| 88 | <li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> |
| 89 | <li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> |
| 90 | </ul> |
| 91 | </li> |
| 92 | </ul> |
| 93 | <ul> |
| 94 | <li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> |
| 95 | <li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> |
| 96 | <li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> |
| 97 | <li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> |
| 98 | <li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> |
| 99 | <li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> |
| 100 | <li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> |
| 101 | <li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> |
| 102 | <li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> |
| 103 | <li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> |
| 104 | <li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> |
| 105 | <li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> |
| 106 | <li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> |
| 107 | <li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> |
| 108 | <li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> |
| 109 | <li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> |
| 110 | <li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> |
| 111 | <li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> |
| 112 | <li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> |
| 113 | <li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> |
| 114 | <li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> |
| 115 | <li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> |
| 116 | <li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> |
| 117 | <li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> |
| 118 | <li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> |
| 119 | <li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> |
| 120 | <li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> |
| 121 | </ul> |
| 122 | </li> |
| 123 | </ul> |
| 124 | <ul> |
| 125 | <li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> |
| 126 | <li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> |
| 127 | <li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> |
| 128 | <li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> |
| 129 | <li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> |
| 130 | <li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> |
| 131 | <li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> |
| 132 | <li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> |
| 133 | <li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> |
| 134 | <li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> |
| 135 | <li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> |
| 136 | <li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> |
| 137 | <li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> |
| 138 | <li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> |
| 139 | <li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> |
| 140 | <li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> |
| 141 | <li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> |
| 142 | <li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> |
| 143 | <li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> |
| 144 | <li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> |
| 145 | <li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> |
| 146 | <li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> |
| 147 | <li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> |
| 148 | <li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> |
| 149 | <li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> |
| 150 | <li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> |
| 151 | <li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> |
| 152 | <li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> |
| 153 | <li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> |
| 154 | <li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> |
| 155 | <li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> |
| 156 | </ul> |
| 157 | </li> |
| 158 | </ul> |
| 159 | <ul> |
| 160 | <li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul> |
| 161 | <li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li> |
| 162 | <li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li> |
| 163 | <li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li> |
| 164 | <li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li> |
| 165 | <li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li> |
| 166 | <li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li> |
| 167 | <li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li> |
| 168 | <li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li> |
| 169 | <li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li> |
| 170 | <li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li> |
| 171 | <li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li> |
| 172 | <li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li> |
| 173 | <li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li> |
| 174 | <li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li> |
| 175 | </ul> |
| 176 | </li> |
| 177 | </ul> |
| 178 | <ul> |
| 179 | <li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> |
| 180 | <li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> |
| 181 | <li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> |
| 182 | <li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> |
| 183 | <li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> |
| 184 | <li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> |
| 185 | <li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> |
| 186 | <li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> |
| 187 | <li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> |
| 188 | <li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> |
| 189 | <li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> |
| 190 | <li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> |
| 191 | <li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> |
| 192 | <li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> |
| 193 | <li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> |
| 194 | <li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> |
| 195 | <li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> |
| 196 | <li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> |
| 197 | <li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> |
| 198 | <li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> |
| 199 | <li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> |
| 200 | <li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> |
| 201 | </ul> |
| 202 | </li> |
| 203 | </ul> |
| 204 | |
| 205 | </div> |
| 206 | |
| 207 | |
| 208 | </div> |
| 209 | </div> |
| 210 | <div id="nav2"> |
| 211 | <a href="#" id="openToc"> |
| 212 | <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> |
| 213 | </a> |
| 214 | </div> |
| 215 | |
| 216 | <div class="wy-grid-for-nav"> |
| 217 | |
| 218 | |
| 219 | <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| 220 | <div class="wy-side-nav-search"> |
| 221 | |
| 222 | <a href="../index.html" class="fa fa-home"> CodeIgniter</a> |
| 223 | |
| 224 | |
| 225 | <div role="search"> |
| 226 | <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
| 227 | <input type="text" name="q" placeholder="Search docs" /> |
| 228 | <input type="hidden" name="check_keywords" value="yes" /> |
| 229 | <input type="hidden" name="area" value="default" /> |
| 230 | </form> |
| 231 | </div> |
| 232 | </div> |
| 233 | |
| 234 | <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
| 235 | |
| 236 | |
| 237 | |
| 238 | <ul> |
| 239 | <li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> |
| 240 | </ul> |
| 241 | <ul class="current"> |
| 242 | <li class="toctree-l1 current"><a class="reference internal" href="index.html">Installation Instructions</a><ul class="current"> |
| 243 | <li class="toctree-l2"><a class="reference internal" href="downloads.html">Downloading CodeIgniter</a></li> |
| 244 | <li class="toctree-l2"><a class="reference internal" href="index.html">Installation Instructions</a></li> |
| 245 | <li class="toctree-l2 current"><a class="reference internal" href="upgrading.html">Upgrading From a Previous Version</a></li> |
| 246 | <li class="toctree-l2"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li> |
| 247 | </ul> |
| 248 | </li> |
| 249 | </ul> |
| 250 | <ul> |
| 251 | <li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> |
| 252 | <li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> |
| 253 | <li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> |
| 254 | <li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> |
| 255 | <li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> |
| 256 | <li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> |
| 257 | <li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> |
| 258 | </ul> |
| 259 | </li> |
| 260 | </ul> |
| 261 | <ul> |
| 262 | <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> |
| 263 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> |
| 264 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> |
| 265 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> |
| 266 | <li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> |
| 267 | </ul> |
| 268 | </li> |
| 269 | </ul> |
| 270 | <ul> |
| 271 | <li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> |
| 272 | <li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> |
| 273 | <li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> |
| 274 | </ul> |
| 275 | </li> |
| 276 | </ul> |
| 277 | <ul> |
| 278 | <li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> |
| 279 | <li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> |
| 280 | <li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> |
| 281 | <li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> |
| 282 | <li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> |
| 283 | <li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> |
| 284 | <li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> |
| 285 | <li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> |
| 286 | <li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> |
| 287 | <li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> |
| 288 | <li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> |
| 289 | <li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> |
| 290 | <li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> |
| 291 | <li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> |
| 292 | <li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> |
| 293 | <li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> |
| 294 | <li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> |
| 295 | <li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> |
| 296 | <li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> |
| 297 | <li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> |
| 298 | <li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> |
| 299 | <li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> |
| 300 | <li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> |
| 301 | <li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> |
| 302 | <li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> |
| 303 | <li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> |
| 304 | <li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> |
| 305 | </ul> |
| 306 | </li> |
| 307 | </ul> |
| 308 | <ul> |
| 309 | <li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> |
| 310 | <li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> |
| 311 | <li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> |
| 312 | <li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> |
| 313 | <li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> |
| 314 | <li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> |
| 315 | <li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> |
| 316 | <li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> |
| 317 | <li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> |
| 318 | <li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> |
| 319 | <li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> |
| 320 | <li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> |
| 321 | <li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> |
| 322 | <li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> |
| 323 | <li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> |
| 324 | <li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> |
| 325 | <li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> |
| 326 | <li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> |
| 327 | <li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> |
| 328 | <li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> |
| 329 | <li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> |
| 330 | <li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> |
| 331 | <li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> |
| 332 | <li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> |
| 333 | <li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> |
| 334 | <li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> |
| 335 | <li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> |
| 336 | <li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> |
| 337 | <li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> |
| 338 | <li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> |
| 339 | <li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> |
| 340 | </ul> |
| 341 | </li> |
| 342 | </ul> |
| 343 | <ul> |
| 344 | <li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul> |
| 345 | <li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li> |
| 346 | <li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li> |
| 347 | <li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li> |
| 348 | <li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li> |
| 349 | <li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li> |
| 350 | <li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li> |
| 351 | <li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li> |
| 352 | <li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li> |
| 353 | <li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li> |
| 354 | <li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li> |
| 355 | <li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li> |
| 356 | <li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li> |
| 357 | <li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li> |
| 358 | <li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li> |
| 359 | </ul> |
| 360 | </li> |
| 361 | </ul> |
| 362 | <ul> |
| 363 | <li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> |
| 364 | <li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> |
| 365 | <li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> |
| 366 | <li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> |
| 367 | <li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> |
| 368 | <li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> |
| 369 | <li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> |
| 370 | <li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> |
| 371 | <li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> |
| 372 | <li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> |
| 373 | <li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> |
| 374 | <li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> |
| 375 | <li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> |
| 376 | <li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> |
| 377 | <li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> |
| 378 | <li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> |
| 379 | <li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> |
| 380 | <li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> |
| 381 | <li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> |
| 382 | <li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> |
| 383 | <li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> |
| 384 | <li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> |
| 385 | </ul> |
| 386 | </li> |
| 387 | </ul> |
| 388 | |
| 389 | |
| 390 | |
| 391 | </div> |
| 392 | |
| 393 | </nav> |
| 394 | |
| 395 | <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
| 396 | |
| 397 | |
| 398 | <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> |
| 399 | <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| 400 | <a href="../index.html">CodeIgniter</a> |
| 401 | </nav> |
| 402 | |
| 403 | |
| 404 | |
| 405 | <div class="wy-nav-content"> |
| 406 | <div class="rst-content"> |
| 407 | <div role="navigation" aria-label="breadcrumbs navigation"> |
| 408 | <ul class="wy-breadcrumbs"> |
| 409 | <li><a href="../index.html">Docs</a> »</li> |
| 410 | |
| 411 | <li><a href="index.html">Installation Instructions</a> »</li> |
| 412 | |
| 413 | <li><a href="upgrading.html">Upgrading From a Previous Version</a> »</li> |
| 414 | |
| 415 | <li>Upgrading from 2.2.x to 3.0.x</li> |
| 416 | <li class="wy-breadcrumbs-aside"> |
| 417 | |
| 418 | </li> |
| 419 | <div style="float:right;margin-left:5px;" id="closeMe"> |
| 420 | <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> |
| 421 | </div> |
| 422 | </ul> |
| 423 | <hr/> |
| 424 | </div> |
| 425 | <div role="main" class="document"> |
| 426 | |
| 427 | <div class="section" id="upgrading-from-2-2-x-to-3-0-x"> |
| 428 | <h1>Upgrading from 2.2.x to 3.0.x<a class="headerlink" href="#upgrading-from-2-2-x-to-3-0-x" title="Permalink to this headline">¶</a></h1> |
| 429 | <p>Before performing an update you should take your site offline by replacing the index.php file with a static one.</p> |
| 430 | <div class="section" id="step-1-update-your-codeigniter-files"> |
| 431 | <h2>Step 1: Update your CodeIgniter files<a class="headerlink" href="#step-1-update-your-codeigniter-files" title="Permalink to this headline">¶</a></h2> |
| 432 | <p><strong>Replace</strong> all files and directories in your <em>system/</em> directory and |
| 433 | replace your index.php file. If any modifications were made to your |
| 434 | index.php they will need to be made fresh in this new one.</p> |
| 435 | <div class="admonition important"> |
| 436 | <p class="first admonition-title">Important</p> |
| 437 | <p class="last">You have to delete the old <em>system/</em> directory first and |
| 438 | then put the new one in its place. A simple copy-paste may cause |
| 439 | issues.</p> |
| 440 | </div> |
| 441 | <div class="admonition note"> |
| 442 | <p class="first admonition-title">Note</p> |
| 443 | <p class="last">If you have any custom developed files in these folders please |
| 444 | make copies of them first.</p> |
| 445 | </div> |
| 446 | </div> |
| 447 | <div class="section" id="step-2-update-your-classes-file-names"> |
| 448 | <h2>Step 2: Update your classes file names<a class="headerlink" href="#step-2-update-your-classes-file-names" title="Permalink to this headline">¶</a></h2> |
| 449 | <p>Starting with CodeIgniter 3.0, all class filenames (libraries, drivers, controllers |
| 450 | and models) must be named in a Ucfirst-like manner or in other words - they must |
| 451 | start with a capital letter.</p> |
| 452 | <p>For example, if you have the following library file:</p> |
| 453 | <blockquote> |
| 454 | <div>application/libraries/mylibrary.php</div></blockquote> |
| 455 | <p>… then you’ll have to rename it to:</p> |
| 456 | <blockquote> |
| 457 | <div>application/libraries/Mylibrary.php</div></blockquote> |
| 458 | <p>The same goes for driver libraries and extensions and/or overrides of CodeIgniter’s |
| 459 | own libraries and core classes.</p> |
| 460 | <blockquote> |
| 461 | <div>application/libraries/MY_email.php |
| 462 | application/core/MY_log.php</div></blockquote> |
| 463 | <p>The above files should respectively be renamed to the following:</p> |
| 464 | <blockquote> |
| 465 | <div>application/libraries/MY_Email.php |
| 466 | application/core/MY_Log.php</div></blockquote> |
| 467 | <p>Controllers:</p> |
| 468 | <blockquote> |
| 469 | <div>application/controllers/welcome.php -> application/controllers/Welcome.php</div></blockquote> |
| 470 | <p>Models:</p> |
| 471 | <blockquote> |
| 472 | <div>application/models/misc_model.php -> application/models/Misc_model.php</div></blockquote> |
| 473 | <p>Please note that this DOES NOT affect directories, configuration files, views, |
| 474 | helpers, hooks and anything else - it is only applied to classes.</p> |
| 475 | <p>You must now follow just one simple rule - class names in Ucfirst and everything else |
| 476 | in lowercase.</p> |
| 477 | </div> |
| 478 | <div class="section" id="step-3-replace-config-mimes-php"> |
| 479 | <h2>Step 3: Replace config/mimes.php<a class="headerlink" href="#step-3-replace-config-mimes-php" title="Permalink to this headline">¶</a></h2> |
| 480 | <p>This config file has been updated to contain more user mime-types, please copy |
| 481 | it to <em>application/config/mimes.php</em>.</p> |
| 482 | </div> |
| 483 | <div class="section" id="step-4-remove-autoload-core-from-your-config-autoload-php"> |
| 484 | <h2>Step 4: Remove $autoload[‘core’] from your config/autoload.php<a class="headerlink" href="#step-4-remove-autoload-core-from-your-config-autoload-php" title="Permalink to this headline">¶</a></h2> |
| 485 | <p>Use of the <code class="docutils literal"><span class="pre">$autoload['core']</span></code> config array has been deprecated as of CodeIgniter 1.4.1 and is now removed. |
| 486 | Move any entries that you might have listed there to <code class="docutils literal"><span class="pre">$autoload['libraries']</span></code> instead.</p> |
| 487 | </div> |
| 488 | <div class="section" id="step-5-move-your-log-class-overrides-or-extensions"> |
| 489 | <h2>Step 5: Move your Log class overrides or extensions<a class="headerlink" href="#step-5-move-your-log-class-overrides-or-extensions" title="Permalink to this headline">¶</a></h2> |
| 490 | <p>The Log Class is considered as a “core” class and is now located in the |
| 491 | <strong>system/core/</strong> directory. Therefore, in order for your Log class overrides |
| 492 | or extensions to work, you need to move them to <strong>application/core/</strong>:</p> |
| 493 | <blockquote> |
| 494 | <div>application/libraries/Log.php -> application/core/Log.php |
| 495 | application/libraries/MY_Log.php -> application/core/MY_Log.php</div></blockquote> |
| 496 | </div> |
| 497 | <div class="section" id="step-6-update-your-session-library-usage"> |
| 498 | <h2>Step 6: Update your Session library usage<a class="headerlink" href="#step-6-update-your-session-library-usage" title="Permalink to this headline">¶</a></h2> |
| 499 | <p>The <a class="reference internal" href="../libraries/sessions.html"><span class="doc">Session Library</span></a> has been completely |
| 500 | re-written in CodeIgniter 3 and now comes with a bunch of new features, |
| 501 | but that also means that there are changes that you should make …</p> |
| 502 | <p>Most notably, the library now uses separate storage drivers instead of |
| 503 | always relying on (encrypted) cookies. |
| 504 | In fact, cookies as storage have now been removed and you must always use |
| 505 | some kind of server-side storage engine, with the file-system being the |
| 506 | default option.</p> |
| 507 | <p>The Session Class now utilizes PHP’s own mechanisms for building custom |
| 508 | session handlers, which also means that your session data is now |
| 509 | accessible via the <code class="docutils literal"><span class="pre">$_SESSION</span></code> superglobal (though, we’ve kept the |
| 510 | possibility to use it as “userdata”, like you’ve done until now).</p> |
| 511 | <p>A few configuration options have been removed and a few have been added. |
| 512 | You should really read the whole <a class="reference internal" href="../libraries/sessions.html"><span class="doc">Session library manual</span></a> for the details, but here’s a short list of changes |
| 513 | that you should make:</p> |
| 514 | <blockquote> |
| 515 | <div><ul> |
| 516 | <li><p class="first">Set your <code class="docutils literal"><span class="pre">$config['sess_driver']</span></code> value</p> |
| 517 | <p>It will default to ‘files’, unless you’ve previously used |
| 518 | <code class="docutils literal"><span class="pre">$config['sess_use_database']</span></code>, in which case it will be set to |
| 519 | ‘database’.</p> |
| 520 | </li> |
| 521 | <li><p class="first">Set a <code class="docutils literal"><span class="pre">$config['sess_save_path']</span></code> value</p> |
| 522 | <p>For the ‘database’ driver, a fallback to <code class="docutils literal"><span class="pre">$config['sess_table_name']</span></code> |
| 523 | is in place, but otherwise requires you to read the manual for the |
| 524 | specific driver of your choice.</p> |
| 525 | </li> |
| 526 | <li><p class="first">Update your <code class="docutils literal"><span class="pre">ci_sessions</span></code> table (‘database’ driver only)</p> |
| 527 | <p>The table structure has changed a bit, and more specifically:</p> |
| 528 | <blockquote> |
| 529 | <div><ul class="simple"> |
| 530 | <li><code class="docutils literal"><span class="pre">session_id</span></code> field is renamed to <code class="docutils literal"><span class="pre">id</span></code></li> |
| 531 | <li><code class="docutils literal"><span class="pre">user_agent</span></code> field is dropped</li> |
| 532 | <li><code class="docutils literal"><span class="pre">user_data</span></code> field is renamed to <code class="docutils literal"><span class="pre">data</span></code> and under MySQL is now of type BLOB</li> |
| 533 | <li><code class="docutils literal"><span class="pre">last_activity</span></code> field is renamed to <code class="docutils literal"><span class="pre">timestamp</span></code></li> |
| 534 | </ul> |
| 535 | </div></blockquote> |
| 536 | <p>This is accompanied by a slight change in the table indexes too, so |
| 537 | please read the manual about the <a class="reference external" href="../libraries/sessions.html#database-driver">Session Database Driver</a> for more information.</p> |
| 538 | <div class="admonition important"> |
| 539 | <p class="first admonition-title">Important</p> |
| 540 | <p class="last">Only MySQL and PostgreSQL are officially supported |
| 541 | now. Other databases may still work, but due to lack of advisory |
| 542 | locking features, they are unsafe for concurrent requests and |
| 543 | you should consider using another driver instead.</p> |
| 544 | </div> |
| 545 | </li> |
| 546 | <li><p class="first">Remove <code class="docutils literal"><span class="pre">$config['sess_match_useragent']</span></code></p> |
| 547 | <p>The user-agent string is input supplied by the user’s browser, or in |
| 548 | other words: client side input. As such, it is an ineffective feature |
| 549 | and hence why it has been removed.</p> |
| 550 | </li> |
| 551 | <li><p class="first">Remove <code class="docutils literal"><span class="pre">$config['sess_encrypt_cookie']</span></code></p> |
| 552 | <p>As already noted, the library no longer uses cookies as a storage |
| 553 | mechanism, which renders this option useless.</p> |
| 554 | </li> |
| 555 | <li><p class="first">Remove <code class="docutils literal"><span class="pre">$config['sess_expire_on_close']</span></code></p> |
| 556 | <p>This option is still usable, but only for backwards compatibility |
| 557 | purposes and it should be otherwise removed. The same effect is |
| 558 | achieved by setting <code class="docutils literal"><span class="pre">$config['sess_expiration']</span></code> to 0.</p> |
| 559 | </li> |
| 560 | <li><p class="first">Check “flashdata” for collisions with “userdata”</p> |
| 561 | <p>Flashdata is now just regular “userdata”, only marked for deletion on |
| 562 | the next request. In other words: you can’t have both “userdata” and |
| 563 | “flashdata” with the same name, because it’s the same thing.</p> |
| 564 | </li> |
| 565 | <li><p class="first">Check usage of session metadata</p> |
| 566 | <p>Previously, you could access the ‘session_id’, ‘ip_address’, |
| 567 | ‘user_agent’ and ‘last_activity’ metadata items as userdata. |
| 568 | This is no longer possible, and you should read the notes about |
| 569 | <a class="reference external" href="../libraries/sessions.html#accessing-session-metadata">Session Metadata</a> |
| 570 | if your application relies on those values.</p> |
| 571 | </li> |
| 572 | <li><p class="first">Check <code class="docutils literal"><span class="pre">unset_userdata()</span></code> usage</p> |
| 573 | <p>Previously, this method used to accept an associative array of |
| 574 | <code class="docutils literal"><span class="pre">'key'</span> <span class="pre">=></span> <span class="pre">'dummy</span> <span class="pre">value'</span></code> pairs for unsetting multiple keys. That |
| 575 | however makes no sense and you now have to pass <em>only</em> the keys, as |
| 576 | the elements of an array.</p> |
| 577 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Old</span> |
| 578 | <span class="nv">$this</span><span class="o">-></span><span class="na">session</span><span class="o">-></span><span class="na">unset_userdata</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">'item'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> <span class="s1">'item2'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">));</span> |
| 579 | |
| 580 | <span class="c1">// New</span> |
| 581 | <span class="nv">$this</span><span class="o">-></span><span class="na">session</span><span class="o">-></span><span class="na">unset_userdata</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">'item'</span><span class="p">,</span> <span class="s1">'item2'</span><span class="p">));</span> |
| 582 | </pre></div> |
| 583 | </div> |
| 584 | </li> |
| 585 | </ul> |
| 586 | </div></blockquote> |
| 587 | <p>Finally, if you have written a Session extension, you must now move it to |
| 588 | the <em>application/libraries/Session/</em> directory, although chances are that |
| 589 | it will now also have to be re-factored.</p> |
| 590 | </div> |
| 591 | <div class="section" id="step-7-update-your-config-database-php"> |
| 592 | <h2>Step 7: Update your config/database.php<a class="headerlink" href="#step-7-update-your-config-database-php" title="Permalink to this headline">¶</a></h2> |
| 593 | <p>Due to 3.0.0’s renaming of Active Record to Query Builder, inside your |
| 594 | <strong>config/database.php</strong>, you will need to rename the <code class="docutils literal"><span class="pre">$active_record</span></code> |
| 595 | variable to <code class="docutils literal"><span class="pre">$query_builder</span></code>:</p> |
| 596 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$active_group</span> <span class="o">=</span> <span class="s1">'default'</span><span class="p">;</span> |
| 597 | <span class="c1">// $active_record = TRUE;</span> |
| 598 | <span class="nv">$query_builder</span> <span class="o">=</span> <span class="k">TRUE</span><span class="p">;</span> |
| 599 | </pre></div> |
| 600 | </div> |
| 601 | </div> |
| 602 | <div class="section" id="step-8-replace-your-error-templates"> |
| 603 | <h2>Step 8: Replace your error templates<a class="headerlink" href="#step-8-replace-your-error-templates" title="Permalink to this headline">¶</a></h2> |
| 604 | <p>In CodeIgniter 3.0, the error templates are now considered as views and have been moved to the |
| 605 | <em>application/views/errors</em> directory.</p> |
| 606 | <p>Furthermore, we’ve added support for CLI error templates in plain-text format that unlike HTML, |
| 607 | is suitable for the command line. This of course requires another level of separation.</p> |
| 608 | <p>It is safe to move your old templates from <em>application/errors</em> to <em>application/views/errors/html</em>, |
| 609 | but you’ll have to copy the new <em>application/views/errors/cli</em> directory from the CodeIgniter archive.</p> |
| 610 | </div> |
| 611 | <div class="section" id="step-9-update-your-config-routes-php-file"> |
| 612 | <h2>Step 9: Update your config/routes.php file<a class="headerlink" href="#step-9-update-your-config-routes-php-file" title="Permalink to this headline">¶</a></h2> |
| 613 | <div class="section" id="routes-containing-any"> |
| 614 | <h3>Routes containing :any<a class="headerlink" href="#routes-containing-any" title="Permalink to this headline">¶</a></h3> |
| 615 | <p>Historically, CodeIgniter has always provided the <strong>:any</strong> wildcard in |
| 616 | routing, with the intention of providing a way to match any character |
| 617 | <strong>within</strong> an URI segment.</p> |
| 618 | <p>However, the <strong>:any</strong> wildcard is actually just an alias for a regular |
| 619 | expression and used to be executed in that manner as <strong>.+</strong>. This is |
| 620 | considered a bug, as it also matches the / (forward slash) character, which |
| 621 | is the URI segment delimiter and that was never the intention.</p> |
| 622 | <p>In CodeIgniter 3, the <strong>:any</strong> wildcard will now represent <strong>[^/]+</strong>, so |
| 623 | that it will not match a forward slash.</p> |
| 624 | <p>There are certainly many developers that have utilized this bug as an actual |
| 625 | feature. If you’re one of them and want to match a forward slash, please use |
| 626 | the <strong>.+</strong> regular expression:</p> |
| 627 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="p">(</span><span class="o">.+</span><span class="p">)</span> <span class="c1">// matches ANYTHING</span> |
| 628 | <span class="p">(</span><span class="o">:</span><span class="nx">any</span><span class="p">)</span> <span class="c1">// matches any character, except for '/'</span> |
| 629 | </pre></div> |
| 630 | </div> |
| 631 | </div> |
| 632 | <div class="section" id="directories-and-default-controller-404-override"> |
| 633 | <h3>Directories and ‘default_controller’, ‘404_override’<a class="headerlink" href="#directories-and-default-controller-404-override" title="Permalink to this headline">¶</a></h3> |
| 634 | <p>As you should know, the <code class="docutils literal"><span class="pre">$route['default_controller']</span></code> and |
| 635 | <code class="docutils literal"><span class="pre">$route['404_override']</span></code> settings accept not only a controller name, but |
| 636 | also <em>controller/method</em> pairs. However, a bug in the routing logic has |
| 637 | made it possible for some users to use that as <em>directory/controller</em> |
| 638 | instead.</p> |
| 639 | <p>As already said, this behavior was incidental and was never intended, nor |
| 640 | documented. If you’ve relied on it, your application will break with |
| 641 | CodeIgniter 3.0.</p> |
| 642 | <p>Another notable change in version 3 is that ‘default_controller’ and |
| 643 | ‘404_override’ are now applied <em>per directory</em>. To explain what this means, |
| 644 | let’s take the following example:</p> |
| 645 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$route</span><span class="p">[</span><span class="s1">'default_controller'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'main'</span><span class="p">;</span> |
| 646 | </pre></div> |
| 647 | </div> |
| 648 | <p>Now, assuming that your website is located at <em>example.com</em>, you already |
| 649 | know that if a user visits <code class="docutils literal"><span class="pre">http://example.com/</span></code>, the above setting will |
| 650 | cause your ‘Main’ controller to be loaded.</p> |
| 651 | <p>However, what happens if you have an <em>application/controllers/admin/</em> |
| 652 | directory and the user visits <code class="docutils literal"><span class="pre">http://example.com/admin/</span></code>? |
| 653 | In CodeIgniter 3, the router will look for a ‘Main’ controller under the |
| 654 | admin/ directory as well. If not found, a Not Found (404) will be triggered.</p> |
| 655 | <p>The same rule applies to the ‘404_override’ setting.</p> |
| 656 | </div> |
| 657 | </div> |
| 658 | <div class="section" id="step-10-many-functions-now-return-null-instead-of-false-on-missing-items"> |
| 659 | <h2>Step 10: Many functions now return NULL instead of FALSE on missing items<a class="headerlink" href="#step-10-many-functions-now-return-null-instead-of-false-on-missing-items" title="Permalink to this headline">¶</a></h2> |
| 660 | <p>Many methods and functions now return NULL instead of FALSE when the required items don’t exist:</p> |
| 661 | <blockquote> |
| 662 | <div><ul class="simple"> |
| 663 | <li><a class="reference internal" href="../general/common_functions.html"><span class="doc">Common functions</span></a><ul> |
| 664 | <li>config_item()</li> |
| 665 | </ul> |
| 666 | </li> |
| 667 | <li><a class="reference internal" href="../libraries/config.html"><span class="doc">Config Class</span></a><ul> |
| 668 | <li>config->item()</li> |
| 669 | <li>config->slash_item()</li> |
| 670 | </ul> |
| 671 | </li> |
| 672 | <li><a class="reference internal" href="../libraries/input.html"><span class="doc">Input Class</span></a><ul> |
| 673 | <li>input->get()</li> |
| 674 | <li>input->post()</li> |
| 675 | <li>input->get_post()</li> |
| 676 | <li>input->cookie()</li> |
| 677 | <li>input->server()</li> |
| 678 | <li>input->input_stream()</li> |
| 679 | <li>input->get_request_header()</li> |
| 680 | </ul> |
| 681 | </li> |
| 682 | <li><a class="reference internal" href="../libraries/sessions.html"><span class="doc">Session Class</span></a><ul> |
| 683 | <li>session->userdata()</li> |
| 684 | <li>session->flashdata()</li> |
| 685 | </ul> |
| 686 | </li> |
| 687 | <li><a class="reference internal" href="../libraries/uri.html"><span class="doc">URI Class</span></a><ul> |
| 688 | <li>uri->segment()</li> |
| 689 | <li>uri->rsegment()</li> |
| 690 | </ul> |
| 691 | </li> |
| 692 | <li><a class="reference internal" href="../helpers/array_helper.html"><span class="doc">Array Helper</span></a><ul> |
| 693 | <li>element()</li> |
| 694 | <li>elements()</li> |
| 695 | </ul> |
| 696 | </li> |
| 697 | </ul> |
| 698 | </div></blockquote> |
| 699 | </div> |
| 700 | <div class="section" id="step-11-usage-of-xss-filtering"> |
| 701 | <h2>Step 11: Usage of XSS filtering<a class="headerlink" href="#step-11-usage-of-xss-filtering" title="Permalink to this headline">¶</a></h2> |
| 702 | <p>Many functions in CodeIgniter allow you to use its XSS filtering feature |
| 703 | on demand by passing a boolean parameter. The default value of that |
| 704 | parameter used to be boolean FALSE, but it is now changed to NULL and it |
| 705 | will be dynamically determined by your <code class="docutils literal"><span class="pre">$config['global_xss_filtering']</span></code> |
| 706 | value.</p> |
| 707 | <p>If you used to manually pass a boolean value for the <code class="docutils literal"><span class="pre">$xss_filter</span></code> |
| 708 | parameter or if you’ve always had <code class="docutils literal"><span class="pre">$config['global_xss_filtering']</span></code> set |
| 709 | to FALSE, then this change doesn’t concern you.</p> |
| 710 | <p>Otherwise however, please review your usage of the following functions:</p> |
| 711 | <blockquote> |
| 712 | <div><ul class="simple"> |
| 713 | <li><a class="reference internal" href="../libraries/input.html"><span class="doc">Input Library</span></a><ul> |
| 714 | <li>input->get()</li> |
| 715 | <li>input->post()</li> |
| 716 | <li>input->get_post()</li> |
| 717 | <li>input->cookie()</li> |
| 718 | <li>input->server()</li> |
| 719 | <li>input->input_stream()</li> |
| 720 | </ul> |
| 721 | </li> |
| 722 | <li><a class="reference internal" href="../helpers/cookie_helper.html"><span class="doc">Cookie Helper</span></a> <a class="reference internal" href="../helpers/cookie_helper.html#get_cookie" title="get_cookie"><code class="xref php php-func docutils literal"><span class="pre">get_cookie()</span></code></a></li> |
| 723 | </ul> |
| 724 | </div></blockquote> |
| 725 | <div class="admonition important"> |
| 726 | <p class="first admonition-title">Important</p> |
| 727 | <p class="last">Another related change is that the <code class="docutils literal"><span class="pre">$_GET</span></code>, <code class="docutils literal"><span class="pre">$_POST</span></code>, |
| 728 | <code class="docutils literal"><span class="pre">$_COOKIE</span></code> and <code class="docutils literal"><span class="pre">$_SERVER</span></code> superglobals are no longer |
| 729 | automatically overwritten when global XSS filtering is turned on.</p> |
| 730 | </div> |
| 731 | </div> |
| 732 | <div class="section" id="step-12-check-for-potential-xss-issues-with-uris"> |
| 733 | <h2>Step 12: Check for potential XSS issues with URIs<a class="headerlink" href="#step-12-check-for-potential-xss-issues-with-uris" title="Permalink to this headline">¶</a></h2> |
| 734 | <p>The <a class="reference internal" href="../libraries/uri.html"><span class="doc">URI Library</span></a> used to automatically convert |
| 735 | a certain set of “programmatic characters” to HTML entities when they |
| 736 | are encountered in a URI segment.</p> |
| 737 | <p>This was aimed at providing some automatic XSS protection, in addition |
| 738 | to the <code class="docutils literal"><span class="pre">$config['permitted_uri_chars']</span></code> setting, but has proven to be |
| 739 | problematic and is now removed in CodeIgniter 3.0.</p> |
| 740 | <p>If your application has relied on this feature, you should update it to |
| 741 | filter URI segments through <code class="docutils literal"><span class="pre">$this->security->xss_clean()</span></code> whenever you |
| 742 | output them.</p> |
| 743 | </div> |
| 744 | <div class="section" id="step-13-check-for-usage-of-the-xss-clean-form-validation-rule"> |
| 745 | <h2>Step 13: Check for usage of the ‘xss_clean’ Form validation rule<a class="headerlink" href="#step-13-check-for-usage-of-the-xss-clean-form-validation-rule" title="Permalink to this headline">¶</a></h2> |
| 746 | <p>A largely unknown rule about XSS cleaning is that it should <em>only be |
| 747 | applied to output</em>, as opposed to input data.</p> |
| 748 | <p>We’ve made that mistake ourselves with our automatic and global XSS cleaning |
| 749 | feature (see previous step about XSS above), so now in an effort to discourage that |
| 750 | practice, we’re also removing ‘xss_clean’ from the officially supported |
| 751 | list of <a class="reference internal" href="../libraries/form_validation.html"><span class="doc">form validation</span></a> rules.</p> |
| 752 | <p>Because the <a class="reference internal" href="../libraries/form_validation.html"><span class="doc">Form Validation library</span></a> |
| 753 | generally validates <em>input</em> data, the ‘xss_clean’ rule simply doesn’t |
| 754 | belong in it.</p> |
| 755 | <p>If you really, really need to apply that rule, you should now also load the |
| 756 | <a class="reference internal" href="../helpers/security_helper.html"><span class="doc">Security Helper</span></a>, which contains |
| 757 | <code class="docutils literal"><span class="pre">xss_clean()</span></code> as a regular function and therefore can be also used as |
| 758 | a validation rule.</p> |
| 759 | </div> |
| 760 | <div class="section" id="step-14-update-usage-of-input-class-s-get-post-method"> |
| 761 | <h2>Step 14: Update usage of Input Class’s get_post() method<a class="headerlink" href="#step-14-update-usage-of-input-class-s-get-post-method" title="Permalink to this headline">¶</a></h2> |
| 762 | <p>Previously, the <a class="reference internal" href="../libraries/input.html"><span class="doc">Input Class</span></a> method <code class="docutils literal"><span class="pre">get_post()</span></code> |
| 763 | was searching first in POST data, then in GET data. This method has been |
| 764 | modified so that it searches in GET then in POST, as its name suggests.</p> |
| 765 | <p>A method has been added, <code class="docutils literal"><span class="pre">post_get()</span></code>, which searches in POST then in GET, as |
| 766 | <code class="docutils literal"><span class="pre">get_post()</span></code> was doing before.</p> |
| 767 | </div> |
| 768 | <div class="section" id="step-15-update-usage-of-directory-helper-s-directory-map-function"> |
| 769 | <h2>Step 15: Update usage of Directory Helper’s directory_map() function<a class="headerlink" href="#step-15-update-usage-of-directory-helper-s-directory-map-function" title="Permalink to this headline">¶</a></h2> |
| 770 | <p>In the resulting array, directories now end with a trailing directory |
| 771 | separator (i.e. a slash, usually).</p> |
| 772 | </div> |
| 773 | <div class="section" id="step-16-update-usage-of-database-forge-s-drop-table-method"> |
| 774 | <h2>Step 16: Update usage of Database Forge’s drop_table() method<a class="headerlink" href="#step-16-update-usage-of-database-forge-s-drop-table-method" title="Permalink to this headline">¶</a></h2> |
| 775 | <p>Up until now, <code class="docutils literal"><span class="pre">drop_table()</span></code> added an IF EXISTS clause by default or it didn’t work |
| 776 | at all with some drivers. In CodeIgniter 3.0, the IF EXISTS condition is no longer added |
| 777 | by default and has an optional second parameter that allows that instead and is set to |
| 778 | FALSE by default.</p> |
| 779 | <p>If your application relies on IF EXISTS, you’ll have to change its usage.</p> |
| 780 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Now produces just DROP TABLE `table_name`</span> |
| 781 | <span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">drop_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">);</span> |
| 782 | |
| 783 | <span class="c1">// Produces DROP TABLE IF EXISTS `table_name`</span> |
| 784 | <span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">drop_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> |
| 785 | </pre></div> |
| 786 | </div> |
| 787 | <div class="admonition note"> |
| 788 | <p class="first admonition-title">Note</p> |
| 789 | <p class="last">The given example uses MySQL-specific syntax, but it should work across |
| 790 | all drivers with the exception of ODBC.</p> |
| 791 | </div> |
| 792 | </div> |
| 793 | <div class="section" id="step-17-change-usage-of-email-library-with-multiple-emails"> |
| 794 | <h2>Step 17: Change usage of Email library with multiple emails<a class="headerlink" href="#step-17-change-usage-of-email-library-with-multiple-emails" title="Permalink to this headline">¶</a></h2> |
| 795 | <p>The <a class="reference internal" href="../libraries/email.html"><span class="doc">Email Library</span></a> will automatically clear the |
| 796 | set parameters after successfully sending emails. To override this behaviour, |
| 797 | pass FALSE as the first parameter in the <code class="docutils literal"><span class="pre">send()</span></code> method:</p> |
| 798 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-></span><span class="na">email</span><span class="o">-></span><span class="na">send</span><span class="p">(</span><span class="k">FALSE</span><span class="p">))</span> |
| 799 | <span class="p">{</span> |
| 800 | <span class="c1">// Parameters won't be cleared</span> |
| 801 | <span class="p">}</span> |
| 802 | </pre></div> |
| 803 | </div> |
| 804 | </div> |
| 805 | <div class="section" id="step-18-update-your-form-validation-language-lines"> |
| 806 | <h2>Step 18: Update your Form_validation language lines<a class="headerlink" href="#step-18-update-your-form-validation-language-lines" title="Permalink to this headline">¶</a></h2> |
| 807 | <p>Two improvements have been made to the <a class="reference internal" href="../libraries/form_validation.html"><span class="doc">Form Validation Library</span></a>’s <a class="reference internal" href="../libraries/language.html"><span class="doc">language</span></a> |
| 808 | files and error messages format:</p> |
| 809 | <blockquote> |
| 810 | <div><ul> |
| 811 | <li><p class="first"><a class="reference internal" href="../libraries/language.html"><span class="doc">Language Library</span></a> line keys now must be |
| 812 | prefixed with <strong>form_validation_</strong> in order to avoid collisions:</p> |
| 813 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Old</span> |
| 814 | <span class="nv">$lang</span><span class="p">[</span><span class="s1">'rule'</span><span class="p">]</span> <span class="o">=</span> <span class="o">...</span> |
| 815 | |
| 816 | <span class="c1">// New</span> |
| 817 | <span class="nv">$lang</span><span class="p">[</span><span class="s1">'form_validation_rule'</span><span class="p">]</span> <span class="o">=</span> <span class="o">...</span> |
| 818 | </pre></div> |
| 819 | </div> |
| 820 | </li> |
| 821 | <li><p class="first">The error messages format has been changed to use named parameters, to |
| 822 | allow more flexibility than what <cite>sprintf()</cite> offers:</p> |
| 823 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Old</span> |
| 824 | <span class="s1">'The %s field does not match the %s field.'</span> |
| 825 | |
| 826 | <span class="c1">// New</span> |
| 827 | <span class="s1">'The {field} field does not match the {param} field.'</span> |
| 828 | </pre></div> |
| 829 | </div> |
| 830 | </li> |
| 831 | </ul> |
| 832 | </div></blockquote> |
| 833 | <div class="admonition note"> |
| 834 | <p class="first admonition-title">Note</p> |
| 835 | <p class="last">The old formatting still works, but the non-prefixed line keys |
| 836 | are DEPRECATED and scheduled for removal in CodeIgniter 3.1+. |
| 837 | Therefore you’re encouraged to update its usage sooner rather than |
| 838 | later.</p> |
| 839 | </div> |
| 840 | </div> |
| 841 | <div class="section" id="step-19-make-sure-your-base-url-config-value-is-not-empty"> |
| 842 | <h2>Step 19: Make sure your ‘base_url’ config value is not empty<a class="headerlink" href="#step-19-make-sure-your-base-url-config-value-is-not-empty" title="Permalink to this headline">¶</a></h2> |
| 843 | <p>When <code class="docutils literal"><span class="pre">$config['base_url']</span></code> is not set, CodeIgniter tries to automatically |
| 844 | detect what your website’s base URL is. This is done purely for convenience |
| 845 | when you are starting development of a new application.</p> |
| 846 | <p>Auto-detection is never reliable and also has security implications, which |
| 847 | is why you should <strong>always</strong> have it manually configured!</p> |
| 848 | <p>One of the changes in CodeIgniter 3.0.3 is how this auto-detection works, |
| 849 | and more specifically it now falls back to the server’s IP address instead |
| 850 | of the hostname requested by the client. Therefore, if you’ve ever relied |
| 851 | on auto-detection, it will change how your website works now.</p> |
| 852 | <p>In case you need to allow e.g. multiple domains, or both <a class="reference external" href="http://">http://</a> and |
| 853 | <a class="reference external" href="https://">https://</a> prefixes to be dynamically used depending on the request, |
| 854 | remember that <em>application/config/config.php</em> is still a PHP script, in |
| 855 | which you can create this logic with a few lines of code. For example:</p> |
| 856 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$allowed_domains</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'domain1.tld'</span><span class="p">,</span> <span class="s1">'domain2.tld'</span><span class="p">);</span> |
| 857 | <span class="nv">$default_domain</span> <span class="o">=</span> <span class="s1">'domain1.tld'</span><span class="p">;</span> |
| 858 | |
| 859 | <span class="k">if</span> <span class="p">(</span><span class="nb">in_array</span><span class="p">(</span><span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">'HTTP_HOST'</span><span class="p">],</span> <span class="nv">$allowed_domains</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">))</span> |
| 860 | <span class="p">{</span> |
| 861 | <span class="nv">$domain</span> <span class="o">=</span> <span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">'HTTP_HOST'</span><span class="p">];</span> |
| 862 | <span class="p">}</span> |
| 863 | <span class="k">else</span> |
| 864 | <span class="p">{</span> |
| 865 | <span class="nv">$domain</span> <span class="o">=</span> <span class="nv">$default_domain</span><span class="p">;</span> |
| 866 | <span class="p">}</span> |
| 867 | |
| 868 | <span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="k">empty</span><span class="p">(</span><span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">'HTTPS'</span><span class="p">]))</span> |
| 869 | <span class="p">{</span> |
| 870 | <span class="nv">$config</span><span class="p">[</span><span class="s1">'base_url'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'https://'</span><span class="o">.</span><span class="nv">$domain</span><span class="p">;</span> |
| 871 | <span class="p">}</span> |
| 872 | <span class="k">else</span> |
| 873 | <span class="p">{</span> |
| 874 | <span class="nv">$config</span><span class="p">[</span><span class="s1">'base_url'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'http://'</span><span class="o">.</span><span class="nv">$domain</span><span class="p">;</span> |
| 875 | <span class="p">}</span> |
| 876 | </pre></div> |
| 877 | </div> |
| 878 | </div> |
| 879 | <div class="section" id="step-20-remove-usage-of-previously-deprecated-functionalities"> |
| 880 | <h2>Step 20: Remove usage of (previously) deprecated functionalities<a class="headerlink" href="#step-20-remove-usage-of-previously-deprecated-functionalities" title="Permalink to this headline">¶</a></h2> |
| 881 | <p>In addition to the <code class="docutils literal"><span class="pre">$autoload['core']</span></code> configuration setting, there’s a |
| 882 | number of other functionalities that have been removed in CodeIgniter 3.0.0:</p> |
| 883 | <div class="section" id="the-sha1-library"> |
| 884 | <h3>The SHA1 library<a class="headerlink" href="#the-sha1-library" title="Permalink to this headline">¶</a></h3> |
| 885 | <p>The previously deprecated SHA1 library has been removed, alter your code to use PHP’s native |
| 886 | <code class="docutils literal"><span class="pre">sha1()</span></code> function to generate a SHA1 hash.</p> |
| 887 | <p>Additionally, the <code class="docutils literal"><span class="pre">sha1()</span></code> method in the <a class="reference internal" href="../libraries/encrypt.html"><span class="doc">Encrypt Library</span></a> has been removed.</p> |
| 888 | </div> |
| 889 | <div class="section" id="the-ext-constant"> |
| 890 | <h3>The EXT constant<a class="headerlink" href="#the-ext-constant" title="Permalink to this headline">¶</a></h3> |
| 891 | <p>Usage of the <code class="docutils literal"><span class="pre">EXT</span></code> constant has been deprecated since dropping support for PHP 4. There’s no |
| 892 | longer a need to maintain different filename extensions and in this new CodeIgniter version, |
| 893 | the <code class="docutils literal"><span class="pre">EXT</span></code> constant has been removed. Use just ‘.php’ instead.</p> |
| 894 | </div> |
| 895 | <div class="section" id="smiley-helper"> |
| 896 | <h3>Smiley helper<a class="headerlink" href="#smiley-helper" title="Permalink to this headline">¶</a></h3> |
| 897 | <p>The <a class="reference internal" href="../helpers/smiley_helper.html"><span class="doc">Smiley Helper</span></a> is a legacy feature from EllisLab’s |
| 898 | ExpressionEngine product. However, it is too specific for a general purpose framework like |
| 899 | CodeIgniter and as such it is now deprecated.</p> |
| 900 | <p>Also, the previously deprecated <code class="docutils literal"><span class="pre">js_insert_smiley()</span></code> (since version 1.7.2) is now removed.</p> |
| 901 | </div> |
| 902 | <div class="section" id="the-encrypt-library"> |
| 903 | <h3>The Encrypt library<a class="headerlink" href="#the-encrypt-library" title="Permalink to this headline">¶</a></h3> |
| 904 | <p>Following numerous vulnerability reports, the <a class="reference internal" href="../libraries/encrypt.html"><span class="doc">Encrypt Library</span></a> has |
| 905 | been deprecated and a new, <a class="reference internal" href="../libraries/encryption.html"><span class="doc">Encryption Library</span></a> is added to take |
| 906 | its place.</p> |
| 907 | <p>The new library requires either the <a class="reference external" href="http://php.net/mcrypt">MCrypt extension</a> (and /dev/urandom |
| 908 | availability) or PHP 5.3.3 and the <a class="reference external" href="http://php.net/openssl">OpenSSL extension</a>. |
| 909 | While this might be rather inconvenient, it is a requirement that allows us to have properly |
| 910 | implemented cryptographic functions.</p> |
| 911 | <div class="admonition note"> |
| 912 | <p class="first admonition-title">Note</p> |
| 913 | <p class="last">The <a class="reference internal" href="../libraries/encrypt.html"><span class="doc">Encrypt Library</span></a> is still available for the purpose |
| 914 | of keeping backwards compatibility.</p> |
| 915 | </div> |
| 916 | <div class="admonition important"> |
| 917 | <p class="first admonition-title">Important</p> |
| 918 | <p class="last">You are strongly encouraged to switch to the new <a class="reference internal" href="../libraries/encryption.html"><span class="doc">Encryption Library</span></a> as soon as possible!</p> |
| 919 | </div> |
| 920 | </div> |
| 921 | <div class="section" id="the-cart-library"> |
| 922 | <h3>The Cart library<a class="headerlink" href="#the-cart-library" title="Permalink to this headline">¶</a></h3> |
| 923 | <p>The <a class="reference internal" href="../libraries/cart.html"><span class="doc">Cart Library</span></a>, similarly to the <a class="reference internal" href="../helpers/smiley_helper.html"><span class="doc">Smiley Helper</span></a> is too specific for CodeIgniter. It is now deprecated |
| 924 | and scheduled for removal in CodeIgniter 3.1+.</p> |
| 925 | <div class="admonition note"> |
| 926 | <p class="first admonition-title">Note</p> |
| 927 | <p class="last">The library is still available, but you’re strongly encouraged to remove its usage sooner |
| 928 | rather than later.</p> |
| 929 | </div> |
| 930 | </div> |
| 931 | <div class="section" id="database-drivers-mysql-sqlite-mssql-pdo-dblib"> |
| 932 | <h3>Database drivers ‘mysql’, ‘sqlite’, ‘mssql’, ‘pdo/dblib’<a class="headerlink" href="#database-drivers-mysql-sqlite-mssql-pdo-dblib" title="Permalink to this headline">¶</a></h3> |
| 933 | <p>The <strong>mysql</strong> driver utilizes the old ‘mysql’ PHP extension, known for its aging code base and |
| 934 | many low-level problems. The extension is deprecated as of PHP 5.5 and CodeIgniter deprecates |
| 935 | it in version 3.0, switching the default configured MySQL driver to <strong>mysqli</strong>.</p> |
| 936 | <p>Please use either the ‘mysqli’ or ‘pdo/mysql’ drivers for MySQL. The old ‘mysql’ driver will be |
| 937 | removed at some point in the future.</p> |
| 938 | <p>The <strong>sqlite</strong>, <strong>mssql</strong> and <strong>pdo/dblib</strong> (also known as pdo/mssql or pdo/sybase) drivers |
| 939 | all depend on PHP extensions that for different reasons no longer exist since PHP 5.3.</p> |
| 940 | <p>Therefore we are now deprecating these drivers as we will have to remove them in one of the next |
| 941 | CodeIgniter versions. You should use the more advanced, <strong>sqlite3</strong>, <strong>sqlsrv</strong> or <strong>pdo/sqlsrv</strong> |
| 942 | drivers respectively.</p> |
| 943 | <div class="admonition note"> |
| 944 | <p class="first admonition-title">Note</p> |
| 945 | <p class="last">These drivers are still available, but you’re strongly encouraged to switch to other ones |
| 946 | sooner rather than later.</p> |
| 947 | </div> |
| 948 | </div> |
| 949 | <div class="section" id="security-helper-do-hash"> |
| 950 | <h3>Security helper do_hash()<a class="headerlink" href="#security-helper-do-hash" title="Permalink to this headline">¶</a></h3> |
| 951 | <p><a class="reference internal" href="../helpers/security_helper.html"><span class="doc">Security Helper</span></a> function <code class="docutils literal"><span class="pre">do_hash()</span></code> is now just an alias for |
| 952 | PHP’s native <code class="docutils literal"><span class="pre">hash()</span></code> function. It is deprecated and scheduled for removal in CodeIgniter 3.1+.</p> |
| 953 | <div class="admonition note"> |
| 954 | <p class="first admonition-title">Note</p> |
| 955 | <p class="last">This function is still available, but you’re strongly encouraged to remove its usage sooner |
| 956 | rather than later.</p> |
| 957 | </div> |
| 958 | </div> |
| 959 | <div class="section" id="the-config-global-xss-filtering-setting"> |
| 960 | <h3>The $config[‘global_xss_filtering’] setting<a class="headerlink" href="#the-config-global-xss-filtering-setting" title="Permalink to this headline">¶</a></h3> |
| 961 | <p>As already explained above, XSS filtering should not be done on input data, |
| 962 | but on output instead. Therefore, the <code class="docutils literal"><span class="pre">$config['global_xss_filtering']</span></code>, |
| 963 | which automatically filters <em>input</em> data, is considered a bad practice and |
| 964 | is now deprecated.</p> |
| 965 | <p>Instead, you should manually escape any user-provided data via the |
| 966 | <a class="reference internal" href="../helpers/security_helper.html#xss_clean" title="xss_clean"><code class="xref php php-func docutils literal"><span class="pre">xss_clean()</span></code></a> function when you need to output it, or use a |
| 967 | library like <a class="reference external" href="http://htmlpurifier.org/">HTML Purifier</a> that does that |
| 968 | for you.</p> |
| 969 | <div class="admonition note"> |
| 970 | <p class="first admonition-title">Note</p> |
| 971 | <p class="last">The setting is still available, but you’re strongly encouraged to |
| 972 | remove its usage sooner rather than later.</p> |
| 973 | </div> |
| 974 | </div> |
| 975 | <div class="section" id="file-helper-read-file"> |
| 976 | <h3>File helper read_file()<a class="headerlink" href="#file-helper-read-file" title="Permalink to this headline">¶</a></h3> |
| 977 | <p><a class="reference internal" href="../helpers/file_helper.html"><span class="doc">File Helper</span></a> function <code class="docutils literal"><span class="pre">read_file()</span></code> is now just an alias for |
| 978 | PHP’s native <code class="docutils literal"><span class="pre">file_get_contents()</span></code> function. It is deprecated and scheduled for removal in |
| 979 | CodeIgniter 3.1+.</p> |
| 980 | <div class="admonition note"> |
| 981 | <p class="first admonition-title">Note</p> |
| 982 | <p class="last">This function is still available, but you’re strongly encouraged to remove its usage sooner |
| 983 | rather than later.</p> |
| 984 | </div> |
| 985 | </div> |
| 986 | <div class="section" id="string-helper-repeater"> |
| 987 | <h3>String helper repeater()<a class="headerlink" href="#string-helper-repeater" title="Permalink to this headline">¶</a></h3> |
| 988 | <p><a class="reference internal" href="../helpers/string_helper.html"><span class="doc">String Helper</span></a> function <a class="reference internal" href="../helpers/string_helper.html#repeater" title="repeater"><code class="xref php php-func docutils literal"><span class="pre">repeater()</span></code></a> is now just an alias for |
| 989 | PHP’s native <code class="docutils literal"><span class="pre">str_repeat()</span></code> function. It is deprecated and scheduled for removal in CodeIgniter 3.1+.</p> |
| 990 | <div class="admonition note"> |
| 991 | <p class="first admonition-title">Note</p> |
| 992 | <p class="last">This function is still available, but you’re strongly encouraged to remove its usage sooner |
| 993 | rather than later.</p> |
| 994 | </div> |
| 995 | </div> |
| 996 | <div class="section" id="string-helper-trim-slashes"> |
| 997 | <h3>String helper trim_slashes()<a class="headerlink" href="#string-helper-trim-slashes" title="Permalink to this headline">¶</a></h3> |
| 998 | <p><a class="reference internal" href="../helpers/string_helper.html"><span class="doc">String Helper</span></a> function <a class="reference internal" href="../helpers/string_helper.html#trim_slashes" title="trim_slashes"><code class="xref php php-func docutils literal"><span class="pre">trim_slashes()</span></code></a> is now just an alias |
| 999 | for PHP’s native <code class="docutils literal"><span class="pre">trim()</span></code> function (with a slash passed as its second argument). It is deprecated and |
| 1000 | scheduled for removal in CodeIgniter 3.1+.</p> |
| 1001 | <div class="admonition note"> |
| 1002 | <p class="first admonition-title">Note</p> |
| 1003 | <p class="last">This function is still available, but you’re strongly encouraged to remove its usage sooner |
| 1004 | rather than later.</p> |
| 1005 | </div> |
| 1006 | </div> |
| 1007 | <div class="section" id="form-helper-form-prep"> |
| 1008 | <h3>Form helper form_prep()<a class="headerlink" href="#form-helper-form-prep" title="Permalink to this headline">¶</a></h3> |
| 1009 | <p><a class="reference internal" href="../helpers/form_helper.html"><span class="doc">Form Helper</span></a> function <a class="reference internal" href="../helpers/form_helper.html#form_prep" title="form_prep"><code class="xref php php-func docutils literal"><span class="pre">form_prep()</span></code></a> |
| 1010 | is now just an alias for <a class="reference internal" href="../general/common_functions.html"><span class="doc">common function</span></a> |
| 1011 | <code class="xref py py-func docutils literal"><span class="pre">html_escape()</span></code>. It is deprecated and will be removed in the future.</p> |
| 1012 | <p>Please use <a class="reference internal" href="../general/common_functions.html#html_escape" title="html_escape"><code class="xref php php-func docutils literal"><span class="pre">html_escape()</span></code></a> instead.</p> |
| 1013 | <div class="admonition note"> |
| 1014 | <p class="first admonition-title">Note</p> |
| 1015 | <p class="last">This function is still available, but you’re strongly encouraged |
| 1016 | to remove its usage sooner rather than later.</p> |
| 1017 | </div> |
| 1018 | </div> |
| 1019 | <div class="section" id="email-helper-functions"> |
| 1020 | <h3>Email helper functions<a class="headerlink" href="#email-helper-functions" title="Permalink to this headline">¶</a></h3> |
| 1021 | <p><a class="reference internal" href="../helpers/email_helper.html"><span class="doc">Email Helper</span></a> only has two functions</p> |
| 1022 | <blockquote> |
| 1023 | <div><ul class="simple"> |
| 1024 | <li><a class="reference internal" href="../helpers/email_helper.html#valid_email" title="valid_email"><code class="xref php php-func docutils literal"><span class="pre">valid_email()</span></code></a></li> |
| 1025 | <li><a class="reference internal" href="../helpers/email_helper.html#send_email" title="send_email"><code class="xref php php-func docutils literal"><span class="pre">send_email()</span></code></a></li> |
| 1026 | </ul> |
| 1027 | </div></blockquote> |
| 1028 | <p>Both of them are now aliases for PHP’s native <code class="docutils literal"><span class="pre">filter_var()</span></code> and <code class="docutils literal"><span class="pre">mail()</span></code> functions, respectively. |
| 1029 | Therefore the <a class="reference internal" href="../helpers/email_helper.html"><span class="doc">Email Helper</span></a> altogether is being deprecated and |
| 1030 | is scheduled for removal in CodeIgniter 3.1+.</p> |
| 1031 | <div class="admonition note"> |
| 1032 | <p class="first admonition-title">Note</p> |
| 1033 | <p class="last">These functions are still available, but you’re strongly encouraged to remove their usage |
| 1034 | sooner rather than later.</p> |
| 1035 | </div> |
| 1036 | </div> |
| 1037 | <div class="section" id="date-helper-standard-date"> |
| 1038 | <h3>Date helper standard_date()<a class="headerlink" href="#date-helper-standard-date" title="Permalink to this headline">¶</a></h3> |
| 1039 | <p><a class="reference internal" href="../helpers/date_helper.html"><span class="doc">Date Helper</span></a> function <code class="docutils literal"><span class="pre">standard_date()</span></code> is being deprecated due |
| 1040 | to the availability of native PHP <a class="reference external" href="http://php.net/manual/en/class.datetime.php#datetime.constants.types">constants</a>, |
| 1041 | which when combined with <code class="docutils literal"><span class="pre">date()</span></code> provide the same functionality. Furthermore, they have the |
| 1042 | exact same names as the ones supported by <code class="docutils literal"><span class="pre">standard_date()</span></code>. Here are examples of how to replace |
| 1043 | its usage:</p> |
| 1044 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Old way</span> |
| 1045 | <span class="nx">standard_date</span><span class="p">();</span> <span class="c1">// defaults to standard_date('DATE_RFC822', now());</span> |
| 1046 | |
| 1047 | <span class="c1">// Replacement</span> |
| 1048 | <span class="nb">date</span><span class="p">(</span><span class="nx">DATE_RFC822</span><span class="p">,</span> <span class="nx">now</span><span class="p">());</span> |
| 1049 | |
| 1050 | <span class="c1">// Old way</span> |
| 1051 | <span class="nx">standard_date</span><span class="p">(</span><span class="s1">'DATE_ATOM'</span><span class="p">,</span> <span class="nv">$time</span><span class="p">);</span> |
| 1052 | |
| 1053 | <span class="c1">// Replacement</span> |
| 1054 | <span class="nb">date</span><span class="p">(</span><span class="nx">DATE_ATOM</span><span class="p">,</span> <span class="nv">$time</span><span class="p">);</span> |
| 1055 | </pre></div> |
| 1056 | </div> |
| 1057 | <div class="admonition note"> |
| 1058 | <p class="first admonition-title">Note</p> |
| 1059 | <p class="last">This function is still available, but you’re strongly encouraged to remove its usage sooner |
| 1060 | rather than later as it is scheduled for removal in CodeIgniter 3.1+.</p> |
| 1061 | </div> |
| 1062 | </div> |
| 1063 | <div class="section" id="html-helpers-nbs-br"> |
| 1064 | <h3>HTML helpers nbs(), br()<a class="headerlink" href="#html-helpers-nbs-br" title="Permalink to this headline">¶</a></h3> |
| 1065 | <p><a class="reference internal" href="../helpers/html_helper.html"><span class="doc">HTML Helper</span></a> functions <code class="docutils literal"><span class="pre">nbs()</span></code> and <code class="docutils literal"><span class="pre">br()</span></code> are just aliases |
| 1066 | for the native <code class="docutils literal"><span class="pre">str_repeat()</span></code> function used with <code class="docutils literal"><span class="pre">&nbsp;</span></code> and <code class="docutils literal"><span class="pre"><br</span> <span class="pre">></span></code> respectively.</p> |
| 1067 | <p>Because there’s no point in just aliasing native PHP functions, they are now deprecated and |
| 1068 | scheduled for removal in CodeIgniter 3.1+.</p> |
| 1069 | <div class="admonition note"> |
| 1070 | <p class="first admonition-title">Note</p> |
| 1071 | <p class="last">These functions are still available, but you’re strongly encouraged to remove their usage |
| 1072 | sooner rather than later.</p> |
| 1073 | </div> |
| 1074 | </div> |
| 1075 | <div class="section" id="pagination-library-anchor-class-setting"> |
| 1076 | <h3>Pagination library ‘anchor_class’ setting<a class="headerlink" href="#pagination-library-anchor-class-setting" title="Permalink to this headline">¶</a></h3> |
| 1077 | <p>The <a class="reference internal" href="../libraries/pagination.html"><span class="doc">Pagination Library</span></a> now supports adding pretty much any HTML |
| 1078 | attribute to your anchors via the ‘attributes’ configuration setting. This includes passing the |
| 1079 | ‘class’ attribute and using the separate ‘anchor_class’ setting no longer makes sense. |
| 1080 | As a result of that, the ‘anchor_class’ setting is now deprecated and scheduled for removal in |
| 1081 | CodeIgniter 3.1+.</p> |
| 1082 | <div class="admonition note"> |
| 1083 | <p class="first admonition-title">Note</p> |
| 1084 | <p class="last">This setting is still available, but you’re strongly encouraged to remove its usage sooner |
| 1085 | rather than later.</p> |
| 1086 | </div> |
| 1087 | </div> |
| 1088 | <div class="section" id="string-helper-random-string-types-unique-and-encrypt"> |
| 1089 | <h3>String helper random_string() types ‘unique’ and ‘encrypt’<a class="headerlink" href="#string-helper-random-string-types-unique-and-encrypt" title="Permalink to this headline">¶</a></h3> |
| 1090 | <p>When using the <a class="reference internal" href="../helpers/string_helper.html"><span class="doc">String Helper</span></a> function <a class="reference internal" href="../helpers/string_helper.html#random_string" title="random_string"><code class="xref php php-func docutils literal"><span class="pre">random_string()</span></code></a>, |
| 1091 | you should no longer pass the <strong>unique</strong> and <strong>encrypt</strong> randomization types. They are only |
| 1092 | aliases for <strong>md5</strong> and <strong>sha1</strong> respectively and are now deprecated and scheduled for removal |
| 1093 | in CodeIgniter 3.1+.</p> |
| 1094 | <div class="admonition note"> |
| 1095 | <p class="first admonition-title">Note</p> |
| 1096 | <p class="last">These options are still available, but you’re strongly encouraged to remove their usage |
| 1097 | sooner rather than later.</p> |
| 1098 | </div> |
| 1099 | </div> |
| 1100 | <div class="section" id="url-helper-url-title-separators-dash-and-underscore"> |
| 1101 | <h3>URL helper url_title() separators ‘dash’ and ‘underscore’<a class="headerlink" href="#url-helper-url-title-separators-dash-and-underscore" title="Permalink to this headline">¶</a></h3> |
| 1102 | <p>When using the <a class="reference internal" href="../helpers/url_helper.html"><span class="doc">URL Helper</span></a> function <a class="reference internal" href="../helpers/url_helper.html#url_title" title="url_title"><code class="xref php php-func docutils literal"><span class="pre">url_title()</span></code></a>, you |
| 1103 | should no longer pass <strong>dash</strong> or <strong>underscore</strong> as the word separator. This function will |
| 1104 | now accept any character and you should just pass the chosen character directly, so you |
| 1105 | should write ‘-‘ instead of ‘dash’ and ‘_’ instead of ‘underscore’.</p> |
| 1106 | <p><strong>dash</strong> and <strong>underscore</strong> now act as aliases and are deprecated and scheduled for removal |
| 1107 | in CodeIgniter 3.1+.</p> |
| 1108 | <div class="admonition note"> |
| 1109 | <p class="first admonition-title">Note</p> |
| 1110 | <p class="last">These options are still available, but you’re strongly encouraged to remove their usage |
| 1111 | sooner rather than later.</p> |
| 1112 | </div> |
| 1113 | </div> |
| 1114 | <div class="section" id="session-library-method-all-userdata"> |
| 1115 | <h3>Session Library method all_userdata()<a class="headerlink" href="#session-library-method-all-userdata" title="Permalink to this headline">¶</a></h3> |
| 1116 | <p>As seen in the <a class="reference internal" href="../changelog.html"><span class="doc">Change Log</span></a>, <a class="reference internal" href="../libraries/sessions.html"><span class="doc">Session Library</span></a> |
| 1117 | method <code class="docutils literal"><span class="pre">userdata()</span></code> now allows you to fetch all userdata by simply omitting its parameter:</p> |
| 1118 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">session</span><span class="o">-></span><span class="na">userdata</span><span class="p">();</span> |
| 1119 | </pre></div> |
| 1120 | </div> |
| 1121 | <p>This makes the <code class="docutils literal"><span class="pre">all_userdata()</span></code> method redudant and therefore it is now just an alias for |
| 1122 | <code class="docutils literal"><span class="pre">userdata()</span></code> with the above shown usage and is being deprecated and scheduled for removal |
| 1123 | in CodeIgniter 3.1+.</p> |
| 1124 | <div class="admonition note"> |
| 1125 | <p class="first admonition-title">Note</p> |
| 1126 | <p class="last">This method is still available, but you’re strongly encouraged to remove its usage |
| 1127 | sooner rather than later.</p> |
| 1128 | </div> |
| 1129 | </div> |
| 1130 | <div class="section" id="database-forge-method-add-column-with-an-after-clause"> |
| 1131 | <h3>Database Forge method add_column() with an AFTER clause<a class="headerlink" href="#database-forge-method-add-column-with-an-after-clause" title="Permalink to this headline">¶</a></h3> |
| 1132 | <p>If you have used the <strong>third parameter</strong> for <a class="reference internal" href="../database/forge.html"><span class="doc">Database Forge</span></a> method |
| 1133 | <code class="docutils literal"><span class="pre">add_column()</span></code> to add a field for an AFTER clause, then you should change its usage.</p> |
| 1134 | <p>That third parameter has been deprecated and scheduled for removal in CodeIgniter 3.1+.</p> |
| 1135 | <p>You should now put AFTER clause field names in the field definition array instead:</p> |
| 1136 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Old usage:</span> |
| 1137 | <span class="nv">$field</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> |
| 1138 | <span class="s1">'new_field'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span><span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'TEXT'</span><span class="p">)</span> |
| 1139 | <span class="p">);</span> |
| 1140 | |
| 1141 | <span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_column</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="nv">$field</span><span class="p">,</span> <span class="s1">'another_field'</span><span class="p">);</span> |
| 1142 | |
| 1143 | <span class="c1">// New usage:</span> |
| 1144 | <span class="nv">$field</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> |
| 1145 | <span class="s1">'new_field'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span><span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'TEXT'</span><span class="p">,</span> <span class="s1">'after'</span> <span class="o">=></span> <span class="s1">'another_field'</span><span class="p">)</span> |
| 1146 | <span class="p">);</span> |
| 1147 | |
| 1148 | <span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_column</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="nv">$field</span><span class="p">);</span> |
| 1149 | </pre></div> |
| 1150 | </div> |
| 1151 | <div class="admonition note"> |
| 1152 | <p class="first admonition-title">Note</p> |
| 1153 | <p class="last">The parameter is still available, but you’re strongly encouraged to remove its usage |
| 1154 | sooner rather than later.</p> |
| 1155 | </div> |
| 1156 | <div class="admonition note"> |
| 1157 | <p class="first admonition-title">Note</p> |
| 1158 | <p class="last">This is for MySQL and CUBRID databases only! Other drivers don’t support this |
| 1159 | clause and will silently ignore it.</p> |
| 1160 | </div> |
| 1161 | </div> |
| 1162 | <div class="section" id="uri-routing-methods-fetch-directory-fetch-class-fetch-method"> |
| 1163 | <h3>URI Routing methods fetch_directory(), fetch_class(), fetch_method()<a class="headerlink" href="#uri-routing-methods-fetch-directory-fetch-class-fetch-method" title="Permalink to this headline">¶</a></h3> |
| 1164 | <p>With properties <code class="docutils literal"><span class="pre">CI_Router::$directory</span></code>, <code class="docutils literal"><span class="pre">CI_Router::$class</span></code> and <code class="docutils literal"><span class="pre">CI_Router::$method</span></code> |
| 1165 | being public and their respective <code class="docutils literal"><span class="pre">fetch_*()</span></code> no longer doing anything else to just return |
| 1166 | the properties - it doesn’t make sense to keep them.</p> |
| 1167 | <p>Those are all internal, undocumented methods, but we’ve opted to deprecate them for now |
| 1168 | in order to maintain backwards-compatibility just in case. If some of you have utilized them, |
| 1169 | then you can now just access the properties instead:</p> |
| 1170 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">router</span><span class="o">-></span><span class="na">directory</span><span class="p">;</span> |
| 1171 | <span class="nv">$this</span><span class="o">-></span><span class="na">router</span><span class="o">-></span><span class="na">class</span><span class="p">;</span> |
| 1172 | <span class="nv">$this</span><span class="o">-></span><span class="na">router</span><span class="o">-></span><span class="na">method</span><span class="p">;</span> |
| 1173 | </pre></div> |
| 1174 | </div> |
| 1175 | <div class="admonition note"> |
| 1176 | <p class="first admonition-title">Note</p> |
| 1177 | <p class="last">Those methods are still available, but you’re strongly encouraged to remove their usage |
| 1178 | sooner rather than later.</p> |
| 1179 | </div> |
| 1180 | </div> |
| 1181 | <div class="section" id="input-library-method-is-cli-request"> |
| 1182 | <h3>Input library method is_cli_request()<a class="headerlink" href="#input-library-method-is-cli-request" title="Permalink to this headline">¶</a></h3> |
| 1183 | <p>Calls to the <code class="docutils literal"><span class="pre">CI_Input::is_cli_request()</span></code> method are necessary at many places |
| 1184 | in the CodeIgniter internals and this is often before the <a class="reference internal" href="../libraries/input.html"><span class="doc">Input Library</span></a> is loaded. Because of that, it is being replaced by a common |
| 1185 | function named <a class="reference internal" href="../general/common_functions.html#is_cli" title="is_cli"><code class="xref php php-func docutils literal"><span class="pre">is_cli()</span></code></a> and this method is now just an alias.</p> |
| 1186 | <p>The new function is both available at all times for you to use and shorter to type.</p> |
| 1187 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Old</span> |
| 1188 | <span class="nv">$this</span><span class="o">-></span><span class="na">input</span><span class="o">-></span><span class="na">is_cli_request</span><span class="p">();</span> |
| 1189 | |
| 1190 | <span class="c1">// New</span> |
| 1191 | <span class="nx">is_cli</span><span class="p">();</span> |
| 1192 | </pre></div> |
| 1193 | </div> |
| 1194 | <p><code class="docutils literal"><span class="pre">CI_Input::is_cli_request()</span></code> is now now deprecated and scheduled for removal in |
| 1195 | CodeIgniter 3.1+.</p> |
| 1196 | <div class="admonition note"> |
| 1197 | <p class="first admonition-title">Note</p> |
| 1198 | <p class="last">This method is still available, but you’re strongly encouraged to remove its usage |
| 1199 | sooner rather than later.</p> |
| 1200 | </div> |
| 1201 | </div> |
| 1202 | <div class="section" id="config-library-method-system-url"> |
| 1203 | <h3>Config library method system_url()<a class="headerlink" href="#config-library-method-system-url" title="Permalink to this headline">¶</a></h3> |
| 1204 | <p>Usage of <code class="docutils literal"><span class="pre">CI_Config::system_url()</span></code> encourages insecure coding practices. |
| 1205 | Namely, your CodeIgniter <em>system/</em> directory shouldn’t be publicly accessible |
| 1206 | from a security point of view.</p> |
| 1207 | <p>Because of this, this method is now deprecated and scheduled for removal in |
| 1208 | CodeIgniter 3.1+.</p> |
| 1209 | <div class="admonition note"> |
| 1210 | <p class="first admonition-title">Note</p> |
| 1211 | <p class="last">This method is still available, but you’re strongly encouraged to remove its usage |
| 1212 | sooner rather than later.</p> |
| 1213 | </div> |
| 1214 | </div> |
| 1215 | <div class="section" id="the-javascript-library"> |
| 1216 | <h3>The Javascript library<a class="headerlink" href="#the-javascript-library" title="Permalink to this headline">¶</a></h3> |
| 1217 | <p>The <a class="reference internal" href="../libraries/javascript.html"><span class="doc">Javascript Library</span></a> has always had an |
| 1218 | ‘experimental’ status and was never really useful, nor a proper solution.</p> |
| 1219 | <p>It is now deprecated and scheduled for removal in CodeIgniter 3.1+.</p> |
| 1220 | <div class="admonition note"> |
| 1221 | <p class="first admonition-title">Note</p> |
| 1222 | <p class="last">This library is still available, but you’re strongly encouraged to remove its usage |
| 1223 | sooner rather than later.</p> |
| 1224 | </div> |
| 1225 | </div> |
| 1226 | <div class="section" id="form-validation-method-prep-for-form"> |
| 1227 | <h3>Form Validation method prep_for_form()<a class="headerlink" href="#form-validation-method-prep-for-form" title="Permalink to this headline">¶</a></h3> |
| 1228 | <p>The <a class="reference internal" href="../libraries/form_validation.html"><span class="doc">Form Validation Library</span></a> has a |
| 1229 | <code class="docutils literal"><span class="pre">prep_for_form()</span></code> method, which is/can also be used as a rule in |
| 1230 | <code class="docutils literal"><span class="pre">set_rules()</span></code> to automatically perform HTML encoding on input data.</p> |
| 1231 | <p>Automatically encoding input (instead of output) data is a bad practice in |
| 1232 | the first place, and CodeIgniter and PHP itself offer other alternatives |
| 1233 | to this method anyway. |
| 1234 | For example, <a class="reference internal" href="../helpers/form_helper.html"><span class="doc">Form Helper</span></a> functions will |
| 1235 | automatically perform HTML escaping when necessary.</p> |
| 1236 | <p>Therefore, the <em>prep_for_form</em> method/rule is pretty much useless and is now |
| 1237 | deprecated and scheduled for removal in 3.1+.</p> |
| 1238 | <div class="admonition note"> |
| 1239 | <p class="first admonition-title">Note</p> |
| 1240 | <p class="last">The method is still available, but you’re strongly encouraged to |
| 1241 | remove its usage sooner rather than later.</p> |
| 1242 | </div> |
| 1243 | </div> |
| 1244 | </div> |
| 1245 | <div class="section" id="step-21-check-your-usage-of-text-helper-highlight-phrase"> |
| 1246 | <h2>Step 21: Check your usage of Text helper highlight_phrase()<a class="headerlink" href="#step-21-check-your-usage-of-text-helper-highlight-phrase" title="Permalink to this headline">¶</a></h2> |
| 1247 | <p>The default HTML tag used by <a class="reference internal" href="../helpers/text_helper.html"><span class="doc">Text Helper</span></a> function |
| 1248 | <code class="xref py py-func docutils literal"><span class="pre">highlight_phrase()</span></code> has been changed from <code class="docutils literal"><span class="pre"><strong></span></code> to the new HTML5 |
| 1249 | tag <code class="docutils literal"><span class="pre"><mark></span></code>.</p> |
| 1250 | <p>Unless you’ve used your own highlighting tags, this might cause trouble |
| 1251 | for your visitors who use older web browsers such as Internet Explorer 8. |
| 1252 | We therefore suggest that you add the following code to your CSS files |
| 1253 | in order to avoid backwards compatibility with old browsers:</p> |
| 1254 | <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">mark</span> <span class="p">{</span> |
| 1255 | <span class="nx">background</span><span class="o">:</span> <span class="c1">#ff0;</span> |
| 1256 | <span class="nx">color</span><span class="o">:</span> <span class="c1">#000;</span> |
| 1257 | <span class="p">};</span> |
| 1258 | </pre></div> |
| 1259 | </div> |
| 1260 | </div> |
| 1261 | </div> |
| 1262 | |
| 1263 | |
| 1264 | </div> |
| 1265 | <footer> |
| 1266 | |
| 1267 | <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| 1268 | |
| 1269 | <a href="upgrade_223.html" class="btn btn-neutral float-right" title="Upgrading from 2.2.2 to 2.2.3">Next <span class="fa fa-arrow-circle-right"></span></a> |
| 1270 | |
| 1271 | |
| 1272 | <a href="upgrade_301.html" class="btn btn-neutral" title="Upgrading from 3.0.0 to 3.0.1"><span class="fa fa-arrow-circle-left"></span> Previous</a> |
| 1273 | |
| 1274 | </div> |
| 1275 | |
| 1276 | |
| 1277 | <hr/> |
| 1278 | |
| 1279 | <div role="contentinfo"> |
| 1280 | <p> |
| 1281 | © Copyright 2014 - 2019, British Columbia Institute of Technology. |
| 1282 | Last updated on Jan 16, 2019. |
| 1283 | </p> |
| 1284 | </div> |
| 1285 | |
| 1286 | Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. |
| 1287 | |
| 1288 | </footer> |
| 1289 | </div> |
| 1290 | </div> |
| 1291 | |
| 1292 | </section> |
| 1293 | |
| 1294 | </div> |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | |
| 1299 | |
| 1300 | <script type="text/javascript"> |
| 1301 | var DOCUMENTATION_OPTIONS = { |
| 1302 | URL_ROOT:'../', |
| 1303 | VERSION:'3.1.10', |
| 1304 | COLLAPSE_INDEX:false, |
| 1305 | FILE_SUFFIX:'.html', |
| 1306 | HAS_SOURCE: false |
| 1307 | }; |
| 1308 | </script> |
| 1309 | <script type="text/javascript" src="../_static/jquery.js"></script> |
| 1310 | <script type="text/javascript" src="../_static/underscore.js"></script> |
| 1311 | <script type="text/javascript" src="../_static/doctools.js"></script> |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | <script type="text/javascript" src="../_static/js/theme.js"></script> |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | <script type="text/javascript"> |
| 1323 | jQuery(function () { |
| 1324 | SphinxRtdTheme.StickyNav.enable(); |
| 1325 | }); |
| 1326 | </script> |
| 1327 | |
| 1328 | |
| 1329 | </body> |
| 1330 | </html> |