modules/UpgradeWizard/uw_utils.php
Functions
add_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
checkFiles(
array $files, $echo
=
false
)
:
string
checks files for permissions
Name | Type | Description |
---|---|---|
$files | array | files Array of files with absolute paths |
$echo |
Type | Description |
---|---|
string | result of check |
checkSystemCompliance(
)
:
array
checks system compliance for 4.5+ codebase
Type | Description |
---|---|
array | Mixed values |
clearHelpFiles(
)
:
void
clearHelpFiles This method attempts to delete all English inline help files.
This method was introduced by 5.5.0RC2.
commitCopyNewFiles(
string $unzip_dir, string $zip_from_dir, string $path
=
''
)
:
array
Copies files from the unzipped patch to the destination.
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. |
Type | Description |
---|---|
array | Two element array containing to $copiedFiles and $skippedFiles. |
commitHandleReminders(
array $skippedFiles, string $path
=
''
)
:
void
Handles requirements for creating reminder Tasks and Emails
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. |
commitMakeBackupFiles(
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
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. |
Type | Description |
---|---|
array | errors |
convertImageToText(
$table_name, $column_name
)
:
void
convertImageToText
Name | Type | Description |
---|---|---|
$table_name | ||
$column_name |
- 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.
copyRecursiveBetweenDirectories(
string $from, boolean $to
)
:
boolean
This function copies/overwrites between directories
Name | Type | Description |
---|---|---|
$from | string | the directory name to remove |
$to | boolean | whether to just empty the given directory, without deleting the given directory. |
Type | Description |
---|---|
boolean | True/False whether the directory was deleted. |
deleteAndOverWriteSelectedFiles(
$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.
Name | Type | Description |
---|---|---|
$unzip_dir | ||
$zip_from_dir | ||
$delete_dirs |
deleteDirectory(
$dirname, $only_empty
=
false
)
:
void
Name | Type | Description |
---|---|---|
$dirname | ||
$only_empty |
extractFile(
$zip_file, $file_in_zip
)
:
void
Name | Type | Description |
---|---|---|
$zip_file | ||
$file_in_zip |
fix_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.
fix_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.
Name | Type | Description |
---|---|---|
$path | \$path | String variable for the log path |
getAllModules(
)
:
\$modules
Array of all Modules in the version bein upgraded This method returns an Array of all modules
Type | Description |
---|---|
\$modules | Array of modules. |
getFilesForPermsCheck(
)
:
array
generates an array with all files in the SugarCRM root directory, skipping cache/
Type | Description |
---|---|
array | files Array of files with absolute paths |
getModuleLanguagePack(
\lang $lang, \module $module
)
:
array
gets a module's lang pack - does not need to be a SugarModule
Name | Type | Description |
---|---|---|
$lang | \lang | string Language |
$module | \module | string Path to language folder |
Type | Description |
---|---|
array | mod_strings |
getTableFromQuery(
string $query
)
:
string
parses a query finding the table name
Name | Type | Description |
---|---|---|
$query | string | query The query |
Type | Description |
---|---|
string | table The table |
getUploadRelativeName(
string $path
)
:
void
Helper function for upgrade - get path from upload:// name
Name | Type | Description |
---|---|---|
$path | string | return string |
getValidDBName(
$name, $ensureUnique
=
false, $maxLen
=
30
)
:
void
Name | Type | Description |
---|---|---|
$name | ||
$ensureUnique | ||
$maxLen |
getValidPatchName(
$returnFull
=
true
)
:
void
gets valid patch file names that exist in upload/upgrade/patch/
Name | Type | Description |
---|---|---|
$returnFull |
handleExecuteSqlKeys(
$db, $tableName, $disable
)
:
void
Name | Type | Description |
---|---|---|
$db | ||
$tableName | ||
$disable |
isAutoOverwriteFile(
$file
)
:
void
is a file that we blow away automagically
Name | Type | Description |
---|---|---|
$file |
merge_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.
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 |
Type | Description |
---|---|
boolean | value indicating whether or not a merge was attempted with config_si.php file |
parseAndExecuteSqlFile(
$sqlScript, $forStepQuery
=
'', $resumeFromQuery
=
''
)
:
void
Name | Type | Description |
---|---|---|
$sqlScript | ||
$forStepQuery | ||
$resumeFromQuery |
post_install_progress(
$progArray
=
'', $action
=
''
)
:
void
Name | Type | Description |
---|---|---|
$progArray | ||
$action |
recursive_empty_or_remove_directory(
$directory, $exclude_dirs
=
null, $exclude_files
=
null, $empty
=
TRUE
)
:
void
Name | Type | Description |
---|---|---|
$directory | ||
$exclude_dirs | ||
$exclude_files | ||
$empty |
removeFileFromPath(
$file, $path, $deleteNot
=
array()
)
:
void
Name | Type | Description |
---|---|---|
$file | ||
$path | ||
$deleteNot |
repairDBForUpgrade(
$execute
=
false, $path
=
''
)
:
void
Name | Type | Description |
---|---|---|
$execute | ||
$path |
repairSearchFields(
\$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.
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. |
repairUpgradeHistoryTable(
)
:
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
set_upgrade_progress(
$currStep, $currState, $currStepSub
=
'', $currStepSubState
=
''
)
:
void
Name | Type | Description |
---|---|---|
$currStep | ||
$currState | ||
$currStepSub | ||
$currStepSubState |
testPermsAlterTableAdd(
$db, $out, $skip
=
false
)
:
void
test perms for ALTER TABLE ADD COLUMN
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testPermsAlterTableChange(
$db, $out, $skip
=
false
)
:
void
test perms for ALTER TABLE ADD COLUMN
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testPermsAlterTableDrop(
$db, $out, $skip
=
false
)
:
void
test perms for ALTER TABLE DROP COLUMN
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testPermsCreate(
$db, $out
)
:
void
test perms for CREATE queries
Name | Type | Description |
---|---|---|
$db | ||
$out |
testPermsDelete(
$db, $out, $skip
=
false
)
:
void
test perms for DELETE
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testPermsDropTable(
$db, $out, $skip
=
false
)
:
void
test perms for DROP TABLE
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testPermsInsert(
$db, $out, $skip
=
false
)
:
void
test perms for INSERT
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testPermsSelect(
$db, $out, $skip
=
false
)
:
void
test perms for SELECT
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testPermsUpdate(
$db, $out, $skip
=
false
)
:
void
test perms for UPDATE TABLE
Name | Type | Description |
---|---|---|
$db | ||
$out | ||
$skip |
testThis3(
$files, $id, $hide, $previousPath
=
''
)
:
void
Name | Type | Description |
---|---|---|
$files | ||
$id | ||
$hide | ||
$previousPath |
testThis4(
$filePath, $fileNodes
=
array(), $fileName
=
''
)
:
void
Name | Type | Description |
---|---|---|
$filePath | ||
$fileNodes | ||
$fileName |
unlinkUpgradeFiles(
\$version $version
)
:
void
unlinkUpgradeFiles This is a helper function to clean up
Name | Type | Description |
---|---|---|
$version | \$version | String value of current system version (pre upgrade) |
updateQuickCreateDefs(
)
:
void
- 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
updateVersions(
$version
)
:
bool
finalizes upgrade by setting upgrade versions in DB (config table) and sugar_version.php
Name | Type | Description |
---|---|---|
$version |
Type | Description |
---|---|
bool | true on success |
upgradeDateTimeFields(
\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.
Name | Type | Description |
---|---|---|
$path | \path | String location to log file, empty by default |
upgradeDisplayedTabsAndSubpanels(
\$version $version
)
:
void
upgradeDisplayedTabsAndSubpanels
Name | Type | Description |
---|---|---|
$version | \$version | String value of current system version (pre upgrade) |
upgradeDocumentTypeFields(
$path
)
:
void
upgradeDocumentTypeFields
Name | Type | Description |
---|---|---|
$path |
upgradeEnableInsideViewConnector(
$path
=
''
)
:
void
Enable the InsideView connector for the four default modules.
Name | Type | Description |
---|---|---|
$path |
upgradeFolderSubscriptionsTeamSetId(
)
:
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.
upgradeLocaleNameFormat(
\$name_format $name_format
)
:
bool
Checks if a locale name format is part of the default list, if not adds it to the config
Name | Type | Description |
---|---|---|
$name_format | \$name_format | string a local name format string such as 's f l' |
Type | Description |
---|---|
bool | true on successful write to config file, false on failure; |
upgradeModulesForTeam(
)
:
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.
upgradeModulesForTeamsets(
\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.
Name | Type | Description |
---|---|---|
$filter | \filter | Array of modules to process; empty by default |
upgradeSugarCache(
$file
)
:
void
change from using the older SugarCache in 6.1 and below to the new one in 6.2
Name | Type | Description |
---|---|---|
$file |
upgradeTeamColumn(
\$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
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 |
upgradeUWFiles(
\$file $file
)
:
void
upgradeUWFiles This function copies upgrade wizard files from new patch if that dir exists
Name | Type | Description |
---|---|---|
$file | \$file | String path to uploaded zip file |
upgradeUWFilesCopy(
array $allFiles, string $from_dir
)
:
void
upgradeUWFilesCopy
This function recursively copies files from the upgradeUWFiles Array
Name | Type | Description |
---|---|---|
$allFiles | array | Array of files to copy over after zip file has been uploaded |
$from_dir | string | Source directory |
- See
- \upgradeUWFiles
upgradeUserPreferences(
)
:
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
upgrade_connectors(
)
:
void
upgrade_connectors
This function handles support for upgrading connectors it is invoked from both end.php and silentUpgrade_step2.php
uwFindAllFiles(
string $dir, array $theArray, bool $includeDirs
=
false, $skipDirs
=
array(), $echo
=
false
)
:
void
finds all files in the passed path, but skips select directories
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 |
validate_manifest(
array $manifest
)
:
string
Verifies a manifest from a patch or module to be compatible with the current Sugar version and flavor
Name | Type | Description |
---|---|---|
$manifest | array | manifest Standard manifest array |
Type | Description |
---|---|
string | Error message, blank on success |
whetherNeedToSkipDir(
string $dir, array $skipDirs
)
:
boolean
Whether directory exists within list of directories to skip
Name | Type | Description |
---|---|---|
$dir | string | dir to be checked |
$skipDirs | array | list with skipped dirs |
Type | Description |
---|---|
boolean |