From 37110d53e111dd508e61bd9fdd5260ac3a2a293b Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Wed, 2 Jan 2019 19:11:55 -0800 Subject: [PATCH] Update docs - managing apps --- public/index.php | 1 + spark | 1 + user_guide_src/source/concepts/structure.rst | 6 +- .../source/database/transactions.rst | 2 +- .../source/general/managing_apps.rst | 78 +++++++++---------- 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/public/index.php b/public/index.php index cd38b911b5aa..4238f3c05c27 100644 --- a/public/index.php +++ b/public/index.php @@ -14,6 +14,7 @@ // Location of the Paths config file. // This is the line that might need to be changed, depending on your folder structure. $pathsPath = FCPATH . '../app/Config/Paths.php'; +// ^^^ Change this if you move your application folder /* *--------------------------------------------------------------- diff --git a/spark b/spark index 8437468c0105..10079e4ebc15 100755 --- a/spark +++ b/spark @@ -34,6 +34,7 @@ define('FCPATH', __DIR__ . '/public' . DIRECTORY_SEPARATOR); // Load our paths config file require 'app/Config/Paths.php'; +// ^^^ Change this line if you move your application folder $paths = new Config\Paths(); diff --git a/user_guide_src/source/concepts/structure.rst b/user_guide_src/source/concepts/structure.rst index 66818a729853..63d239b7e724 100644 --- a/user_guide_src/source/concepts/structure.rst +++ b/user_guide_src/source/concepts/structure.rst @@ -9,7 +9,7 @@ Default Directories =================== A fresh install has six directories: ``/app``, ``/system``, ``/public``, -``/writable``, ``/tests`` and ``/docs``. +``/writable``, ``/tests`` and possibly ``/docs``. Each of these directories has a very specific part to play. app @@ -77,7 +77,7 @@ production servers. docs ---- -This directory holds a local copy of the CodeIgniter4 +If this directory is part of your project, it holds a local copy of the CodeIgniter4 User Guide. Modifying Directory Locations @@ -85,3 +85,5 @@ Modifying Directory Locations If you've relocated any of the main directories, you can change the configuration settings inside ``app/Config/Paths``. + +Please read `Managing your Applications <../general/managing.html>`_ diff --git a/user_guide_src/source/database/transactions.rst b/user_guide_src/source/database/transactions.rst index 652197d789cb..e8188175eef6 100644 --- a/user_guide_src/source/database/transactions.rst +++ b/user_guide_src/source/database/transactions.rst @@ -76,7 +76,7 @@ debugging is turned off, you can manage your own errors like this:: } Disabling Transactions -===================== +====================== Transactions are enabled by default. If you would like to disable transactions you can do so using $this->db->transOff():: diff --git a/user_guide_src/source/general/managing_apps.rst b/user_guide_src/source/general/managing_apps.rst index 57d3e4ec8dee..4e007443a2bf 100644 --- a/user_guide_src/source/general/managing_apps.rst +++ b/user_guide_src/source/general/managing_apps.rst @@ -8,54 +8,52 @@ directory. It is possible, however, to have multiple sets of applications that share a single CodeIgniter installation, or even to rename or relocate your application directory. -Renaming the Application Directory -================================== +Renaming or Relocating the Application Directory +================================================ -If you would like to rename your application directory you may do so -as long as you open **app/Config/Paths.php** file and set its name using -the ``$applicationDirectory`` variable:: +If you would like to rename your application directory or even move +it to a different location on your server, other than your project root, open +your main **app/Config/Paths.php** and set a *full server path* in the +``$appDirectory`` variable (at about line 38):: - $applicationDirectory = 'application'; + public $appDirectory = '/path/to/your/application'; -Relocating your Application Directory -===================================== +You will need to modify two additional files in your project root, so that +they can find the ``Paths`` configuration file: -It is possible to move your application directory to a different -location on your server than your web root. To do so open -your main **app/Config/Paths.php** and set a *full server path* in the -``$appDirectory`` variable:: +- ``/spark`` runs command line apps; the path is specified on or about line 36:: + + require 'app/Config/Paths.php'; + // ^^^ Change this if you move your application folder + + +- ``/public/index.php`` is the front controller for your webapp; the config + path is specified on or about line 16:: + + $pathsPath = FCPATH . '../app/Config/Paths.php'; + // ^^^ Change this if you move your application folder - $appDirectory = '/path/to/your/application'; Running Multiple Applications with one CodeIgniter Installation =============================================================== -If you would like to share a common CodeIgniter installation to manage -several different applications simply put all of the directories located -inside your application directory into their own sub-directory. +If you would like to share a common CodeIgniter framework installation, to manage +several different applications, simply put all of the directories located +inside your application directory into their own (sub)-directory. For example, let's say you want to create two applications, named "foo" -and "bar". You could structure your application directories like this:: - - applications/foo/ - applications/foo/config/ - applications/foo/controllers/ - applications/foo/libraries/ - applications/foo/models/ - applications/foo/views/ - applications/bar/ - applications/bar/config/ - applications/bar/controllers/ - applications/bar/libraries/ - applications/bar/models/ - applications/bar/views/ - -To select a particular application for use requires that you open your -main index.php file and set the ``$application_directory`` variable. For -example, to select the "foo" application for use you would do this:: - - $application_directory = 'applications/foo'; - -.. note:: Each of your applications will need its own **index.php** file - which calls the desired application. The **index.php** file can be named - anything you want. +and "bar". You could structure your application project directories like this:: + + foo/app, public, tests and writable + bar/app/, public, tests and writable + codeigniter/system and docs + +This would have two apps, "foo" and "bar", both having standard application directories +and a ``public`` folder, and sharing a common codeigniter framework. + +The ``index.php`` inside each application would refer to its own configuration, +``.../app/Config/Paths.php``, and the ``$systemDirectory`` variable inside each +of those would be set to refer to the shared common "system" folder. + +If either of the applications had a command-line component, then you would also +modify ``spark`` inside each application's project folder, as directed above.