/**
  * Update a provisioning record
  */
 public function update(ProvisioningRequest $request, Provisioning $provisioning)
 {
     $provisioning->update($request->all());
     $this->dispatch(new RewriteDhcpConfig());
     logThis('Provisioning event: ' . $provisioning->customer->name . ' was reprovisioned to ' . $provisioning->ontconfig->software->ont->model . '/' . $provisioning->ontconfig->software->version . '/' . $provisioning->ontconfig->name . ' on ' . $provisioning->access_switch_port->nice_name);
     return $provisioning;
 }
 /**
  * Handle the event.
  *
  * @param  AccessSwitchSlotWasModified  $event
  * @return void
  */
 public function handle(SlotModuleWasChanged $event)
 {
     $original_slot_module = $event->access_switch_slot;
     $new_slot_module = AccessSwitchSlot::findOrFail($original_slot_module->id);
     $originalPortCount = $original_slot_module->module_type->number_of_ports;
     $originalModuleType = $original_slot_module->module_type->name;
     $newPortCount = $new_slot_module->module_type->number_of_ports;
     $newModuleType = $new_slot_module->module_type->name;
     $switchName = $new_slot_module->access_switch->name;
     $slotNumber = $new_slot_module->slot_number;
     if ($original_slot_module->module_type->empty_slot) {
         // If the original state was empty, we only need to add ports
         for ($port_number = 1; $port_number <= $newPortCount; $port_number++) {
             $new_slot_module->ports()->create(['port_number' => $port_number]);
         }
         logThis($newModuleType . ' added to ' . $switchName . ' slot ' . $slotNumber);
     } else {
         // First remove any ports associated with the slot
         foreach ($original_slot_module->ports as $port) {
             $port->delete();
         }
         // Now add the new ports
         if ($new_slot_module->module_type->empty_slot) {
             logThis($originalModuleType . ' removed from ' . $switchName . ' slot ' . $slotNumber);
         } else {
             for ($port_number = 1; $port_number <= $newPortCount; $port_number++) {
                 $new_slot_module->ports()->create(['port_number' => $port_number]);
             }
         }
         logThis($originalModuleType . ' removed from ' . $switchName . ' slot ' . $slotNumber . ' and replaced with ' . $newModuleType);
     }
 }
/**
 * upgrade wizard logging
 */
function _logThis($entry)
{
    if (function_exists('logThis')) {
        logThis($entry);
    } else {
        $log = clean_path(getcwd() . '/upgradeWizard.log');
        // create if not exists
        if (!file_exists($log)) {
            $fp = fopen($log, 'w+');
            // attempts to create file
            if (!is_resource($fp)) {
                $GLOBALS['log']->fatal('UpgradeWizard could not create the upgradeWizard.log file');
            }
        } else {
            $fp = fopen($log, 'a+');
            // write pointer at end of file
            if (!is_resource($fp)) {
                $GLOBALS['log']->fatal('UpgradeWizard could not open/lock upgradeWizard.log file');
            }
        }
        $line = date('r') . ' [UpgradeWizard] - ' . $entry . "\n";
        if (fwrite($fp, $line) === false) {
            $GLOBALS['log']->fatal('UpgradeWizard could not write to upgradeWizard.log: ' . $entry);
        }
        fclose($fp);
    }
}
 /**
  * API to update a doc
  */
 public function apiUpdateDoc(GadocRequest $request, Gadoc $gadoc)
 {
     logThis(auth()->user()->name . ' modified ' . $gadoc->title);
     $gadoc->backup(auth()->user()->name);
     $gadoc->update($request->all());
     return $gadoc;
 }
Example #5
0
 public function tearDown()
 {
     global $sugar_config, $sugar_version, $mod_strings;
     if (file_exists($this->loc->invalidNameFormatUpgradeFilename)) {
         unlink($this->loc->invalidNameFormatUpgradeFilename);
     }
     if (file_exists($this->loc->invalidNameFormatUpgradeFilename . '.backup')) {
         rename($this->loc->invalidNameFormatUpgradeFilename . '.backup', $this->loc->invalidNameFormatUpgradeFilename);
     }
     unset($this->loc);
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($this->user);
     unset($GLOBALS['current_user']);
     $sugar_config = $this->backupConfig;
     if (!rebuildConfigFile($sugar_config, $sugar_version)) {
         logThis('*** ERROR: could not write config.php!');
         $errors[] = $mod_strings['ERR_UW_CONFIG_WRITE'];
     }
     unset($this->backupSystemLocaleNameFormat);
     unset($sugar_config);
     unset($sugar_version);
     unset($mod_strings);
     unset($app_strings);
     unset($app_list_strings);
     unset($locale);
     unset($_REQUEST);
 }
 /**
  * Update the admin settings
  */
 public function update(AdminSettingsRequest $request, AdminSetting $admin_settings)
 {
     $admin_settings_before_update = clone $admin_settings;
     $admin_settings->update($request->all());
     logThis('Admin settings change. BEFORE: ' . $admin_settings_before_update . ' AFTER ' . $admin_settings);
     return $admin_settings;
 }
 /**
  * API to store a new reply
  */
 public function apiStoreReply(ReplyRequest $request, Post $post)
 {
     logThis(auth()->user()->name . ' replied to ' . $post->title);
     $request->merge(['user_id' => auth()->user()->id]);
     $reply = $post->replies()->create($request->all());
     return $reply;
 }
 /**
  * Assign permissions to user
  */
 public function updateRoles(Request $request, User $user)
 {
     $roles = $request->checkedRoles ?: [];
     // $roles = array of submitted roles OR if all checkboxes were unchecked, make it an empty array
     $user->roles()->sync($roles);
     logThis('Roles for ' . $user->name . ' changed to ' . $user->roles()->lists('label'));
     return $user->load('roles');
 }
 /**
  * Delete a shared network
  */
 public function destroy(DhcpSharedNetwork $dhcp_shared_network)
 {
     $dhcp_shared_network->delete();
     flash()->info('Deleted', 'Shared Network ' . $dhcp_shared_network->name . ' was deleted.');
     logThis('DHCP Shared Network ' . $dhcp_shared_network->name . ' was deleted.');
     $this->dispatch(new RewriteDhcpConfig());
     return redirect()->route('dhcp.index');
 }
 /**
  * Delete a customer
  */
 public function delete(Customer $customer)
 {
     logThis('Customer Deleted: ' . $customer->name . ' was deleted.');
     $this->dispatch(new RemoveFromMonitoring($customer));
     $customer->delete();
     $this->dispatch(new RewriteDhcpConfig());
     return $customer;
 }
Example #11
0
 /**
  * Assign permissions to role
  */
 public function updatePermissions(Request $request, Role $role)
 {
     $permissions = $request->checkedPermissions ?: [];
     // $permissions = array of submitted permissions OR if all checkboxes were unchecked, make it an empty array
     $role->permissions()->sync($permissions);
     logThis('Permissions for ' . $role->label . ' changed to ' . $role->permissions()->lists('label'));
     return $role->load('permissions');
 }
 /**
  * Store a new App\Post
  */
 public function store(PostRequest $request)
 {
     logThis(auth()->user()->name . ' created a new post called ' . $request->title);
     $post = auth()->user()->posts()->create($request->all());
     if ($request->hasFile('myfiles')) {
         $post->addFiles($request->file('myfiles'));
     }
     flash()->success('Created!', $post->title . ' has been created.');
     return redirect()->route('posts.index');
 }
 /**
  * Delete a user
  */
 public function deleteUser(Request $request, User $user)
 {
     if (auth()->user()->id == $user->id) {
         flash()->error('You can not delete yourself', 'Have some self respect.');
         return redirect()->back();
     }
     logThis('User ' . $user->name . ' was deleted by ' . auth()->user()->name);
     flash()->success('Success!', 'User ' . $user->name . ' was deleted.');
     $user->delete();
     return redirect()->back();
 }
Example #14
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $requiredPermission)
 {
     if (env('DISABLE_AUTHORIZATION') == true) {
         return $next($request);
     }
     if (!$request->user()->can($requiredPermission)) {
         logThis(auth()->user()->email . ' tried to access ' . $request->url() . ', but does not have permission to do so.');
         flash()->error('Bad Robot!', 'You do not have access to that.');
         return redirect('/');
     }
     return $next($request);
 }
 /**
  * This method copies the dhcpd.conf file from storage and then restarts dhcp
  */
 public function deployDhcpConfig()
 {
     logThis('Deploying dhcpd.conf');
     // The next three lines copies the local dhcpd.conf to the server
     $localFile = storage_path() . '/app/dhcp/dhcpd.conf';
     $remotePath = '/etc/dhcp/dhcpd.conf';
     \SSH::into('dhcp_server')->put($localFile, $remotePath);
     logThis('New dhcpd.conf copied to dhcp server at ' . env('DHCP_SERVER'));
     // Now let's restart dhcp
     \SSH::into('dhcp_server')->run(['service isc-dhcp-server restart']);
     logThis('isc-dhcp-server restarted on dhcp server at ' . env('DHCP_SERVER'));
 }
Example #16
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $requestTime = $_SERVER['REQUEST_TIME'];
     $queuedForSuspend = SuspendQueue::whereAction(1)->get();
     foreach ($queuedForSuspend as $job) {
         $provisioningRecord = Provisioning::findOrFail($job->provisioning_id);
         $disable = $provisioningRecord->disableUserPorts();
         if ($disable == '0') {
             logThis('GASuspendQueueRun: ONT for ' . $provisioningRecord->customer->name . ' back online. Service suspended.');
         } elseif ($disable == '1') {
             logThis('GASuspendQueueRun: ONT for ' . $provisioningRecord->customer->name . ' still offline. Re-queueing suspension.');
         } elseif ($disable == '2') {
             logThis('GASuspendQueueRun: ONT for ' . $provisioningRecord->customer->name . ' back online, but there was an error suspending service.');
         }
     }
 }
 /**
  * Handle the event.
  *
  * @param  OntConfigWasRemoved  $event
  * @return void
  */
 public function handle(OntConfigWasRemoved $event)
 {
     $config = $event->config;
     $timestamp = date('YmdHis');
     $publicPathToConfigFiles = public_path() . '/ontsoftware/' . $config->software->ont->model . '/' . $config->software->version . '/' . $config->name;
     $publicTrashFolder = public_path() . '/ontsoftware/trash/configs/' . $timestamp . '/' . $config->software->ont->model . '/' . $config->software->version . '/' . $config->name;
     $tftpPathToConfigFiles = '/tftpboot/' . $config->software->ont->model . '/' . $config->software->version . '/' . $config->name;
     $tftpTrashFolder = '/tftpboot/trash/configs/' . $timestamp . '/' . $config->software->ont->model . '/' . $config->software->version . '/' . $config->name;
     if (File::copyDirectory($publicPathToConfigFiles, $publicTrashFolder)) {
         File::deleteDirectory($publicPathToConfigFiles);
     }
     if (File::copyDirectory($tftpPathToConfigFiles, $tftpTrashFolder)) {
         File::deleteDirectory($tftpPathToConfigFiles);
     }
     logThis('Config removed: ' . $config->software->ont->model . '/' . $config->software->version . '/' . $config->name);
 }
Example #18
0
 /**
  * Handle the event.
  *
  * @param  OntWasRemoved  $event
  * @return void
  */
 public function handle(OntWasRemoved $event)
 {
     $ont = $event->ont;
     $timestamp = date('YmdHis');
     $publicPathToOnt = public_path() . '/ontsoftware/' . $ont->model;
     $publicTrashFolder = public_path() . '/ontsoftware/trash/onts/' . $timestamp . '/' . $ont->model;
     $tftpPathToOnt = '/tftpboot/' . $ont->model;
     $tftpTrashFolder = '/tftpboot/trash/onts/' . $timestamp . '/' . $ont->model;
     if (File::copyDirectory($publicPathToOnt, $publicTrashFolder)) {
         File::deleteDirectory($publicPathToOnt);
     }
     if (File::copyDirectory($tftpPathToOnt, $tftpTrashFolder)) {
         File::deleteDirectory($tftpPathToOnt);
     }
     logThis('Ont removed: ' . $ont->model);
 }
 /**
  * Handle the event.
  *
  * @param  OntSoftwareWasRemoved  $event
  * @return void
  */
 public function handle(OntSoftwareWasRemoved $event)
 {
     $software = $event->software;
     $timestamp = date('YmdHis');
     $publicPathToSoftware = public_path() . '/ontsoftware/' . $software->ont->model . '/' . $software->version;
     $publicTrashFolder = public_path() . '/ontsoftware/trash/software/' . $timestamp . '/' . $software->ont->model . '/' . $software->version;
     $tftpPathToSoftware = '/tftpboot/' . $software->ont->model . '/' . $software->version;
     $tftpTrashFolder = '/tftpboot/trash/software/' . $timestamp . '/' . $software->ont->model . '/' . $software->version;
     if (File::copyDirectory($publicPathToSoftware, $publicTrashFolder)) {
         File::deleteDirectory($publicPathToSoftware);
     }
     if (File::copyDirectory($tftpPathToSoftware, $tftpTrashFolder)) {
         File::deleteDirectory($tftpPathToSoftware);
     }
     logThis('Software removed: ' . $software->ont->model . '/' . $software->version);
 }
 /**
  * Unsuspends a customer's ONT
  */
 public function destroy(Provisioning $provisioning)
 {
     $provisioning->suspended = 0;
     $provisioning->save();
     $unsuspend = $provisioning->enableUserPorts();
     if ($unsuspend == '0') {
         flash()->overlay('Success', 'Service for this ONT has been reactivated', 'success');
     }
     if ($unsuspend == '1') {
         logThis('Queued ONT re-activation for ' . $provisioning->customer->name);
         flash()->overlay('Queued', 'Re-activation of this ONT has been queued.', 'info');
     }
     if ($unsuspend == '2') {
         flash()->overlay('Failed', 'There was an error while re-activating this ONT. Please look in Application Logs for more info', 'error');
     }
     return back();
 }
 /**
  * Handle the event.
  *
  * @param  OntConfigWasModified  $event
  * @return void
  */
 public function handle(OntConfigWasModified $event)
 {
     $originalConfigName = $event->originalConfigName;
     $config = $event->config;
     if ($originalConfigName != $config->name) {
         $originalPublicPath = public_path() . '/ontsoftware/' . $config->software->ont->model . '/' . $config->software->version . '/' . $originalConfigName;
         $newPublicPath = public_path() . '/ontsoftware/' . $config->software->ont->model . '/' . $config->software->version . '/' . $config->name;
         $originalTftpPath = '/tftpboot/' . $config->software->ont->model . '/' . $config->software->version . '/' . $originalConfigName;
         $newTftpPath = '/tftpboot/' . $config->software->ont->model . '/' . $config->software->version . '/' . $config->name;
         if (File::copyDirectory($originalPublicPath, $newPublicPath)) {
             // logThis($originalPublicPath . ' moved to ' . $newPublicPath);
             File::deleteDirectory($originalPublicPath);
         }
         if (File::copyDirectory($originalTftpPath, $newTftpPath)) {
             // logThis($originalTftpPath . ' moved to ' . $newTftpPath);
             File::deleteDirectory($originalTftpPath);
         }
     }
     logThis('Config Renamed: ' . $originalConfigName . ' renamed to ' . $config->name);
 }
Example #22
0
 /**
  * Handle the event.
  *
  * @param  AccessSwitchWasAdded  $event
  * @return void
  */
 public function handle(AccessSwitchWasAdded $event)
 {
     $access_switch = $event->access_switch;
     if ($access_switch->access_switch_type->is_chassis) {
         $number_of_slots = $access_switch->access_switch_type->number_of_slots;
         $module = $access_switch->access_switch_type->module_types()->where('empty_slot', 1)->first();
         for ($slot_number = 1; $slot_number <= $number_of_slots; $slot_number++) {
             $access_switch->slots()->create(['module_type_id' => $module->id, 'slot_number' => $slot_number]);
         }
         logThis($number_of_slots . ' empty slots created for switch ' . $access_switch->name);
     } else {
         $module = $access_switch->access_switch_type->module_types()->first();
         $slot = $access_switch->slots()->create(['module_type_id' => $module->id, 'slot_number' => 1]);
         logThis('Slot created for ' . $access_switch->name);
         // Create ports for this switch while we're at it
         $number_of_ports = $access_switch->access_switch_type->number_of_ports;
         for ($port_number = 1; $port_number <= $number_of_ports; $port_number++) {
             $slot->ports()->create(['port_number' => $port_number]);
         }
         logThis($number_of_ports . ' ports created for ' . $access_switch->name);
     }
 }
Example #23
0
function logThis($message)
{
    $logFilePath = dirname(__FILE__) . '/sitelogs/';
    $date = new DateTime();
    $myLogFile = $logFilePath . $date->format('Y-m-d') . ".log";
    if (is_dir($logFilePath)) {
        if (!file_exists($myLogFile)) {
            /* create log file with first message on new day*/
            $fh = fopen($myLogFile, 'a+') or die("Fatal Error !");
            $logcontent = "LogTime: " . $date->format('H:i:s') . "\r\nLogText: " . $message . "\r\n";
            fwrite($fh, $logcontent);
            fclose($fh);
        } else {
            /* edit/update log file with new message on same day */
            $logcontent = "LogTime: " . $date->format('H:i:s') . "\r\nLogText: " . $message . "\r\n\r\n";
            $logcontent = $logcontent . file_get_contents($myLogFile);
            file_put_contents($myLogFile, $logcontent);
        }
    } else {
        if (mkdir($logFilePath, 0777) === true) {
            logThis($message);
        }
    }
}
Example #24
0
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
 * Reserved. Contributor(s): ______________________________________..
 * *******************************************************************************/
logThis('-----------------------------------------------------------------------------');
logThis('Upgrade started. At start.php');
//set the upgrade progress status.
set_upgrade_progress('start', 'in_progress');
unlinkUWTempFiles();
resetUwSession();
if (isset($_REQUEST['showUpdateWizardMessage']) && $_REQUEST['showUpdateWizardMessage'] == true) {
    // set a flag to skip the upload screen
    $_SESSION['skip_zip_upload'] = true;
    $newUWMsg = <<<eoq
\t<table cellspacing="0" cellpadding="3" border="0">
\t\t<tr>
\t\t\t<th>
\t\t\t\t{$mod_strings['LBL_UW_START_UPGRADED_UW_TITLE']}
\t\t\t</th>
\t\t</tr>
\t\t<tr>
Example #25
0
if($_SESSION['current_db_version'] < '620')
{
	upgradeDateTimeFields($path);
	upgradeDocumentTypeFields($path);
}
*/
//Update the license
logThis('Start Updating the license ', $path);
ob_start();
check_now(get_sugarbeat());
ob_end_clean();
logThis('End Updating the license ', $path);
set_upgrade_progress('end', 'done');
logThis('Cleaning up the session.  Goodbye.');
unlinkUWTempFiles();
logThis('Cleaning up the session.  Goodbye.');
resetUwSession();
// flag to say upgrade has completed
$_SESSION['upgrade_complete'] = true;
//Clear any third party caches
sugar_cache_reset_full();
//add the clean vardefs here
if (!class_exists('VardefManager')) {
}
VardefManager::clearVardef();
require_once 'include/TemplateHandler/TemplateHandler.php';
TemplateHandler::clearAll();
//also add the cache cleaning here.
if (function_exists('deleteCache')) {
    deleteCache();
}
Example #26
0
/**
 * checks files for permissions
 * @param array files Array of files with absolute paths
 * @return string result of check
 */
function systemCheckJsonCheckFiles($persistence)
{
    global $mod_strings;
    global $persistence;
    $filesNotWritable = array();
    $i = 0;
    $filesOut = "\n\t\t<a href='javascript:void(0); toggleNwFiles(\"filesNw\");'>{$mod_strings['LBL_UW_SHOW_NW_FILES']}</a>\n\t\t<div id='filesNw' style='display:none;'>\n\t\t<table cellpadding='3' cellspacing='0' border='0'>\n\t\t<tr>\n\t\t\t<th align='left'>{$mod_strings['LBL_UW_FILE']}</th>\n\t\t\t<th align='left'>{$mod_strings['LBL_UW_FILE_PERMS']}</th>\n\t\t\t<th align='left'>{$mod_strings['LBL_UW_FILE_OWNER']}</th>\n\t\t\t<th align='left'>{$mod_strings['LBL_UW_FILE_GROUP']}</th>\n\t\t</tr>";
    $isWindows = is_windows();
    foreach ($persistence['files_to_check'] as $file) {
        //	while($file = array_pop($persistence['files_to_check'])) {
        // admin deletes a bad file mid-check:
        if (!file_exists($file)) {
            continue;
        }
        if ($isWindows) {
            if (!is_writable_windows($file)) {
                logThis('WINDOWS: File [' . $file . '] not readable - saving for display');
                // don't warn yet - we're going to use this to check against replacement files
                $filesNotWritable[$i] = $file;
                $filesNWPerms[$i] = substr(sprintf('%o', fileperms($file)), -4);
                $filesOut .= "<tr>" . "<td valign='top'><span class='error'>{$file}</span></td>" . "<td valign='top'>{$filesNWPerms[$i]}</td>" . "<td valign='top'>" . $mod_strings['ERR_UW_CANNOT_DETERMINE_USER'] . "</td>" . "<td valign='top'>" . $mod_strings['ERR_UW_CANNOT_DETERMINE_GROUP'] . "</td>" . "</tr>";
            }
        } else {
            if (!is_writable($file)) {
                logThis('File [' . $file . '] not writable - saving for display');
                // don't warn yet - we're going to use this to check against replacement files
                $filesNotWritable[$i] = $file;
                $filesNWPerms[$i] = substr(sprintf('%o', fileperms($file)), -4);
                $owner = posix_getpwuid(fileowner($file));
                $group = posix_getgrgid(filegroup($file));
                $filesOut .= "<tr>" . "<td valign='top'><span class='error'>{$file}</span></td>" . "<td valign='top'>{$filesNWPerms[$i]}</td>" . "<td valign='top'>" . $owner['name'] . "</td>" . "<td valign='top'>" . $group['name'] . "</td>" . "</tr>";
            }
        }
        $i++;
    }
    $filesOut .= '</table></div>';
    // not a stop error
    $persistence['filesNotWritable'] = count($filesNotWritable) > 0 ? true : false;
    if (count($filesNotWritable) < 1) {
        $filesOut = "{$mod_strings['LBL_UW_FILE_NO_ERRORS']}";
        $persistence['step']['systemCheck'] = 'success';
    }
    echo $filesOut;
    return $persistence;
}
                $value = 0;
                $admin->saveSetting($category, 'users', $value);
                $key = array('num_lic_oc', 'key', 'expire_date');
                $value = '';
                foreach ($key as $k) {
                    $admin->saveSetting($category, $k, $value);
                }
            }
        }
    }
    $phpErrors = ob_get_contents();
    ob_end_clean();
    logThis("**** Potential PHP generated error messages: {$phpErrors}", $path);
    if (count($errors) > 0) {
        foreach ($errors as $error) {
            logThis("****** SilentUpgrade ERROR: {$error}", $path);
        }
        echo "FAILED\n";
    }
}
/**
 * repairTableDictionaryExtFile
 *
 * There were some scenarios in 6.0.x whereby the files loaded in the extension tabledictionary.ext.php file
 * did not exist.  This would cause warnings to appear during the upgrade.  As a result, this
 * function scans the contents of tabledictionary.ext.php and then remove entries where the file does exist.
 */
function repairTableDictionaryExtFile()
{
    $tableDictionaryExtDirs = array('custom/Extension/application/Ext/TableDictionary', 'custom/application/Ext/TableDictionary');
    foreach ($tableDictionaryExtDirs as $tableDictionaryExt) {
Example #28
0
if (ob_get_level() < 1) {
    ob_start();
}
ob_implicit_flush(1);
if (!function_exists('getFilesForPermsCheck')) {
    require_once 'modules/UpgradeWizard/uw_utils.php';
}
if (!isset($sugar_config) || empty($sugar_config)) {
}
// persistence
$persistence = getPersistence();
switch ($_REQUEST['commitStep']) {
    case 'run_sql':
        ob_end_flush();
        logThis('commitJson->runSql() called.');
        $persistence = commitAjaxRunSql($persistence);
        break;
    case 'get_errors':
        logThis('commitJson->getErrors() called.');
        commitAjaxGetSqlErrors($persistence);
        break;
    case 'post_install':
        logThis('commitJson->postInstall() called.');
        commitAjaxPostInstall($persistence);
        break;
    case 'final_touches':
        logThis('commitJson->finalTouches() called.');
        $persistence = commitAjaxFinalTouches($persistence);
        break;
}
savePersistence($persistence);
////	TAKE OUT TRASH
if (empty($errors)) {
    set_upgrade_progress('end', 'in_progress', 'unlinkingfiles', 'in_progress');
    logThis('Taking out the trash, unlinking temp files.', $path);
    unlinkUWTempFiles();
    removeSilentUpgradeVarsCache();
    logThis('Taking out the trash, done.', $path);
}
///////////////////////////////////////////////////////////////////////////////
////	RECORD ERRORS
$phpErrors = ob_get_contents();
ob_end_clean();
logThis("**** Potential PHP generated error messages: {$phpErrors}", $path);
if (count($errors) > 0) {
    foreach ($errors as $error) {
        logThis("****** SilentUpgrade ERROR: {$error}", $path);
    }
    echo "FAILED\n";
} else {
    logThis("***** SilentUpgrade completed successfully.", $path);
    echo "********************************************************************\n";
    echo "*************************** SUCCESS*********************************\n";
    echo "********************************************************************\n";
    echo "******** If your pre-upgrade Leads data is not showing  ************\n";
    echo "******** Or you see errors in detailview subpanels  ****************\n";
    echo "************* In order to resolve them  ****************************\n";
    echo "******** Log into application as Administrator  ********************\n";
    echo "******** Go to Admin panel  ****************************************\n";
    echo "******** Run Repair -> Rebuild Relationships  **********************\n";
    echo "********************************************************************\n";
}
Example #30
0
foreach ($_SESSION['sugarMergeRunResults'] as $mergeModule => $mergeModuleFileList) {
    if (!empty($mergeModuleFileList)) {
        $skipLayouts = false;
    }
}
$stepNext = $skipLayouts ? $_REQUEST['step'] + 2 : $_REQUEST['step'] + 1;
$stepCancel = -1;
$stepRecheck = $_REQUEST['step'];
$_SESSION['step'][$steps['files'][$_REQUEST['step']]] = $stop ? 'failed' : 'success';
// clear out the theme cache
if (!class_exists('SugarThemeRegistry')) {
    require_once 'include/SugarTheme/SugarTheme.php';
}
$themeObject = SugarThemeRegistry::current();
$styleJSFilePath = $GLOBALS['sugar_config']['cache_dir'] . $themeObject->getJSPath() . DIRECTORY_SEPARATOR . 'style-min.js';
if (file_exists($styleJSFilePath)) {
    logThis("Rebuilding style js file: {$styleJSFilePath}");
    unlink($styleJSFilePath);
    SugarThemeRegistry::current()->clearJSCache();
    SugarThemeRegistry::current()->getJS();
}
SugarThemeRegistry::buildRegistry();
SugarThemeRegistry::clearAllCaches();
//Clean out the language files
logThis("Rebuilding language cache");
sugar_cache_reset_full();
LanguageManager::clearLanguageCache();
// re-minify the JS source files
$_REQUEST['root_directory'] = getcwd();
$_REQUEST['js_rebuild_concat'] = 'rebuild';
require_once 'jssource/minify.php';