Hi Guys, Is there anyway to get ISPConfig to recheck all the quota settings for all users? Here is what I have done, I have a client who has some 500 mailboxes, original only pop3 account so quota was set to 100MB, more and more of their users are now using IMAP and mobile devices so they are not removing mail from the server thus their mailboxes are filling up and mail is not being delivered. I have run a SQL UPDATE statement to update all the users for a specific domain to 500MB, but the changes are not applied, They are only applied if I go into each mailbox in ISPC and save. I take it once you click save ISPC runs a script to update that users quota settings ? Can we not run something that will update all users quota settings ? Thanks.
Do not cahnge settings in ispconfig database directly with sql, as these changes will not get written to the config files and are ignored by the system as they are no valid config transactions. If you want to update a value from a script, use the remote API or the datalogUpdate function from the ISPConfig mysql database connection class.
Cool thanks, Is there and API doc ? I see that it's not part of teh official ISPC3 Doc. Can you explain a little more about datalog update
There is no API doc available, but there are some example files in the ispconfig 3 tar.gz file and some informations about the api in the dev forum. Every configuration change that shall be written to disk needs a transaction record in the sys_datalog table and the datalogUpdate function is writing these transaction records and updates also the mysql database table.
I am a real noob when it comes to trying to write these things, does anyone have a script I can copy and use to achieve this ?
Ok so this is what I have done so far, please forgive me I am trying here Code: <?php $username = 'xxx'; $password = 'xxx'; $soap_location = 'http://localhost:8080/remote/index.php'; $soap_uri = 'http://localhost:8080/remote/'; $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri)); try { if($session_id = $client->login($username,$password)) { echo 'Login sucessful. Session-ID:'.$session_id.'<br />'; } $primary_id = 2; $domain_id = $client->mail_user_get($session_id, $primary_id); if($client->logout($session_id)) { echo 'Logout succesful.<br />'; } } catch (SoapFault $e) { die('SOAP Blad: '.$e->getMessage()); } ?> I am getting a successful login and logout, But I am not seeing the users details that I am querying, Also another question how would I pass a parameter to the php script, so lets say I want to query users_id 2, how would this be formed ? http://www.example.com/get_mail_user.php?primary_id=2 and I assume I comment out this line "$primary_id = 2;"
You dont print the details on the screen, so you dont see them. change line: $domain_id = $client->mail_user_get($session_id, $primary_id); to: $data = $client->mail_user_get($session_id, $primary_id); print_r($data); Replace the line: $primary_id = 2; with: $primary_id = intval($_GET['primary_id']);
So If I now want to update the user, do I have to insert all the prameters returned, or only those in the mail_user.tform.php server_id email password name quota cc maildir hoemdir uid gid postfix disableimap disablepop3
awesome, the only limitation I find here is if you are getting the users mail details you need to know the user ID. Is there on other way of querying the user details by using the actual email address ? other than first interrogating the database for the id and passing it to the rest of the function ?
You can find a list of all available API functions in the file interface/lib/classes/remoting.inc.php
this is what I am saying, but then it's not really a true API, as you have to then all externals access to the database queries. But ok, at least I have something to work with for now
The api is made to control ispconfig from a external application and in that case, you have the ID's because you inserted the record with the API. In your case, you dont know the ID because your records were inserted in the ispconfig interface and not with the API. But you can easily extend the API to add a function to search the account by email address.