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

Lack of Interest [suggestion] Track the edit date for templates

Discussion in 'Closed Suggestions' started by Mike Tougeron, Sep 8, 2011.

  1. Mike Tougeron

    Mike Tougeron Well-Known Member

    It'd be nice to track when a template has been last edited. Possible patch is below. The one thing I'm not sure about is in the import* methods whether or not the imported value for last_modified_date will be retained.

    Code:
    ALTER TABLE xf_template ADD COLUMN last_modified_date INT(10) UNSIGNED NOT NULL default 0;
    XenForo_DataWriter_Template::_getFields() line 80:
    PHP:
    'version_string'    => array('type' => self::TYPE_STRING'maxLength' => 30'default' =>''),
    'last_modified_date' => array('type' => self::TYPE_UINT'default' => 0)
    XenForo_DataWriter_Template::_writeMetaDataDevFileOutput() line 328-330:
    PHP:
    XenForo_Helper_DevelopmentXml::writeMetaDataOutput(
        
    $metaDataFile$title$data, array('version_id''version_string''last_modified_date')
    );
    XenForo_DataWriter_Template::_preSave() insert after line 225:
    PHP:
    if ( $this->hasChanges() ) {
        
    $this->set('last_modified_date'XenForo_Application::$time);
    }
    XenForo_Model_Template::importTemplatesAddOnXml() line 719:
    PHP:
    'version_string' => (string)$template['version_string'],
    'last_modified_date' => (isset($template['last_modified_date']) ? (int)$template['last_modified_date'] : XenForo_Application::$time)
    XenForo_Model_Template::importTemplatesStyleXml() line 769:
    PHP:
    'version_string' => (string)$template['version_string'],
    'last_modified_date' => (isset($template['last_modified_date']) ? (int)$template['last_modified_date'] : XenForo_Application::$time)
    XenForo_Model_Template::appendTemplatesAddOnXml() insert after line 793:
    PHP:
    $templateNode->setAttribute('last_modified_date', (isset($template['last_modified_date']) ? (int)$template['last_modified_date'] : XenForo_Application::$time));
    XenForo_Model_Template::appendTemplatesStyleXml() insert after line 817:
    PHP:
    $templateNode->setAttribute('last_modified_date', (isset($template['last_modified_date']) ? (int)$template['last_modified_date'] : XenForo_Application::$time));
    I don't think XenForo_Model_Template::importTemplatesFromDevelopment() will need any changes since if the XML has been updated via the code above, line 642 $dw->bulkSet($metaData[$templateName]); should properly import the last_modified_date field.

    edit: switched to PHP instead of CODE tags.
     

Share This Page