Fixed Deleting add-on template from ACP does not write changes to _output

Jeremy P

XenForo developer
Staff member
Affected version
2.0.2
As of 2.0.2, I've noticed that if I delete a template from the ACP the changes are not propagated to the file system. It worked fine in prior versions. I haven't seen this reported elsewhere though so maybe it's just something particular with my development environment.

If anyone else is experiencing this, you can:
  1. Run xf-dev:import -a Vendor/AddOn (so long as your file system contains the 'master' copy)
  2. Delete the _output folder (potentially destructive if you haven't imported first)
  3. Delete the template
  4. Run xf-dev:export -a Vendor/AddOn to write the _output folder back
 
Last edited:
This applies to all delete operations with dev outputable content:

Code:
    public function isDevOutputWritable()
    {
        return (
            $this->options['write_dev_output']
            && $this->entity->getNewValues()
            && \XF::app()->developmentOutput()->isEnabled()
        );
    }

The line "$this->entity->getNewValues()" should be DevOutputWritable::PostSave not in isDevOutputWritable
 
Last edited:
Diff:
diff --git a/src/XF/Behavior/DevOutputWritable.php b/src/XF/Behavior/DevOutputWritable.php
index 6518da7..5ad4af3 100644
--- a/src/XF/Behavior/DevOutputWritable.php
+++ b/src/XF/Behavior/DevOutputWritable.php
@@ -20,6 +20,11 @@ class DevOutputWritable extends Behavior
         return;
      }
 
+     if (!$this->entity->getNewValues())
+     {
+        return;
+     }
+
      $entity = $this->entity;
      $devOutput = \XF::app()->developmentOutput();
 
@@ -45,7 +50,6 @@ class DevOutputWritable extends Behavior
   {
      return (
         $this->options['write_dev_output']
-        && $this->entity->getNewValues()
         && \XF::app()->developmentOutput()->isEnabled()
      );
   }
Sorry about that. This is the fix we'll go with for the next release.
 
Back
Top Bottom