foreach ($internal_assetids as $assetid) {
        printWYSIWYGName('WYSIWYG #' . $wysiwyg->id . ' - LINK #' . $assetid);
        if (!empty($assetid)) {
            $asset =& $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid, '', true);
        } else {
            $asset = NULL;
        }
        if (is_null($asset)) {
            // the asset was invalid
            printUpdateStatus('INVALID');
        } else {
            if ($GLOBALS['SQ_SYSTEM']->am->assetInTrash($assetid, true)) {
                // the asset is in the trash
                printUpdateStatus('TRASH');
            } else {
                printUpdateStatus('OK');
            }
        }
        $GLOBALS['SQ_SYSTEM']->am->forgetAsset($asset);
    }
    $GLOBALS['SQ_SYSTEM']->am->forgetAsset($wysiwyg);
}
//end foreach
/**
* Prints the name of the WYSIWYG Link as a padded string
*
* Padds to 35 columns
*
* @param string	$name	the name of the container
*
* @return void
    $data_path = $fbm->getCollectionDataPath($index) . '/conf/';
    $file_paths['contextual_navigation.cfg'] = 'fluster.cfg';
    $file_paths['query_expansion.cfg'] = 'synonyms.cfg';
    $file_paths['best_bets.cfg'] = 'featured_pages.cfg';
    foreach ($file_paths as $new_path => $file_path) {
        if (file_exists($data_path . $file_path)) {
            if (!copy($data_path . $file_path, $data_path . $new_path)) {
                bam($data_path . $file_path);
                $all_good = FALSE;
            }
        }
    }
    if ($all_good) {
        printUpdateStatus('OK');
    } else {
        printUpdateStatus('FAILED');
    }
}
/**
* Prints the name of the collection as a padded string
*
* Pads name to 40 columns
*
* @param string	$id		id of the collection
* @param string $name	name of the collection
*
* @return void
* @access public
*/
function printCollection($id, $name)
{
     $THES_TERM_ASSET->setAttrValue('name', $THES_TERM_NAME_NOW);
     printUpdateStatus("!!!");
     echo "ERROR: Couldn't change the name for the Thesaurus Term.\n";
     $GLOBALS['SQ_SYSTEM']->restoreRunLevel();
     exit;
 }
 $GLOBALS['SQ_SYSTEM']->restoreRunLevel();
 printUpdateStatus("Done");
 // once we are done with renaming the terms in the DB
 // find out the metadata schema that uses this thesaurus
 echo "Finding Metadata Schemas to regenerate.\t\t";
 $schemas_to_regen = _findSchemas($THES_TERM_ID);
 printUpdateStatus("Done");
 echo "Updating Thesaurus Term on Assets.\t\t";
 renameTerm(array_values($schemas_to_regen), $THES_TERM_NAME_NOW, $THES_TERM_NAME_THEN);
 printUpdateStatus("Done");
 $mm = $GLOBALS['SQ_SYSTEM']->getMetadataManager();
 $total_assets = array();
 foreach ($schemas_to_regen as $schemaid => $metadata_fieldid) {
     $schema = $GLOBALS['SQ_SYSTEM']->am->getAsset($schemaid);
     if (!$schema) {
         trigger_error('Schema asset #' . $schemaid . ' could not be found', E_USER_WARNING);
         continue;
     }
     if (!$schema instanceof Metadata_Schema) {
         trigger_error('Asset #' . $schema->id . ' is not a metadata schema', E_USER_WARNING);
         continue;
     }
     $total_assets = array_merge($total_assets, $mm->getSchemaAssets($schemaid, TRUE));
 }
 // Save the list into a file so we can access the list from the parent process
            continue;
        }
        if ($acquired != 2) {
            $GLOBALS['SQ_SYSTEM']->am->releaseLock($customisation->id, 'all');
        }
        printUpdateStatus('OK');
    } else {
        printUpdateStatus('LOCK FAILED');
        continue;
    }
    $GLOBALS['SQ_SYSTEM']->am->forgetAsset($customisation);
}
// end foreach
// try to unlock the design
if (!$GLOBALS['SQ_SYSTEM']->am->releaseLock($design->id, 'all')) {
    printUpdateStatus('RELEASE LOCK FAILED');
    $GLOBALS['SQ_SYSTEM']->am->forgetAsset($design);
}
$GLOBALS['SQ_SYSTEM']->am->forgetAsset($design);
////////////////////////
//  HELPER FUNCTIONS  //
////////////////////////
function printName($name)
{
    printf('%s%' . (50 - strlen($name)) . 's', $name, '');
}
//end printName()
function printUpdateStatus($status)
{
    echo "[ {$status} ]\n";
}
                if (substr($dir, 0, strlen($group)) == $group) {
                    // this directory contains cache entries for this particular asset
                    // now files the files in this cache dir that belong to this asset
                    $dh = opendir(SQ_CACHE_PATH . '/' . $dir);
                    while (false !== ($file = readdir($dh))) {
                        $abs_path = SQ_CACHE_PATH . '/' . $dir . '/' . $file;
                        if (is_dir($abs_path)) {
                            continue;
                        }
                        // if the file starts with the assetid_code for the asset
                        // then back up in the unlinking with the resurection
                        if (substr($file, 0, strlen($assetid_code)) == $assetid_code) {
                            unlink($abs_path);
                        }
                        printAssetName($parent_asset->name . ' (#' . $parent_asset->id . ')');
                        printUpdateStatus('CACHE CLEAR');
                    }
                    closedir($dh);
                }
            }
            //end foreach
        }
    }
    $GLOBALS['SQ_SYSTEM']->am->forgetAsset($wysiwyg);
}
//end foreach
/**
* Prints the name of the WYSIWYG as a padded string
*
* Padds to 30 columns
*
        printUpdateStatus('FAILED');
        continue;
    }
    if (empty($links)) {
        // no links
        $asset =& $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid, $type_code);
        if (empty($asset) || !$GLOBALS['SQ_SYSTEM']->am->createAssetLink($map_asset, $asset, SQ_LINK_TYPE_2, 'Orphaned Asset')) {
            printUpdateStatus('FAILED');
            continue;
        }
        $updated = TRUE;
    }
    if ($updated) {
        printUpdateStatus('OK');
    } else {
        printUpdateStatus('--');
    }
    $GLOBALS['SQ_SYSTEM']->am->forgetAsset($asset);
}
//end foreach
$GLOBALS['SQ_SYSTEM']->restoreRunLevel();
/**
* Prints the name of the Asset as a padded string
*
* Pads name to 40 columns
*
* @param string	$assetid	the id of the asset of which we want to print the name
*
* @return void
* @access public
*/
                    continue;
                } else {
                    if (in_array($full_idx_name, $skip_definition_checks)) {
                        unset($full_index_list[$tablename][$full_idx_name]);
                        printUpdateStatus('OK');
                        continue;
                    }
                    check_index_parallel($tablename, $full_idx_name);
                    $index_definition = $full_index_list[$tablename][$full_idx_name];
                    $found_index_columns = explode(',', $index_definition);
                    unset($full_index_list[$tablename][$full_idx_name]);
                    if ($found_index_columns === $idx_columns) {
                        printUpdateStatus('OK');
                        continue;
                    }
                    printUpdateStatus('Incorrect');
                    $bad_indexes[] = array('index_name' => $full_idx_name, 'expected' => implode(',', $idx_columns), 'found' => $index_definition);
                    $sql_commands[] = $create_index_statement;
                }
            }
        }
        // end foreach
    }
}
$extra_message_shown = false;
$dbtype = _getDbType();
if ($dbtype === 'pgsql') {
    pre_echo('Checking locale settings');
    $locale_query = "select setting from pg_settings where name='lc_ctype'";
    $locale_info = MatrixDAL::executeSqlAll($locale_query);
    $locale = $locale_info[0]['setting'];