Forums

Jamie Dean
Jamie Dean
Offline
Resolved
0 votes
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
Tuesday, December 29 2015, 04:35 PM
Share this post:
Responses (1)
  • Accepted Answer

    WRIGHT
    WRIGHT
    Offline
    Monday, July 11 2016, 11:21 AM - #Permalink
    Resolved
    0 votes
    hello, i am a newbie and i want to know from scratch the process for installing laravel 5.2 on ClearOs 7.2!
    The reply is currently minimized Show
Your Reply