iakta / hugocockpit

a Hugo addon for Cockpit-Next CMS, generating Hugo compatible content and running Hugo for you
56 stars 5 forks source link

Hugo icon not appearing #2

Closed thewire247 closed 7 years ago

thewire247 commented 7 years ago

I have a RHEL 7.3 web server with php 5.6.30, httpd 2.4.6 and hugo 0.24.1 installed.

Cockpit is installed in /var/www/html/cockpit

Hugo site is set up at /var/www/html

Hugocockpit is set up at /var/www/html/cockpit/addons/Hugo

After reloading cockpit the "H" icon does not appear.

The only error logs are: [Wed Jul 19 14:41:42.606494 2017] [:error] [pid 26911] [client ::1:50438] PHP Notice: Use of undefined constant COCKPIT_REST - assumed 'COCKPIT_REST' in /var/www/html/cockpit/addons/Hugo/bootstrap.php on line 108, referer: http://localhost/cockpit/accounts [Wed Jul 19 14:41:42.606527 2017] [:error] [pid 26911] [client ::1:50438] PHP Notice: Use of undefined constant COCKPIT_REST - assumed 'COCKPIT_REST' in /var/www/html/cockpit/addons/Hugo/bootstrap.php on line 116, referer: http://localhost/cockpit/accounts [Wed Jul 19 14:41:42.606535 2017] [:error] [pid 26911] [client ::1:50438] PHP Notice: Use of undefined constant COCKPIT_REST - assumed 'COCKPIT_REST' in /var/www/html/cockpit/addons/Hugo/bootstrap.php on line 119, referer: http://localhost/cockpit/accounts

zontarian commented 7 years ago

Hi, it seems you have a different version of Cockpit than mine. A newer one..

At the moment I can't test with the newer Cockpit version, so I have to guess even if it should be fairly trivial: as a workaround you can edit the file in addons/Hugo/bootstrap.php. Remove everything from line 108 onwards and put instead

// ADMIN
if(COCKPIT_ADMIN && !file_exists(COCKPIT_HUGO_CONFIG_PATH)){    
    include_once (__DIR__.'/install.php');
}elseif (COCKPIT_ADMIN) {    
    include_once(__DIR__.'/admin.php');
}
thewire247 commented 7 years ago

Thanks for that, works great!