• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug Unable to set options in XenResource_DataWriter_Resource

Jon W

Well-known member
#1
Still trying to get to the bottom of it, but there seems to be an issue with this bit of code in XenForo_DataWriter_Version that causes the options in the resource data-writer to be reset when creating a new resource, meaning it is impossible to change an option when calling the data-writer:
PHP:
        if ($this->isChanged('version_state'))
        {
            $resourceDw = XenForo_DataWriter::create('XenResource_DataWriter_Resource', XenForo_DataWriter::ERROR_SILENT);
            if ($resourceDw->setExistingData($this->get('resource_id')))
            {
                $resourceDw->updateCurrentVersion();
                $resourceDw->save();
            }

            $this->_updateDeletionLog();
            $this->_updateModerationQueue();
        }
I think the solution is to add a check for $this->isUpdate().

Hope this makes some sort of sense. Let me know if you need more information as it's late now and I need sleep...
 

Mike

XenForo developer
Staff member
#3
That code creates a new data writer so no options will be preserved.

So I don't really understand the report.