Hi all,
Thought I'd post this little mod for the Flexshare App, basically I made it to make life easier when adding new flexshares or Virtual Hosts via the Web Server. I wanted a way to create the flexshare but be able to specify the DocumentRoot of the flexshare. For example the Laravel Framework for PHP would live in the flexshare created folder but you don't want the document root to be the same as the share path as Laravel has a public folder.
I've listed the files to be modded and hopefully made the comments nice and clear to follow.
-----------------------------------START OF THE MOD -----------------------------------------------
File: apps/flexshare/libraries/Flexshare.php
--------------------------------------------------------------------------------------------------------
//Add set_www_root
/**
* set_www_root
*
* @param mixed $name
* @param mixed $www_root
*/
function set_www_root($name, $www_root)
{
clearos_profile(__METHOD__, __LINE__);
$this->_set_parameter($name, 'WWWRoot', $www_root);
}
//End of Add set_www_root
//Replace line 3273 - $config_virtual_host[] = "\tDocumentRoot " . $document_roots[$inx];
$config_virtual_host[] = "\tDocumentRoot " . $document_roots[$inx].(isset($share['WWWRoot']) ? "/":"").$share['WWWRoot'];
//End of Replace line 3273
File: apps/web_server/libraries/Httpd.php
--------------------------------------------------------------------------------------------------------
//Add below line 651 - function _set_core_info
if (isset($options['document_root']))
$flexshare->set_www_root($site,$options['document_root']);
//End of Add below line 651
File: apps/web_server/views/site.php
--------------------------------------------------------------------------------------------------------
//Add below line 122 - before fieldset_footer()
echo field_textarea('document_root', $info['WWWRoot'], 'WWW Root Path');
//End of Add below line 122
File: apps/web_server/views/sites.php
--------------------------------------------------------------------------------------------------------
//Add below Line 367
$options['document_root'] = $this->input->post('document_root');
//End of Add below Line 367
File: apps/web_server/controllers/apps.php
--------------------------------------------------------------------------------------------------------
//Add below line 173 - below $options['cgi'] = $this->input->post('cgi')
$options['document_root'] = $this->input->post('document_root');
//End of Add below line 173
File: apps/flexshare/controllers/file.php
--------------------------------------------------------------------------------------------------------
//Add below line 127 - before redirect('/flexshare/shares/summary/' . $share);
$this->flexshare->set_www_root($share,$this->input->post('document_root'));
//End of Add below line 127
File: apps/flexshare/views/web.php
--------------------------------------------------------------------------------------------------------
//Add below line 102
echo field_textarea('application_root', $info['ShareDir'], "App Root Path", true);
echo field_textarea('document_root', $info['WWWRoot'], "WWW Root Path",false);
//End of Add below line 102
File: apps/flexshare/controllers/web.php
--------------------------------------------------------------------------------------------------------
//Add below line 156
$this->flexshare->set_wwww_root($share, $this->input->post('document_root'));
//End of Add below line 156
//Add below Line 221
if (! isset($data['share']['WWWRoot']))
$data['share']['WWWRoot'] = '';
//End of Add below Line 221
Thought I'd post this little mod for the Flexshare App, basically I made it to make life easier when adding new flexshares or Virtual Hosts via the Web Server. I wanted a way to create the flexshare but be able to specify the DocumentRoot of the flexshare. For example the Laravel Framework for PHP would live in the flexshare created folder but you don't want the document root to be the same as the share path as Laravel has a public folder.
I've listed the files to be modded and hopefully made the comments nice and clear to follow.
-----------------------------------START OF THE MOD -----------------------------------------------
File: apps/flexshare/libraries/Flexshare.php
--------------------------------------------------------------------------------------------------------
//Add set_www_root
/**
* set_www_root
*
* @param mixed $name
* @param mixed $www_root
*/
function set_www_root($name, $www_root)
{
clearos_profile(__METHOD__, __LINE__);
$this->_set_parameter($name, 'WWWRoot', $www_root);
}
//End of Add set_www_root
//Replace line 3273 - $config_virtual_host[] = "\tDocumentRoot " . $document_roots[$inx];
$config_virtual_host[] = "\tDocumentRoot " . $document_roots[$inx].(isset($share['WWWRoot']) ? "/":"").$share['WWWRoot'];
//End of Replace line 3273
File: apps/web_server/libraries/Httpd.php
--------------------------------------------------------------------------------------------------------
//Add below line 651 - function _set_core_info
if (isset($options['document_root']))
$flexshare->set_www_root($site,$options['document_root']);
//End of Add below line 651
File: apps/web_server/views/site.php
--------------------------------------------------------------------------------------------------------
//Add below line 122 - before fieldset_footer()
echo field_textarea('document_root', $info['WWWRoot'], 'WWW Root Path');
//End of Add below line 122
File: apps/web_server/views/sites.php
--------------------------------------------------------------------------------------------------------
//Add below Line 367
$options['document_root'] = $this->input->post('document_root');
//End of Add below Line 367
File: apps/web_server/controllers/apps.php
--------------------------------------------------------------------------------------------------------
//Add below line 173 - below $options['cgi'] = $this->input->post('cgi')
$options['document_root'] = $this->input->post('document_root');
//End of Add below line 173
File: apps/flexshare/controllers/file.php
--------------------------------------------------------------------------------------------------------
//Add below line 127 - before redirect('/flexshare/shares/summary/' . $share);
$this->flexshare->set_www_root($share,$this->input->post('document_root'));
//End of Add below line 127
File: apps/flexshare/views/web.php
--------------------------------------------------------------------------------------------------------
//Add below line 102
echo field_textarea('application_root', $info['ShareDir'], "App Root Path", true);
echo field_textarea('document_root', $info['WWWRoot'], "WWW Root Path",false);
//End of Add below line 102
File: apps/flexshare/controllers/web.php
--------------------------------------------------------------------------------------------------------
//Add below line 156
$this->flexshare->set_wwww_root($share, $this->input->post('document_root'));
//End of Add below line 156
//Add below Line 221
if (! isset($data['share']['WWWRoot']))
$data['share']['WWWRoot'] = '';
//End of Add below Line 221
In Flexshare
Share this post:
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »