Skip to content

Commit

Permalink
Dev: force republish admin assets after update
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed May 9, 2016
1 parent 456470c commit e0026be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$config['dbversionnumber'] = 258;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = 6;
$config['assetsversionnumber'] = 7;
return $config;

?>
18 changes: 18 additions & 0 deletions application/models/AdminTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,24 @@ public static function getInstance()
return self::$instance;
}

/**
* Touch each directory in standard template directory to force assset manager to republish them
*/
public static function forceAssets()
{
// Don't touch symlinked assets because it won't work
if (App()->getAssetManager()->linkAssets) return;
$standardTemplatesPath = Yii::app()->getConfig("styledir");
$Resource = opendir($standardTemplatesPath);
while ($Item = readdir($Resource))
{
if (is_dir($standardTemplatesPath . $Item) && $Item != "." && $Item != "..")
{
touch($standardTemplatesPath . $Item);
}
}
}

/**
* Register all the styles and scripts of the current template
* Check if RTL is needed, use asset manager if needed
Expand Down
1 change: 1 addition & 0 deletions application/models/UpdateForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ public function republishAssets()
{
// Republish the template assets
Template::model()->forceAssets();
AdminTheme::model()->forceAssets();
}

/**
Expand Down

0 comments on commit e0026be

Please sign in to comment.