Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
design_css_management.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_management.inc';
19 
31 {
32 
33 
39  {
40  Asset_Management::__construct($pm);
41 
42  $this->vars['id_name'] = Array(
43  'added' => '0.0.1',
44  'type' => 'text',
45  'default' => '',
46  );
47  $this->vars['cache_css'] = Array(
48  'added' => '0.0.1',
49  'type' => 'boolean',
50  'default' => FALSE,
51  'parameters' => Array('allow_empty' => FALSE),
52  );
53  $this->vars['strip_whitespace'] = Array(
54  'added' => '0.0.1',
55  'type' => 'boolean',
56  'default' => FALSE,
57  'parameters' => Array('allow_empty' => FALSE),
58  );
59  $this->vars['static_url_versioning'] = Array(
60  'added' => '0.4',
61  'type' => 'boolean',
62  'default' => TRUE,
63  'parameters' => Array('allow_empty' => FALSE),
64  );
65 
66  }//end constructor
67 
68 
77  function _upgrade($current_version)
78  {
79  // first do things as normal
80  $res = parent::_upgrade($current_version);
81 
82  if (version_compare($current_version, '0.4', '<')) {
83  pre_echo('UPGRADING DESIGN CSS FROM v < 0.4');
84 
85  // get all design assets
86  $design_ids = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetids('design_css', TRUE, TRUE);
87  foreach ($design_ids as $design_id => $type) {
88  $design = $GLOBALS['SQ_SYSTEM']->am->getAsset($design_id, $type['type_code']);
89  $design->setAttrValue('static_url_versioning', FALSE);
90  $design->saveAttributes();
91  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($design);
92  unset($design);
93  }
94 
95  }//end if
96 
97  if (version_compare($current_version, '0.5', '<')) {
98  pre_echo('UPGRADING DESIGN CSS FROM v < 0.5');
99 
100  // regenerate all design assets
101  $design_ids = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetids('design_css', TRUE, TRUE);
102  foreach ($design_ids as $design_id => $type) {
103  $vars = Array('assetid' => $design_id);
104  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
105  $hh->freestyleHipo('hipo_job_regenerate_design', $vars);
106  }
107 
108  }//end if
109 
110 
111  return TRUE;
112 
113  }//end _upgrade(
114 
115 }//end class
116 ?>