• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
update system folder?

I'm trying to figure out how to delete the system folder, then replace it with a new one from a zip. However as soon as I delete the folder the script stops (it's executing from a model). What is the recommended way to go about doing this?


Are you trying to delete the system folder through the CodeIgniter app itself? If so, that's not really possible, considering it needs those files for it to run in the first place.

Either do it from an outside script, or manually via FTP / other means.

Updating from outside (via FTP, etc.):

1. Unzip the CI distro
2. Rename the system folder to system2
3. Upload the folder next to Your system folder
4. Once completely uploaded (check for transfer errors), edit Your index.php file, update the $system_path to Your new system2 folder
5. Check in the browser that it works
6. Rename the old system folder and check again in the browser, just to be sure
7. Now delete the old system folder
You may want to repeat 4. - 6. to rename stem2 to system

Updating from inside Your application (via HTTP requests, i.e.page calls):

I would work with three system paths to toggle and a fallback path as safety. I'd assign the three paths to the configs so I can fetch them from inside the application.

// index.php

$assign_to_config['system_path0'] = $system_path0;
$assign_to_config['system_path1'] = $system_path1;
$assign_to_config['system_path2'] = $system_path2;

$system_path = $system_path0;
$system_path = $system_path2;
$system_path = $system_path2;
$system_path = $system_fallback_path;

Now, this set up, I work with at least two requests (page calls).

$system_path0 is the current path, the one usually used, path1 and path2 are used to switch.

With one request (page call, cron, etc.) I copy path0 to path1.
Either with the same request (or the next, just to limit the time) I put the new system in path2.

With another request I delete path0.
Now the switch in index.php will use path1 (the old system).

Again, either with the same request (or the next) I rename path2 to path0.
The switch in index.php will use path0 (the new system).

I'd probably use another request to clean up (delete path1, update fallback path).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.