Difference between #6 and #5 of Our WebApp that will run without downtime during update/upgrade

unchanged
Title
Our WebApp that will run without downtime during update/upgrade
unchanged
Category
Tutorials
unchanged
Tags
tutorial
changed
Content
How many of us wonder how we can upgrade the website without hurting the
operation of our WebApp?

Even if we put new functionality, change the look and feel of the UI, fixed some
bugs just discover and even if we upgrade the core (Yii Framework itself).

I come up to the idea of remodifying the file structure of the Yii.

Default Structure of the Yii Framework:

	assets/
	css/
	framework/
	images/
	protected/
	themes/
	index.php~~~
assets/
css/
framework/
images/
protected/
themes/
index.php
~~~

- allAll we need is to transfer the outer folder of the
default file structure of Yii Framework.
            

In our index.php code, we do have.have:

	<?php~~~
[php]
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';

	// change// remove the following paths if
necessarylines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);

	$yii=dirname(__FILE__).'/framework/yii.php';// specify how many
levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

	$config=dirname(__FILE__).'/protected/config/main.php';require_once($yii);
Yii::createWebApplication($config)->run();
~~~

We can actually remodify it like this:

~~~
assets/
css/
yii/
	1.1.8/  	
images/
webapp/
	1.0/
themes/
index.php
~~~

	// removeIn our index.php with the following lines
when in production modeimplementation of the modified file
structure:

	defined('YII_DEBUG') or define('YII_DEBUG',true);~~~
[php]
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/yii/1.1.8/yii.php';
$config=dirname(__FILE__).'/webapp/1.0/config/main.php';

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);

	//// specify how many levels of call stack should be
shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

	defined('YII_TRACE_LEVEL') or
define('YII_TRACE_LEVEL',3);require_once($yii);
Yii::createWebApplication($config)->run();
~~~

*Explanation:*

In the directory:

	require_once($yii);

	Yii::createWebApplication($config)->run();

We can actually remodify to it like this.

	assets/
	css/
	yii/
		1.1.8/  	
	images/

	webapp/
		1.0/
	themes/
	index.php

In our code for the index.php with the implementation of the modification of the
file structure

	<?php

	// change the following paths if necessary

	$yii=dirname(__FILE__).'/yii/1.1.8/yii.php';

	$config=dirname(__FILE__).'/webapp/1.0/config/main.php';



	// remove the following lines when in production mode

	defined('YII_DEBUG') or define('YII_DEBUG',true);


	// specify how many levels of call stack should be shown in each log message

	defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);



	require_once($yii);

	Yii::createWebApplication($config)->run();

Explanation:
	In this directory:

	yii/
		1.1.8/~~~
yii/
	1.1.8/
~~~

we move the core in the folder 1.1.8 (based on the version of the Framework), so
in this way, we can upgrade the Yii Framework without hurting the operation.

	InIn our WebApp folder:

	webapp/
		1.0/~~~
webapp/
	1.0/
~~~

	- so in thisThis way, we are working based on the version
of the WebApp, we now rename the folder 'protected' to 'webapp', and then create
a folder based on the version of the webapp, in the example is '1.0' ( in this
folder, we put all the subfolders we have 'models, controllers
etc..'.etc..').