Example #1
0
/**
*   This method will look for a file modules_post_install.php in the root directory and based on the
*   contents of this file, it will silently install any modules as specified in this array.
*/
function post_install_modules()
{
    if (is_file('modules_post_install.php')) {
        global $current_user, $mod_strings;
        $current_user = new User();
        $current_user->is_admin = '1';
        require_once 'ModuleInstall/PackageManager/PackageManager.php';
        require_once 'modules_post_install.php';
        //we now have the $modules_to_install array in memory
        $pm = new PackageManager();
        $old_mod_strings = $mod_strings;
        foreach ($modules_to_install as $module_to_install) {
            if (is_file($module_to_install)) {
                $pm->performSetup($module_to_install, 'module', false);
                $file_to_install = sugar_cached('upload/upgrades/module/') . basename($module_to_install);
                $_REQUEST['install_file'] = $file_to_install;
                $pm->performInstall($file_to_install);
            }
        }
        $mod_strings = $old_mod_strings;
    }
}
Example #2
0
 case 'upload':
     logThis('running upload');
     $perform = false;
     $tempFile = '';
     if (isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != "") {
         require_once 'ModuleInstall/PackageManager/PackageManager.php';
         $pm = new PackageManager();
         $tempFile = '';
         $perform = false;
         if (!empty($_SESSION['ML_PATCHES'])) {
             $release_map = $_SESSION['ML_PATCHES'][$_REQUEST['release_id']];
             if (!empty($release_map)) {
                 $tempFile = $pm->download($release_map['category_id'], $release_map['package_id'], $_REQUEST['release_id'], getcwd() . '/' . $sugar_config['upload_dir']);
                 $perform = true;
                 if ($release_map['type'] != 'patch') {
                     $pm->performSetup($tempFile, $release_map['type'], false);
                     header('Location: index.php?module=Administration&action=UpgradeWizard&view=module');
                 }
             }
         }
         $base_filename = urldecode($tempFile);
     } else {
         if (empty($_FILES['upgrade_zip']['tmp_name'])) {
             logThis('ERROR: no file uploaded!');
             echo $mod_strings['ERR_UW_NO_FILE_UPLOADED'];
             // add PHP error if isset
             if (isset($_FILES['upgrade_zip']['error']) && !empty($_FILES['upgrade_zip']['error'])) {
                 $out = "<b><span class='error'>{$mod_strings['ERR_UW_PHP_FILE_ERRORS'][$_FILES['upgrade_zip']['error']]}</span></b><br />";
             }
         } else {
             if (!move_uploaded_file($_FILES['upgrade_zip']['tmp_name'], getcwd() . '/' . $sugar_config['upload_dir'] . $_FILES['upgrade_zip']['name'])) {