Skip to content

Commit b8e3010

Browse files
committed
Better log
1 parent 2785f56 commit b8e3010

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

class/sellyoursaasutils.class.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4266,7 +4266,7 @@ public function sellyoursaasRemoteAction($remoteaction, $object, $appusername =
42664266
dol_syslog("List of lines contains an empty ContratLine, we discard this line.", LOG_WARNING);
42674267
continue;
42684268
}
4269-
dol_syslog("** Process contract line id=".$tmpobject->id." to know which action to do");
4269+
dol_syslog("** Process contract line id=".$tmpobject->id." to know which action to do and define remoteaction to 0, 1 (most action like deploy, deployoption, rename, ...) or 2 (refesh)");
42704270

42714271
$producttmp = new Product($this->db);
42724272
$producttmp->fetch($tmpobject->fk_product, '', '', '', 1, 1, 1);
@@ -4301,7 +4301,13 @@ public function sellyoursaasRemoteAction($remoteaction, $object, $appusername =
43014301

43024302
$listoflinesqualified = dol_sort_array($listoflinesqualified, 'position', 'asc');
43034303

4304-
// Now loop on each lines qualified for action
4304+
4305+
$tmp = explode('.', $contract->ref_customer, 2);
4306+
$sldAndSubdomain = $tmp[0];
4307+
$domainname = $tmp[1];
4308+
4309+
4310+
// Now loop on each lines qualified for action and call remote URL
43054311
foreach ($listoflinesqualified as $tmparrayoflinesqualified) {
43064312
$tmpobject = $tmparrayoflinesqualified['tmpobject'];
43074313
$doremoteaction = $tmparrayoflinesqualified['doremoteaction'];
@@ -4325,10 +4331,7 @@ public function sellyoursaasRemoteAction($remoteaction, $object, $appusername =
43254331
}
43264332

43274333
$ispaidinstance = sellyoursaasIsPaidInstance($contract);
4328-
4329-
$tmp=explode('.', $contract->ref_customer, 2);
4330-
$sldAndSubdomain=$tmp[0];
4331-
$domainname=$tmp[1];
4334+
43324335
if (! empty($contract->array_options['options_deployment_host'])) {
43334336
$serverdeployment = $contract->array_options['options_deployment_host'];
43344337
} else {
@@ -4484,14 +4487,14 @@ public function sellyoursaasRemoteAction($remoteaction, $object, $appusername =
44844487
}
44854488
$substitarray['__SMTP_SPF_STRING__'] = '_spf'.$sldAndSubdomain.'.'.$domainname;
44864489

4487-
4490+
44884491
$dirfortmpfiles = DOL_DATA_ROOT.'/sellyoursaas/temp';
44894492
dol_mkdir($dirfortmpfiles, '', '0775');
44904493
$tmppackage->srcconffile1 = $dirfortmpfiles.'/conf.php.'.$sldAndSubdomain.'.'.$domainname.'.tmp';
44914494
$tmppackage->srccronfile = $dirfortmpfiles.'/cron.'.$sldAndSubdomain.'.'.$domainname.'.tmp';
44924495
$tmppackage->srccliafter = $dirfortmpfiles.'/cliafter.'.$sldAndSubdomain.'.'.$domainname.'.tmp';
44934496
$tmppackage->srccliafterpaid = $dirfortmpfiles.'/cliafterpaid.'.$sldAndSubdomain.'.'.$domainname.'.tmp';
4494-
4497+
44954498
$conffile = make_substitutions($tmppackage->conffile1, $substitarray);
44964499
$cronfile = make_substitutions($tmppackage->crontoadd, $substitarray);
44974500
$cliafter = make_substitutions($tmppackage->cliafter, $substitarray);
@@ -4543,21 +4546,25 @@ public function sellyoursaasRemoteAction($remoteaction, $object, $appusername =
45434546
}
45444547

45454548
if ($tmppackage->srccliafter && $cliafter) {
4546-
dol_syslog("Create cli file ".$tmppackage->srccliafter);
4549+
dol_syslog("Create cli after file ".$tmppackage->srccliafter);
4550+
45474551
dol_delete_file($tmppackage->srccliafter, 0, 1, 0, null, false, 0);
4552+
45484553
$result = file_put_contents($tmppackage->srccliafter, str_replace("\r", '', $cliafter));
45494554
@chmod($tmppackage->srccliafter, 0664); // so user/group has "rw" ('admin' can delete if owner/group is 'admin' or 'www-data', 'root' can also read using nfs)
45504555
} else {
4551-
dol_syslog("No cli file to create or no content");
4556+
dol_syslog("No cli adter file to create or no content");
45524557
}
45534558

45544559
if ($tmppackage->cliafterpaid && $cliafterpaid) {
4555-
dol_syslog("Create cli file ".$tmppackage->srccliafter);
4560+
dol_syslog("Create cli afterpaid file ".$tmppackage->srccliafterpaid);
4561+
45564562
dol_delete_file($tmppackage->srccliafterpaid, 0, 1, 0, null, false, 0);
4563+
45574564
$result = file_put_contents($tmppackage->srccliafterpaid, str_replace("\r", '', $cliafterpaid));
45584565
@chmod($tmppackage->srccliafterpaid, 0664); // so user/group has "rw" ('admin' can delete if owner/group is 'admin' or 'www-data', 'root' can also read using nfs)
45594566
} else {
4560-
dol_syslog("No cli after paid file to create or no content");
4567+
dol_syslog("No cli afterpaid file to create or no content");
45614568
}
45624569
}
45634570
if (in_array($remoteaction, array("deploy", "deployall"))) {
@@ -4692,10 +4699,6 @@ public function sellyoursaasRemoteAction($remoteaction, $object, $appusername =
46924699
if (! empty($producttmp->array_options['options_resource_formula'])) {
46934700
$targetdir = getDolGlobalString('DOLICLOUD_INSTANCES_PATH');
46944701

4695-
$tmp=explode('.', $contract->ref_customer, 2);
4696-
$sldAndSubdomain=$tmp[0];
4697-
$domainname=$tmp[1];
4698-
46994702
$generatedunixlogin = $contract->array_options['options_username_os'];
47004703
$generatedunixpassword= $contract->array_options['options_password_os'];
47014704
$generateddbname = $contract->array_options['options_database_db'];

scripts/remote_server/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@
102102
$return_var=0;
103103

104104
if ($DEBUG) {
105-
fwrite($fh, "\n".date('Y-m-d H:i:s').' >>>>>>>>>>>>>>>>>>>> Call for action '.$tmparray[0].' by '.$_SERVER['REMOTE_ADDR'].' URI='.$_SERVER['REQUEST_URI']."\n");
105+
fwrite($fh, "\n".date('Y-m-d H:i:s').' >>>>>>>>>>>>>>>>>>>> index.php Call for action '.$tmparray[0].' by '.$_SERVER['REMOTE_ADDR'].' URI='.$_SERVER['REQUEST_URI']."\n");
106106
} else {
107-
fwrite($fh, "\n".date('Y-m-d H:i:s').' >>>>>>>>>>>>>>>>>>>> Call for action '.$tmparray[0]." by ".$_SERVER['REMOTE_ADDR']."\n");
107+
fwrite($fh, "\n".date('Y-m-d H:i:s').' >>>>>>>>>>>>>>>>>>>> index.php Call for action '.$tmparray[0]." by ".$_SERVER['REMOTE_ADDR']."\n");
108108
}
109109

110110
fwrite($fh, date('Y-m-d H:i:s').' dnsserver='.$dnsserver.", instanceserver=".$instanceserver.", allowed_hosts=".$allowed_hosts."\n");

0 commit comments

Comments
 (0)