示例#1
0
/**
 * does post-post-install stuff
 * @param array persistence
 * @return array persistence
 */
function commitAjaxFinalTouches($persistence)
{
    global $current_user;
    global $timedate;
    global $mod_strings;
    global $sugar_version;
    if (empty($sugar_version)) {
        require 'sugar_version.php';
    }
    // convert to UTF8 if needed
    if (!empty($persistence['allTables'])) {
        executeConvertTablesSql($persistence['allTables']);
    }
    // rebuild
    logThis('Performing UWrebuild()...');
    UWrebuild();
    logThis('UWrebuild() done.');
    // upgrade history
    registerUpgrade($persistence);
    // flag to say upgrade has completed
    $persistence['upgrade_complete'] = true;
    // reminders if needed
    ///////////////////////////////////////////////////////////////////////////////
    ////	HANDLE REMINDERS
    if (count($persistence['skipped_files']) > 0) {
        $desc = $mod_strings['LBL_UW_COMMIT_ADD_TASK_OVERVIEW'] . "\n\n";
        $desc .= $mod_strings['LBL_UW_COMMIT_ADD_TASK_DESC_1'];
        $desc .= $persistence['uw_restore_dir'] . "\n\n";
        $desc .= $mod_strings['LBL_UW_COMMIT_ADD_TASK_DESC_2'] . "\n\n";
        foreach ($persistence['skipped_files'] as $file) {
            $desc .= $file . "\n";
        }
        //MFH #13468
        $nowDate = $timedate->nowDbDate();
        $nowTime = $timedate->asDbTime($timedate->getNow());
        $nowDateTime = $nowDate . ' ' . $nowTime;
        if ($_REQUEST['addTaskReminder'] == 'remind') {
            logThis('Adding Task for admin for manual merge.');
            $task = new Task();
            $task->name = $mod_strings['LBL_UW_COMMIT_ADD_TASK_NAME'];
            $task->description = $desc;
            $task->date_due = $nowDate;
            $task->time_due = $nowTime;
            $task->priority = 'High';
            $task->status = 'Not Started';
            $task->assigned_user_id = $current_user->id;
            $task->created_by = $current_user->id;
            $task->date_entered = $nowDateTime;
            $task->date_modified = $nowDateTime;
            $task->save();
        }
        if ($_REQUEST['addEmailReminder'] == 'remind') {
            logThis('Sending Reminder for admin for manual merge.');
            $email = new Email();
            $email->assigned_user_id = $current_user->id;
            $email->name = $mod_strings['LBL_UW_COMMIT_ADD_TASK_NAME'];
            $email->description = $desc;
            $email->description_html = nl2br($desc);
            $email->from_name = $current_user->full_name;
            $email->from_addr = $current_user->email1;
            $email->to_addrs_arr = $email->parse_addrs($current_user->email1, '', '', '');
            $email->cc_addrs_arr = array();
            $email->bcc_addrs_arr = array();
            $email->date_entered = $nowDateTime;
            $email->date_modified = $nowDateTime;
            $email->send();
            $email->save();
        }
    }
    ////	HANDLE REMINDERS
    ///////////////////////////////////////////////////////////////////////////////
    // clean up
    unlinkUWTempFiles();
    ob_start();
    echo 'done';
    ob_flush();
    return $persistence;
}
         include $file;
         post_install();
         // cn: only run conversion if admin selects "Sugar runs SQL"
         if (!empty($_SESSION['allTables']) && $_SESSION['schema_change'] == 'sugar') {
             executeConvertTablesSql($_SESSION['allTables']);
         }
         //set process to done
         $progArray['post_install'] = 'done';
         //set_upgrade_progress('commit','in_progress','post_install','done');
         post_install_progress($progArray, 'set');
     }
 }
 //clean vardefs
 logThis('Performing UWrebuild()...', $path);
 ob_start();
 @UWrebuild();
 ob_end_clean();
 logThis('UWrebuild() done.', $path);
 logThis('begin check default permissions .', $path);
 checkConfigForPermissions();
 logThis('end check default permissions .', $path);
 logThis('begin check logger settings .', $path);
 checkLoggerSettings();
 logThis('begin check logger settings .', $path);
 logThis('begin check lead conversion settings .', $path);
 checkLeadConversionSettings();
 logThis('end check lead conversion settings .', $path);
 logThis('begin check resource settings .', $path);
 checkResourceSettings();
 logThis('begin check resource settings .', $path);
 require "sugar_version.php";