XF 2.0 Server errors designer mode

XF2 Beta 8 with XFMG
Digital Ocean Droplet

Hey!

I have added the following to my config.php file:

$config['debug'] = true;
$config['development']['enabled'] = true;
$config['development']['skipAddOns'] = [];
$config['designer']['enabled'] = true;

And have successfully exported templates for local editing.

All is working well apart from just noticed 2 different, but related? file permission errors.

1/ I tried closing my board and got the following:

Code:
ErrorException: [E_WARNING] mkdir(): Permission denied in src/XF/Util/File.php at line 192
XF::handlePhpError()
mkdir() in src/XF/Util/File.php at line 192
XF\Util\File::createDirectory() in src/XF/Util/File.php at line 214
XF\Util\File::writeFile() in src/XF/DevelopmentOutput.php at line 541
XF\DevelopmentOutput->writeFile() in src/XF/DevelopmentOutput/Option.php at line 49
XF\DevelopmentOutput\Option->export() in src/XF/DevelopmentOutput.php at line 53
XF\DevelopmentOutput->export() in src/XF/Behavior/DevOutputWritable.php at line 31
XF\Behavior\DevOutputWritable->postSave() in src/XF/Mvc/Entity/Entity.php at line 1112
XF\Mvc\Entity\Entity->save() in src/XF/Repository/Option.php at line 108
XF\Repository\Option->updateOptions() in src/XF/Admin/Controller/Option.php at line 71
XF\Admin\Controller\Option->actionUpdate() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1845
XF\App->run() in src/XF.php at line 328
XF::runApp() in admin.php at line 13


and here's the server log:

Code:
Stack trace
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] mkd...', 's...', 192, Array)
#1 src/XF/Util/File.php(192): mkdir('s...')
#2 src/XF/Util/File.php(214): XF\Util\File::createDirectory('s...', false)
#3 src/XF/DevelopmentOutput.php(541): XF\Util\File::writeFile('s...', '{\n    "edit_for...', false)
#4 src/XF/DevelopmentOutput/Option.php(49): XF\DevelopmentOutput->writeFile('options', 'XF', 'boardInactiveMe...', '{\n    "edit_for...')
#5 src/XF/DevelopmentOutput.php(53): XF\DevelopmentOutput\Option->export(Object(XF\Entity\Option))
#6 src/XF/Behavior/DevOutputWritable.php(31): XF\DevelopmentOutput->export(Object(XF\Entity\Option))
#7 src/XF/Mvc/Entity/Entity.php(1112): XF\Behavior\DevOutputWritable->postSave()
#8 src/XF/Repository/Option.php(108): XF\Mvc\Entity\Entity->save()
#9 src/XF/Admin/Controller/Option.php(71): XF\Repository\Option->updateOptions(Array)
#10 src/XF/Mvc/Dispatcher.php(249): XF\Admin\Controller\Option->actionUpdate(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Option', 'Update', 'json', Object(XF\Mvc\ParameterBag), 'options', Object(XF\Admin\Controller\Option), NULL)
#12 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(1845): XF\Mvc\Dispatcher->run()
#14 src/XF.php(328): XF\App->run()
#15 admin.php(13): XF::runApp('XF\\Admin\\App')
#16 {main}

Request state
array(4) {
  ["url"] => string(25) "/admin.php?options/update"
  ["referrer"] => string(60) "https://rude.community/admin.php?options/groups/boardActive/"
  ["_GET"] => array(1) {
    ["options/update"] => string(0) ""
  }
  ["_POST"] => array(6) {
    ["options_listed"] => array(2) {
      [0] => string(11) "boardActive"
      [1] => string(20) "boardInactiveMessage"
    }
    ["options"] => array(1) {
      ["boardInactiveMessage"] => string(60) "Sorry, we're currently unavailable. Please check back later."
    }
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(38) "/admin.php?options/groups/boardActive/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

2/ And also noticed the following in server logs.

Code:
Server error log
ErrorException: [E_WARNING] mkdir(): Permission denied src/XF/Util/File.php:192
Generated by: Unknown account Nov 6, 2017 at 8:40 AM

Stack trace
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] mkd...', 's...', 192, Array)
#1 src/XF/Util/File.php(192): mkdir('s...')
#2 src/XF/Util/File.php(214): XF\Util\File::createDirectory('s...', false)
#3 src/XF/DevelopmentOutput.php(541): XF\Util\File::writeFile('s...', '{\n    "criteria...', false)
#4 src/XF/DevelopmentOutput/MemberStat.php(40): XF\DevelopmentOutput->writeFile('member_stats', 'XF', 'staff_members.j...', '{\n    "criteria...')
#5 src/XF/DevelopmentOutput.php(53): XF\DevelopmentOutput\MemberStat->export(Object(XF\Entity\MemberStat))
#6 src/XF/Behavior/DevOutputWritable.php(31): XF\DevelopmentOutput->export(Object(XF\Entity\MemberStat))
#7 src/XF/Mvc/Entity/Entity.php(1112): XF\Behavior\DevOutputWritable->postSave()
#8 src/XF/Service/MemberStat/Preparer.php(67): XF\Mvc\Entity\Entity->save()
#9 src/XF/Cron/MemberStats.php(19): XF\Service\MemberStat\Preparer->cache()
#10 [internal function]: XF\Cron\MemberStats::rebuildMemberStatsCache(Object(XF\Entity\CronEntry))
#11 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#12 src/XF/Job/Manager.php(241): XF\Job\Cron->run(8)
#13 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)
#14 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)
#15 job.php(15): XF\Job\Manager->runQueue(false, 8)
#16 {main}

Request state
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(41) "https://rude.community/admin.php?options/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

I believe the above started after I'd commenced Debug/Development/Designer mode, although can't be 100% sure. I thought I'd correctly set all permissions by modifying permissions on the exported templates, but looks like I've missed something?

Many thanks, Chris
 
These are all related to the fact that developer mode is enabled e.g.
Code:
#4 src/XF/DevelopmentOutput/Option.php(49): XF\DevelopmentOutput->writeFile('options', 'XF', 'boardInactiveMe...', '{\n    "edit_for...')
Development output is used for development purposes as it outputs the data which is then compiled into the data XML files for releasing an add-on.

In these cases, it's being triggered by you changing the value of the boardInactiveMessage option.

Normally you wouldn't want or need XF data to be exported, so you could remove this line:
PHP:
$config['development']['skipAddOns'] = [];
(XF is skipped by default)

Are you actually working on an add-on or just a design? If it's just a design then you can remove both of these lines:
PHP:
$config['development']['enabled'] = true;
$config['development']['skipAddOns'] = [];

If you are working on an add-on, then you might as well ensure pretty much all of your src/addons directory and its children is writeable.
 
Are you actually working on an add-on or just a design? If it's just a design then you can remove both of these lines:
PHP:
$config['development']['enabled'] = true;
$config['development']['skipAddOns'] = [];

No, just experimenting with templates and styles and copying locally makes it much easier.

Thanks for your help, removing the surplus config options appears to have fixed it.
 
I understand from Mike that you asked about having XF templates available externally, in which case you would need development mode enabled, although I guess you might have already exported what you need so perhaps that part is done now?

But if you still wanted that and for it to be kept up to date then you might be better switching them back on and adjusting the permissions.
 
I understand from Mike that you asked about having XF templates available externally, in which case you would need development mode enabled, although I guess you might have already exported what you need so perhaps that part is done now?

But if you still wanted that and for it to be kept up to date then you might be better switching them back on and adjusting the permissions.

Thanks, not quite sure what templates I will need, so will reenable dev mode when I need to, export the templates, and then disable it again. Assuming that works.

Thanks for your help.
 
Back
Top Bottom