modules/UpgradeWizard/uw_utils.php

Show: inherited
    Table of Contents

    Functions

    functionUWrebuild( ) : void

    runs rebuild scripts

    functionaddNewSystemTabsFromUpgrade(  $from_dir ) : void

    Parameters
    Name Type Description
    $from_dir
    functionadd_custom_modules_favorites_search( ) : void

    functionadd_unified_search_to_custom_modules_vardefs( ) : void

    add_unified_search_to_custom_modules_vardefs

    This method calls the repair code to remove the unified_search_modules.php fiel

    functionalterCustomTables(  $customTables ) : void

    Parameters
    Name Type Description
    $customTables
    functioncheckFiles( array $files,  $echo = false ) : string

    checks files for permissions

    Parameters
    Name Type Description
    $files array

    files Array of files with absolute paths

    $echo
    Returns
    Type Description
    string result of check
    functioncheckSystemCompliance( ) : array

    checks system compliance for 4.5+ codebase

    Returns
    Type Description
    array Mixed values
    functioncheck_FTS( ) : void

    functionclearHelpFiles( ) : void

    clearHelpFiles This method attempts to delete all English inline help files.

    This method was introduced by 5.5.0RC2.

    functioncommitCopyNewFiles( string $unzip_dir, string $zip_from_dir, string $path = '' ) : array

    Copies files from the unzipped patch to the destination.

    Parameters
    Name Type Description
    $unzip_dir string

    unzip_dir Full path to the temporary directory created during unzip operation.

    $zip_from_dir string

    zip_from_dir Name of folder containing the unzipped files; usually the name of the Patch without the extension.

    $path string

    path Optional full path to alternate upgradeWizard log file.

    Returns
    Type Description
    array Two element array containing to $copiedFiles and $skippedFiles.
    functioncommitHandleReminders( array $skippedFiles, string $path = '' ) : void

    Handles requirements for creating reminder Tasks and Emails

    Parameters
    Name Type Description
    $skippedFiles array

    skippedFiles Array of files that were not overwriten and must be manually mereged.

    $path string

    path Optional full path to alternate upgradeWizard log.

    functioncommitMakeBackupFiles( string $rest_dir, string $install_file, string $unzip_dir, string $zip_from_dir, array $errors, string $path = '' ) : array

    Backs-up files that are targeted for patch/upgrade to a restore directory

    Parameters
    Name Type Description
    $rest_dir string

    rest_dir Full path to the directory containing the original, replaced files.

    $install_file string

    install_file Full path to the uploaded patch/upgrade zip file

    $unzip_dir string

    unzip_dir Full path to the unzipped files in a temporary directory

    $zip_from_dir string

    zip_from_dir Name of directory that the unzipped files containing the actuall replacement files

    $errors array

    errors Collection of errors to be displayed at end of process

    $path string

    path Optional full path to the log file.

    Returns
    Type Description
    array errors
    functionconvertImageToText(  $table_name,  $column_name ) : void

    convertImageToText

    Parameters
    Name Type Description
    $table_name
    $column_name
    Details
    Deprecated
    This method attempts to convert date type image to text on Microsoft SQL Server. This method could NOT be used in any other type of datebases.  
    functioncopyFilesOnCancel(  $step ) : void

    Parameters
    Name Type Description
    $step
    functioncopyRecursiveBetweenDirectories( string $from, boolean $to ) : boolean

    This function copies/overwrites between directories

    Parameters
    Name Type Description
    $from string

    the directory name to remove

    $to boolean

    whether to just empty the given directory, without deleting the given directory.

    Returns
    Type Description
    boolean True/False whether the directory was deleted.
    functioncurrSubStep(  $currStep ) : void

    Parameters
    Name Type Description
    $currStep
    functioncurrUpgradeState(  $currState ) : void

    Parameters
    Name Type Description
    $currState
    functiondeleteAndOverWriteSelectedFiles(  $unzip_dir,  $zip_from_dir,  $delete_dirs ) : void

    Get all the customized modules. Compare the file md5s with the base md5s If a file has been modified then put the module in the list of customized modules. Show the list in the preflight check UI.

    Parameters
    Name Type Description
    $unzip_dir
    $zip_from_dir
    $delete_dirs
    functiondeleteCache( ) : void

    functiondeleteChance( ) : void

    functiondeleteDirectory(  $dirname,  $only_empty = false ) : void

    Parameters
    Name Type Description
    $dirname
    $only_empty
    functiondeletePackageOnCancel( ) : void

    functiondidThisStepRunBefore(  $step,  $SubStep = '' ) : void

    Parameters
    Name Type Description
    $step
    $SubStep
    functionexecuteConvertTablesSql(  $tables ) : void

    Parameters
    Name Type Description
    $tables
    functionextractFile(  $zip_file,  $file_in_zip ) : void

    Parameters
    Name Type Description
    $zip_file
    $file_in_zip
    functionextractManifest(  $zip_file ) : void

    Parameters
    Name Type Description
    $zip_file
    functionfileCopy(  $file_path ) : void

    Parameters
    Name Type Description
    $file_path
    functionfix_dropdown_list( ) : void

    fix_dropdown_list This method attempts to fix dropdown lists that were incorrectly named.

    There were versions of SugarCRM that did not enforce naming convention rules for the dropdown list field name. This method attempts to resolve that by fixing the language files that may have been affected and then updating the fields_meta_data table accordingly. It also refreshes any vardefs that may have been affected.

    functionfix_report_relationships( \$path $path = '' ) : void

    fix_assigned_user_link_reports

    This method goes through the existing reports and fixes errors with the reports definition where the assigned_user_link may have been pointing to the wrong relationship name ("teams" instead of "team_memberships"). Also, fix errors where the team_memberships relationship may have been incorrectly pointing to the wrong name definition ("teams" instead of "team_memberships"). This will fix existing reports created before 5.2.0d that used the Assigned User Name's teams as a filter. The fix will allow the Teams folder for the Assigned To User field to be displayed. Also, the fix to the team memberships relationship name will correctly fix the query to join against the team_memberships table rather than the teams table.

    Parameters
    Name Type Description
    $path \$path

    String variable for the log path

    functiongetAllCustomizedModules( ) : void

    functiongetAllModules( ) : \$modules

    Array of all Modules in the version bein upgraded This method returns an Array of all modules

    Returns
    Type Description
    \$modules Array of modules.
    functiongetAllTables( ) : void

    functiongetAlterTable(  $query ) : void

    Parameters
    Name Type Description
    $query
    functiongetChecklist(  $steps,  $step ) : void

    Parameters
    Name Type Description
    $steps
    $step
    functiongetCustomTables( ) : void

    functiongetFilesForPermsCheck( ) : array

    generates an array with all files in the SugarCRM root directory, skipping cache/

    Returns
    Type Description
    array files Array of files with absolute paths
    functiongetFormattedError(  $error,  $query ) : void

    Parameters
    Name Type Description
    $error
    $query
    functiongetImageForType(  $type ) : void

    Parameters
    Name Type Description
    $type
    functiongetInstallType(  $type_string ) : void

    Parameters
    Name Type Description
    $type_string
    functiongetLanguagePackName(  $the_file ) : void

    Parameters
    Name Type Description
    $the_file
    functiongetModuleLanguagePack( \lang $lang, \module $module ) : array

    gets a module's lang pack - does not need to be a SugarModule

    Parameters
    Name Type Description
    $lang \lang

    string Language

    $module \module

    string Path to language folder

    Returns
    Type Description
    array mod_strings
    functiongetSilentUpgradeVar(  $var ) : void

    Parameters
    Name Type Description
    $var
    functiongetTableFromQuery( string $query ) : string

    parses a query finding the table name

    Parameters
    Name Type Description
    $query string

    query The query

    Returns
    Type Description
    string table The table
    functiongetUITextForType(  $type ) : void

    Parameters
    Name Type Description
    $type
    functiongetUWDirs( ) : void

    Get UW directories Provides compatibility with both 6.3 and pre-6.3 setup

    functiongetUploadRelativeName( string $path ) : void

    Helper function for upgrade - get path from upload:// name

    Parameters
    Name Type Description
    $path string

    return string

    functiongetValidDBName(  $name,  $ensureUnique = false,  $maxLen = 30 ) : void

    Parameters
    Name Type Description
    $name
    $ensureUnique
    $maxLen
    functiongetValidPatchName(  $returnFull = true ) : void

    gets valid patch file names that exist in upload/upgrade/patch/

    Parameters
    Name Type Description
    $returnFull
    functionget_upgrade_progress( ) : void

    functionhandleExecuteSqlKeys(  $db,  $tableName,  $disable ) : void

    Parameters
    Name Type Description
    $db
    $tableName
    $disable
    functioninitialize_session_vars( ) : void

    functionisAutoOverwriteFile(  $file ) : void

    is a file that we blow away automagically

    Parameters
    Name Type Description
    $file
    functionloadSilentUpgradeVars( ) : void

    functionlogThis(  $entry,  $path = '' ) : void

    flatfile logger

    Parameters
    Name Type Description
    $entry
    $path
    functionmerge_config_si_settings( \write_to_upgrade_log $write_to_upgrade_log = false, \config_location $config_location = '', \config_si_location $config_si_location = '', \path $path = '' ) : boolean

    merge_config_si_settings This method checks for the presence of a config_si.php file and, if found, merges the configuration settings from the config_si.php file into config.php. If a config_si_location parameter value is not supplied it will attempt to discover the config_si.php file location from where the executing script was invoked.

    Parameters
    Name Type Description
    $write_to_upgrade_log \write_to_upgrade_log

    boolean optional value to write to the upgradeWizard.log file

    $config_location \config_location

    String optional value to config.php file location

    $config_si_location \config_si_location

    String optional value to config_si.php file location

    $path \path

    String file of the location of log file to write to

    Returns
    Type Description
    boolean value indicating whether or not a merge was attempted with config_si.php file
    functionmigrate_sugar_favorite_reports( ) : void

    functionparseAndExecuteSqlFile(  $sqlScript,  $forStepQuery = '',  $resumeFromQuery = '' ) : void

    Parameters
    Name Type Description
    $sqlScript
    $forStepQuery
    $resumeFromQuery
    functionpost_install_progress(  $progArray = '',  $action = '' ) : void

    Parameters
    Name Type Description
    $progArray
    $action
    functionpreLicenseCheck( ) : void

    functionpreflightCheck( ) : void

    functionprepSystemForUpgrade( ) : void

    functionprintAlterTableSql(  $tables ) : void

    Parameters
    Name Type Description
    $tables
    functionrebuildSprites(  $fromUpgrade = true ) : void

    Parameters
    Name Type Description
    $fromUpgrade
    functionrecursive_empty_or_remove_directory(  $directory,  $exclude_dirs = null,  $exclude_files = null,  $empty = TRUE ) : void

    Parameters
    Name Type Description
    $directory
    $exclude_dirs
    $exclude_files
    $empty
    functionremoveFileFromPath(  $file,  $path,  $deleteNot = array() ) : void

    Parameters
    Name Type Description
    $file
    $path
    $deleteNot
    functionremoveMd5MatchingFiles(  $deleteNot = array() ) : void

    Parameters
    Name Type Description
    $deleteNot
    functionremoveSilentUpgradeVarsCache( ) : void

    functionrepairDBForUpgrade(  $execute = false,  $path = '' ) : void

    Parameters
    Name Type Description
    $execute
    $path
    functionrepairSearchFields( \$globString $globString = 'modules/*/metadata/SearchFields.php', \$path $path = '' ) : void

    repairSearchFields

    This method goes through the list of SearchFields files based and calls TemplateRange::repairCustomSearchFields method on the files in an attempt to ensure the range search attributes are properly set in SearchFields.php.

    Parameters
    Name Type Description
    $globString \$globString

    String value used for glob search defaults to searching for all SearchFields.php files in modules directory

    $path \$path

    String value used to point to log file should logging be required. Defaults to empty.

    functionrepairUpgradeHistoryTable( ) : void

    repairUpgradeHistoryTable

    This is a helper function used in the upgrade process to fix upgrade_history entries so that the filename column points to the new upload directory location introduced in 6.4 versions

    functionrepair_long_relationship_names(  $path = '' ) : void

    Parameters
    Name Type Description
    $path
    functionresetUwSession( ) : void

    unset's UW's Session Vars

    functionsetSilentUpgradeVar(  $var,  $value ) : void

    Parameters
    Name Type Description
    $var
    $value
    functionset_upgrade_progress(  $currStep,  $currState,  $currStepSub = '',  $currStepSubState = '' ) : void

    Parameters
    Name Type Description
    $currStep
    $currState
    $currStepSub
    $currStepSubState
    functionset_upgrade_vars( ) : void

    functiontestPermsAlterTableAdd(  $db,  $out,  $skip = false ) : void

    test perms for ALTER TABLE ADD COLUMN

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestPermsAlterTableChange(  $db,  $out,  $skip = false ) : void

    test perms for ALTER TABLE ADD COLUMN

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestPermsAlterTableDrop(  $db,  $out,  $skip = false ) : void

    test perms for ALTER TABLE DROP COLUMN

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestPermsCreate(  $db,  $out ) : void

    test perms for CREATE queries

    Parameters
    Name Type Description
    $db
    $out
    functiontestPermsDelete(  $db,  $out,  $skip = false ) : void

    test perms for DELETE

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestPermsDropTable(  $db,  $out,  $skip = false ) : void

    test perms for DROP TABLE

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestPermsInsert(  $db,  $out,  $skip = false ) : void

    test perms for INSERT

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestPermsSelect(  $db,  $out,  $skip = false ) : void

    test perms for SELECT

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestPermsUpdate(  $db,  $out,  $skip = false ) : void

    test perms for UPDATE TABLE

    Parameters
    Name Type Description
    $db
    $out
    $skip
    functiontestThis( ) : void

    functiontestThis2(  $dir,  $id = 0,  $hide = false ) : void

    Parameters
    Name Type Description
    $dir
    $id
    $hide
    functiontestThis3(  $files,  $id,  $hide,  $previousPath = '' ) : void

    Parameters
    Name Type Description
    $files
    $id
    $hide
    $previousPath
    functiontestThis4(  $filePath,  $fileNodes = array(),  $fileName = '' ) : void

    Parameters
    Name Type Description
    $filePath
    $fileNodes
    $fileName
    functionunlinkUWTempFiles( ) : void

    deletes files created by unzipping a package

    functionunlinkUpgradeFiles( \$version $version ) : void

    unlinkUpgradeFiles This is a helper function to clean up

    Parameters
    Name Type Description
    $version \$version

    String value of current system version (pre upgrade)

    functionunlinkUploadFiles( ) : void

    functionupdateQuickCreateDefs( ) : void

    Details
    Author
    : nsingh  
    Desc
    This function is to be used in the upgrade process to preserve changes/customaizations made to pre 5.1 quickcreate layout. Prior to 5.1 we have been using editviewdefs as the base for quickcreatedefs. If a custom field was added to edit view layout, it was automatically picked up by the quick create. [Addresses Bug 21469] This function will check if customizations were made, and will create quickcreatedefs.php in the /cutom/working/$module_name directory.  
    Params
    : none  
    functionupdateVersions(  $version ) : bool

    finalizes upgrade by setting upgrade versions in DB (config table) and sugar_version.php

    Parameters
    Name Type Description
    $version
    Returns
    Type Description
    bool true on success
    functionupdate_iframe_dashlets( ) : void

    functionupgradeDashletsForSalesAndMarketing( ) : void

    upgradeDashletsForSalesAndMarketing

    functionupgradeDateTimeFields( \path $path ) : void

    upgradeDateTimeFields

    This method came from bug: 39757 where the date_end field is a date field and not a datetime field which prevents you from performing timezone offset calculations once the data has been saved.

    Parameters
    Name Type Description
    $path \path

    String location to log file, empty by default

    functionupgradeDisplayedTabsAndSubpanels( \$version $version ) : void

    upgradeDisplayedTabsAndSubpanels

    Parameters
    Name Type Description
    $version \$version

    String value of current system version (pre upgrade)

    functionupgradeDocumentTypeFields(  $path ) : void

    upgradeDocumentTypeFields

    Parameters
    Name Type Description
    $path
    functionupgradeEnableInsideViewConnector(  $path = '' ) : void

    Enable the InsideView connector for the four default modules.

    Parameters
    Name Type Description
    $path
    functionupgradeFolderSubscriptionsTeamSetId( ) : void

    Update the folder subscription table which confirms to the team security mechanism but the class SugarFolders does not extend SugarBean and is therefore never picked up by the upgradeModulesForTeamsets function.

    functionupgradeLocaleNameFormat( \$name_format $name_format ) : bool

    Checks if a locale name format is part of the default list, if not adds it to the config

    Parameters
    Name Type Description
    $name_format \$name_format

    string a local name format string such as 's f l'

    Returns
    Type Description
    bool true on successful write to config file, false on failure;
    functionupgradeModulesForTeam( ) : void

    upgradeModulesForTeam

    This method update the associated_user_id, name, name_2 to the private team records on teams table This function is used for upgrade process from 5.1.x and 5.2.x.

    functionupgradeModulesForTeamsets( \filter $filter = array() ) : void

    upgradeModulesForTeamsets

    This method adds the team_set_id values to the module tables that have the new team_set_id column added through the SugarCRM 5.5.x upgrade process. It also adds the values into the team_sets and team_sets_teams tables.

    Parameters
    Name Type Description
    $filter \filter

    Array of modules to process; empty by default

    functionupgradeSugarCache(  $file ) : void

    change from using the older SugarCache in 6.1 and below to the new one in 6.2

    Parameters
    Name Type Description
    $file
    functionupgradeTeamColumn( \$bean $bean, \$column_name $column_name ) : void

    upgradeTeamColumn Helper function to create a team_set_id column and also set team_set_id column to have the value of the $column_name parameter

    Parameters
    Name Type Description
    $bean \$bean

    SugarBean which we are adding team_set_id column to

    $column_name \$column_name

    The name of the column containing the default team_set_id value

    functionupgradeUWFiles( \$file $file ) : void

    upgradeUWFiles This function copies upgrade wizard files from new patch if that dir exists

    Parameters
    Name Type Description
    $file \$file

    String path to uploaded zip file

    functionupgradeUWFilesCopy( array $allFiles, string $from_dir ) : void

    upgradeUWFilesCopy

    This function recursively copies files from the upgradeUWFiles Array

    Parameters
    Name Type Description
    $allFiles array

    Array of files to copy over after zip file has been uploaded

    $from_dir string

    Source directory

    Details
    See
    \upgradeUWFiles  
    functionupgradeUserPreferences( ) : void

    upgradeUserPreferences This method updates the user_preferences table and sets the pages/dashlets for users which have ACL access to Trackers so that the Tracker dashlets are set in their user perferences

    functionupgrade_connectors( ) : void

    upgrade_connectors

    This function handles support for upgrading connectors it is invoked from both end.php and silentUpgrade_step2.php

    functionuwFindAllFiles( string $dir, array $theArray, bool $includeDirs = false,  $skipDirs = array(),  $echo = false ) : void

    finds all files in the passed path, but skips select directories

    Parameters
    Name Type Description
    $dir string

    dir Relative path

    $theArray array

    the_array Collections of found files/dirs

    $includeDirs bool

    include_dir True if we want to include directories in the returned collection

    $skipDirs
    $echo
    functionvalidate_manifest( array $manifest ) : string

    Verifies a manifest from a patch or module to be compatible with the current Sugar version and flavor

    Parameters
    Name Type Description
    $manifest array

    manifest Standard manifest array

    Returns
    Type Description
    string Error message, blank on success
    functionwhetherNeedToSkipDir( string $dir, array $skipDirs ) : boolean

    Whether directory exists within list of directories to skip

    Parameters
    Name Type Description
    $dir string

    dir to be checked

    $skipDirs array

    list with skipped dirs

    Returns
    Type Description
    boolean
    functionwriteSilentUpgradeVars( ) : void

    Documentation was generated by DocBlox 0.18.1.