Exemplo n.º 1
0
 if((count($errors) == 1)) { // only diffs
 	logThis('file preflight check passed successfully.', $path);
 }
 else{
 	fwrite(STDERR,"\nThe user doesn't have sufficient permissions to write to database'.\n\n");
 	exit(1);
 }
 */
 //If version less than 500 then look for modules to be upgraded
 if (function_exists('set_upgrade_vars')) {
     set_upgrade_vars();
 }
 //Initialize the session variables. If upgrade_progress.php is already created
 //look for session vars there and restore them
 if (function_exists('initialize_session_vars')) {
     initialize_session_vars();
 }
 if (!didThisStepRunBefore('preflight')) {
     set_upgrade_progress('preflight', 'in_progress');
     //Quickcreatedefs on the basis of editviewdefs
     if (substr($sugar_version, 0, 1) >= 5) {
         updateQuickCreateDefs();
     }
     set_upgrade_progress('preflight', 'done');
 }
 ////////////////COMMIT PROCESS BEGINS///////////////////////////////////////////////////////////////
 ////	MAKE BACKUPS OF TARGET FILES
 if (!didThisStepRunBefore('commit')) {
     set_upgrade_progress('commit', 'in_progress', 'commit', 'in_progress');
     if (!didThisStepRunBefore('commit', 'commitMakeBackupFiles')) {
         set_upgrade_progress('commit', 'in_progress', 'commitMakeBackupFiles', 'in_progress');
function post_install()
{
    global $unzip_dir;
    global $sugar_config;
    global $sugar_version;
    global $path;
    global $_SESSION;
    if (!isset($_SESSION['sqlSkippedQueries'])) {
        $_SESSION['sqlSkippedQueries'] = array();
    }
    initialize_session_vars();
    if (!isset($unzip_dir) || $unzip_dir == null) {
        $unzip_dir = $_SESSION['unzip_dir'];
    }
    _logThis('Entered post_install function.', $path);
    $self_dir = "{$unzip_dir}/scripts";
    ///////////////////////////////////////////////////////////////////////////
    ////	PUT DATABASE UPGRADE SCRIPT HANDLING HERE
    $new_sugar_version = getUpgradeVersion();
    $post_action = status_post_install_action('sql_query');
    if ($post_action != null) {
        if ($post_action != 'done') {
            //continue from where left in previous run
            runSqlFiles($sugar_version, $new_sugar_version, 'sql_query', $post_action);
            $currProg['sql_query'] = 'done';
            post_install_progress($currProg, 'set');
        }
    } else {
        //never ran before
        runSqlFiles($sugar_version, $new_sugar_version, 'sql_query');
        $currProg['sql_query'] = 'done';
        post_install_progress($currProg, 'set');
    }
    genericFunctions();
    upgradeDbAndFileVersion($new_sugar_version);
    //Remove jssource/src_files sub-directories if they still exist
    $jssource_dirs = array('jssource/src_files/include/javascript/ext-2.0', 'jssource/src_files/include/javascript/ext-1.1.1', 'jssource/src_files/include/javascript/yui');
    foreach ($jssource_dirs as $js_dir) {
        if (file_exists($js_dir)) {
            _logThis("Remove {$js_dir} directory");
            rmdir_recursive($js_dir);
            _logThis("Finished removing {$js_dir} directory");
        }
    }
}