| [commandline] New fully scriptable hosting framework [message #27644] |
Fri, 28 March 2008 01:49  |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
Lxadmin has stopped being a mere control panel and now it is a full scriptable, 100% object oriented hosting framework. We have added a concept called as reflection, where you can use a script to get the internals of lxadmin directly. For instance, you need not wait for us to publish API. Instead, you can query lxadmin directly, and it will tell you how to add/update a particular object.
For instance, if you want to know how to add a mailforward to an mmail object, you can do this:
/script/reflect --type=add --parent-class=mmail --parent-name=domain.com --class=mailforward
In effect, you are asking lxadmin: "How can I add a mailforward to the mmail-domain.com object". The reply is the list of variables that are needed, in this case, it prints
nname Mail Account
forwardaddress Forward To
Using the above information, now you can add a mailforward:
/script/add --parent-class=mmail --parent-name=domain.com --class=mailforward --v-nname=mfname --v-forwardadress="|/script"
How to Update an object
The next task is how to update an object. You can use reflection to find out the actual variables involved in executing a particular subaction for the update. For instance, how to update the hot link protection in web.
/script/reflect --type=update --subaction=hotlink_protection --class=web --name=domain.com
Output:
hotlink_flag Enable Hotlink Protection
text_hotlink_allowed Allowed Domains (one Per Line)
hotlink_redirect Redirect To (img)
It actually prints the variable and the description. All flag variables are either 'on' or 'off'. So to turn on hotlink protection on a web object, you do this:
/script/update --class=web --name=domain.com --subaction=hotlink_protection --v-hotlink_flag=on --v-text_hotlink_allowed= --v-hotlink_redirect=/img/image.gif
Thanks.
[Updated on: Thu, 03 April 2008 22:00] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
| Re: New fully scriptable hosting framework [message #43027 is a reply to message #43026] |
Sun, 26 October 2008 03:53   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
How to add wordpress to a domain:
/script/reflect --type=add --parent-class=web --parent-name=domain.com --class=installsoft --v-val=wordpress
On Sun, Oct 26, 2008 at 07:49:16AM -0000, Administrator wrote:
>
>
>
|
|
|
|
| Re: New fully scriptable hosting framework [message #43029 is a reply to message #43028] |
Sun, 26 October 2008 04:25   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
Just run:
On Sun, Oct 26, 2008 at 08:16:39AM -0000, Dragomir Denev wrote:
>
>
> adminmaster wrote on Sun, 26 October 2008 09:49
> > The reflect command now has a built-in help. Actually, now that i use it routinely, i realized that an in-built help is absolutely essential. And it is now 100% complete too.
|
|
|
| Re: New fully scriptable hosting framework [message #43030 is a reply to message #43028] |
Sun, 26 October 2008 04:28   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
Update to the latest version, and --help will also work.
How to add a customer to admin
/script/reflect --type=add --parent-class=client --parent-name=admin --class=client --v-val=customer
If you have lxadmin Enterprise, it will automatically show server parameters too.
How to add a reseller:
/script/reflect --type=add --parent-class=client --parent-name=admin --class=client --v-val=reseller
On Sun, Oct 26, 2008 at 08:16:39AM -0000, Dragomir Denev wrote:
>
>
|
|
|
| Re: [commandline] New fully scriptable hosting framework [message #43031 is a reply to message #43026] |
Sun, 26 October 2008 04:39   |
drank  Messages: 1324 Registered: June 2007 |
Senior Master |
|
|
| adminmaster wrote on Sun, 26 October 2008 09:49 |
The reflect command now has a built-in help. Actually, now that i use it routinely, i realized that an in-built help is absolutely essential. And it is now 100% complete too.
|
Haha! Is this what you call essential help:
# /script/reflect --help
Usage: reflect --type=add --parent-class= --parent-name= --class= [--v-var= --v-val=]
Usage: reflect --type=update --subaction= --class= --name=
Yes, I couldn't live without those 2 lines also.
Come on, LxHelp, you know what help I am talking about. Type "whatever command --help" in your linux box and you'll see what I mean.
have you at least read my first request about this:
| Quote: | It would be even greater if you add a --help parameter to /script/reflect which will output a help about the possible parameters to the command (like --type, --class, etc.) along with their descriptions.
You could do this for the other commands (add, update) too. Thank you.
|
Please, try to make this really usefull. Thank you.
PS:Sorry for being such a pain in the ass but I hope you understand we're both trying to make the product better
Dragomir Denev
DGM
www.dgm.bg
|
|
|
| Re: New fully scriptable hosting framework [message #43032 is a reply to message #43031] |
Sun, 26 October 2008 04:46   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
| Quote: |
>
>
> Please, try to make this really usefull. Thank you.
>
> PS:Sorry for being such a pain in the ass but I hope you understand we're both trying to make the product better ;)
|
I have added some examples there too. You can update to the latest version and see.
The basic concept in lxadmin is always the same.
You always add an object to another object. The object you are adding to is called the parent, which is accessed via parent-class and parent-name.
I will publish the exact tree structure of lxadmin objects, which will give a clear idea of how to add anything to anywhere.
|
|
|
|
| Re: New fully scriptable hosting framework [message #43055 is a reply to message #43034] |
Sun, 26 October 2008 06:50   |
Lxhelp Messages: 23691 Registered: July 2006 |
The Champion |
|
|
Yes, I have to explain the class hierarchy there. The only variables you need to provide parent-class, parent-name, class and --v-var and --v-val.
On Sun, Oct 26, 2008 at 08:58:16AM -0000, Dragomir Denev wrote:
>
>
> My Idea is that you make all the needed information under our fingertips. It always better to just type "/script/reflect --help" and get all the needed help than to collect the pieces from the scattered posts on the forum.
>
|
|
|
|
|
|
|
|
|