Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
upgrade_suiteid.php
1 <?php
2 
3 $root_dir = dirname(dirname(dirname(dirname(__FILE__))));
4 
5 require_once $root_dir.'/core/include/init.inc';
6 
7 $GLOBALS['SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
8 $GLOBALS['SQ_SYSTEM']->setCurrentUser($GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user'));
9 $suitem = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('suite_manager');
10 if ($suitem !== NULL) {
11  $pages = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetids('funnelback_search_page');
12  foreach ($pages as $assetid) {
13  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
14  if ($asset !== NULL) {
15  $systemid = $asset->attr('systemid');
16  $product = $suitem->getProductBySystemid($systemid);
17  if (isset($product[0]['suiteid'])) {
18  $asset->setAttrValue('systemid', $product[0]['suiteid']);
19  $asset->saveAttributes();
20  }
21  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($asset, TRUE);
22  }
23  unset($asset);
24  }//end foreach
25 }//end if
26 $GLOBALS['SQ_SYSTEM']->restoreCurrentUser();
27 $GLOBALS['SQ_SYSTEM']->restoreRunLevel();
28 
29 ?>