Jump to content

Reconsider The Usage Of "delta" Array When Saving Package/module Meta For A Service


Recommended Posts

There are situations in which Blesta's data may not change, but you still want to send that data to the module to make an update.

 

Right now, data is only sent to the module when it's different from the old Blesta data.

 

However, in the case of a migration for instance, the data in Blesta (cPanel package, password) will not and should not be expected to match the data in the module.

 

Only downside to this is a slight performance penalty when "use module" is checked. If the user checks "use module" it is not unreasonable to expect that changes will be sent to the module and a penalty will be incurred.

 

The more foundational issue here is that Blesta should not always make the assumption that its data is always correct (meaning in sync with any external systems used by a module), which it seems to have a tendency to do in this situation as well as others. Billing and order processing can and does get messy. The current approach assumes ideal circumstances and makes anything else very difficult.

Link to comment
Share on other sites

I can see the inconvenience. The alternative would be to change it to something else with Use Module unchecked, then change it back with Use Module checked, which most people probably wouldn't figure out.

 

That's what I've been doing.

 

Basically I'd like to be able to pull up the service, hit the "save" button once and close it out not having to wonder if everything if in sync. 2 seconds vs 1 minute.

 

Note - this should apply to packages as well (that's probably even more important than service fields).

 

Perfect example, just did a migration, if I was using Blesta I would have had to go change the package manually or I would have to go through multiple steps to make sure the account was on the proper package.

Link to comment
Share on other sites

Patched:

 

Replace if ($vars['use_module'] == "true") block in editService method on cpanel module.


		// Only update the service if 'use_module' is true
		if ($vars['use_module'] == "true") {
			
			// Update password (if present)
			if (isset($vars['cpanel_password'])) {
				
				$this->log($row->meta->host_name . "|passwd", "***", "input", true);
				$result = $this->parseResponse($api->passwd($service_fields->cpanel_username, $vars['cpanel_password']));
			}
			
			// Update username and domain
			$params = array('newuser' => $vars['cpanel_username'], 'domain' => $vars['cpanel_domain']);
			$this->log($row->meta->host_name . "|modifyacct", serialize($params), "input", true);
			$result = $this->parseResponse($api->modifyacct($service_fields->cpanel_username, $params));
			
		}
        
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...