Skip to content

Instantly share code, notes, and snippets.

@krasnikovdev
Created October 13, 2017 12:05
Show Gist options
  • Save krasnikovdev/a36a9e706691fbcd806d041d11b51c79 to your computer and use it in GitHub Desktop.
Save krasnikovdev/a36a9e706691fbcd806d041d11b51c79 to your computer and use it in GitHub Desktop.
<?php
//mgr events
if($modx->context->key == "mgr"){
switch($modx->event->name){
case "OnBeforeCacheUpdate":
if (!$obj = $modx->getObject('modSystemSetting', array('key' => 'site_file_version'))) {
$obj = $modx->newObject('modSystemSetting');
$obj->fromArray(array(
'key' => 'site_file_version',
'xtype' => 'textfield',
'namespace' => 'core',
'area' => 'site',
'editedon' => null,
), '', TRUE);
}
$obj->set('value',substr(md5(time()), 0, 12));
$obj->save();
break;
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment