/* Analyze all Vault folder user parameters and store for later use. */
    CACF_AnalyzeVaultFolderUserParameters(&$db, &$CACFconstants, &$altiumUserParmNames, &$altiumFolderUserParmValuesByGuid);
    /* Analyze all Vault item user parameters and store for later use. */
    CACF_AnalyzeVaultItemUserParameters(&$db, &$CACFconstants, &$altiumUserParmNames, &$altiumItemUserParmValuesByGuid);
    /* Create model audit data and write to csv file. */
    CACF_CreateModelAuditDataAndWriteToCsv(&$db, &$CACFconstants, &$altiumUserNamesByGuid, &$altiumFoldersByGuid, &$altiumAclDataByObjectGuid, &$altiumItemRevsByGuid);
    /* Create model where-used data and write to csv file. */
    CACF_CreateModelWhereUsedDataAndWriteToCsv(&$db, &$CACFconstants, &$altiumItemRevsByGuid);
    /* Create PCB audit data and write to csv file. */
    CACF_CreatePcbAuditDataAndWriteToCsv(&$db, &$CACFconstants, &$altiumUserNamesByGuid, &$altiumFoldersByGuid, &$altiumAclDataByObjectGuid, &$altiumItemRevsByGuid);
    /* Create component audit data. */
    CACF_CreateComponentAuditData(&$db, &$CACFconstants, &$altiumUserNamesByGuid, &$altiumFoldersByGuid, &$altiumAclDataByObjectGuid, &$altiumItemRevsByGuid, &$altiumItemSysParmValuesByGuid, &$altiumObsoleteCompsByGuid);
    /* Write component audit data to csv file. */
    CACF_WriteComponentAuditDataToCsv(&$CACFconstants, &$auditComponentsByType, &$auditComponentsByTypeUnmatched, &$altiumUserParmNames, &$altiumItemUserParmValuesByGuid, &$altiumItemSysParmValuesByGuid, &$altiumObsoleteCompsByGuid, &$altiumUserParmNamesByCompType, &$altiumParmsByCompType);
    /* Create all per-component-type audit data and output to csv files. */
    CACF_CreateAllComponentTypeAuditDataAndWriteToCsv(&$CACFconstants, &$altiumParmsByComponentLines, &$altiumUserParmNamesByCompType, &$altiumParmsByCompType, &$altiumItemSysParmValuesByGuid, &$altiumItemUserParmValuesByGuid, &$altiumObsoleteCompsByGuid);
    /* Create per-component audit data and output to csv files. */
    CACF_CreatePerComponentAuditDataAndWriteToCsv(&$db, &$CACFconstants, &$altiumParmsByComponentLines);
    /* Create folder audit data and output to csv file. */
    CACF_CreateFolderAuditDataAndWriteToCsv(&$db, &$CACFconstants, &$altiumUserNamesByGuid, &$altiumFoldersByGuid, &$altiumFolderUserParmValuesByGuid, &$altiumUserParmNames, &$altiumAclDataByObjectGuid);
    /* Create change-log data and write to csv file. */
    CACF_CreateChangeLogAuditDataAndWriteToCsv(&$db, $CACFconstants, &$altiumUserNamesByGuid);
    /** Wrap things up. **/
    /** Report script done and peak memory usage. **/
    echo date('H:i:s') . " Script is ending successfully.\n";
    echo date('H:i:s') . " Peak memory usage: " . memory_get_peak_usage(true) / 1024 / 1024 . " MiB.\n";
}
/* endif */
?>

<?php 
function UCTCF_CreateExcelComponentAuditData(&$CACFconstants, &$auditComponentsByType, &$auditComponentsByTypeUnmatched, &$UCTCFconstants, &$altiumUserParmNames, &$altiumUserParmNamesByCompType, &$altiumObsoleteCompsByGuid, &$excelUserParmsByItemHrid, &$excelSysParmsByItemHrid)
{
    /* Flag that we want to write this audit file with the "_Excel" suffix. */
    $CACFconstants["auditComponentsByTypeFileName"] = $CACFconstants["auditComponentsByTypeFileNameExcel"];
    /* Pretend to write Excel component audit data to csv file. */
    /* This is the only run using Excel derived data.  Output is $altiumParmsByCompType. */
    CACF_WriteComponentAuditDataToCsv($CACFconstants, $auditComponentsByType, $auditComponentsByTypeUnmatched, $altiumUserParmNames, $excelUserParmsByItemHrid, $excelSysParmsByItemHrid, $altiumObsoleteCompsByGuid, $altiumUserParmNamesByCompTypeFOO, $altiumParmsByCompType);
    /* Create all Excel per-component-type audit data and output to csv files. */
    CACF_CreateAllComponentTypeAuditDataAndWriteToCsv($CACFconstants, $altiumParmsByComponentLines, $altiumUserParmNamesByCompType, $altiumParmsByCompType, $excelSysParmsByItemHrid, $excelUserParmsByItemHrid, $altiumObsoleteCompsByGuid);
    //print_r(PHPExcel_Calculation::getInstance()->debugLog);
}