[fix] fix misc bugs at alternc.install time
This commit is contained in:
parent
f898407d3d
commit
b6a2f74326
|
@ -1909,7 +1909,7 @@ class m_dom {
|
|||
exit();
|
||||
}
|
||||
|
||||
$dom->lock();
|
||||
$this->lock();
|
||||
|
||||
// fix in case we forgot to delete SUBDOMAINS before deleting a DOMAIN
|
||||
$db->query("UPDATE sub_domaines sd, domaines d SET sd.web_action = 'DELETE' WHERE sd.domaine = d.domaine AND sd.compte=d.compte AND d.dns_action = 'DELETE';");
|
||||
|
@ -1982,7 +1982,7 @@ class m_dom {
|
|||
$hooks->invoke("hook_updatedomains_web_post");
|
||||
}
|
||||
|
||||
$dom->unlock();
|
||||
$this->unlock();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
#!/usr/bin/php -q
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Generate Apache configuration for AlternC
|
||||
*
|
||||
* To force generation, /launch/generate_apache_conf.php force
|
||||
*
|
||||
* Return the number of vhost modified, return 0 if no action
|
||||
*
|
||||
**/
|
||||
|
||||
require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
||||
ini_set("display_errors", 1);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
FIXME :
|
||||
- add security check
|
||||
*/
|
||||
|
||||
// Check if we can modify Apache conf
|
||||
@touch(ALTERNC_VHOST_FILE);
|
||||
if ( ! is_writable( ALTERNC_VHOST_FILE )) {
|
||||
die("Error: ".ALTERNC_VHOST_FILE." is not writable\n");
|
||||
}
|
||||
|
||||
// Do we need to regenerate apache conf ?
|
||||
$db->query("select count(*) as c from sub_domaines where web_action != 'OK';");
|
||||
if (! $db->next_record()) $nb_todo = 0;
|
||||
$nb_todo = $db->f('c');
|
||||
|
||||
// But, we may have forced it
|
||||
if ( ! in_array('force', $argv) && $nb_todo < 1) {
|
||||
die('0');
|
||||
}
|
||||
|
||||
$todo = $dom->generation_todo();
|
||||
$parameters = $dom->generation_parameters();
|
||||
|
||||
// Generate apache conf
|
||||
$conf = $dom->generate_apacheconf();
|
||||
|
||||
if (! $conf) {
|
||||
die("Error: generate empty configuration\n");
|
||||
}
|
||||
|
||||
// Add some headers
|
||||
$conf2 = "###BEGIN OF ALTERNC AUTO-GENERATED FILE - DO NOT EDIT MANUALLY###
|
||||
# Generation: ".date('Y-m-d H:i:s');
|
||||
|
||||
// Do we need to include manual configuration ?
|
||||
if ( is_dir( ALTERNC_VHOST_MANUALCONF ) ) {
|
||||
$conf2.="\n## Manual VHOST\nInclude ".ALTERNC_VHOST_MANUALCONF."\n" ;
|
||||
} else {
|
||||
$conf2.="\n## Manual VHOST directory missing (".ALTERNC_VHOST_MANUALCONF.")\n" ;
|
||||
}
|
||||
|
||||
$conf2.="\n$conf\n\n###END OF ALTERNC AUTO-GENERATED FILE - DO NOT EDIT MANUALLY###\n";
|
||||
|
||||
// Write the conf !
|
||||
if (! file_put_contents(ALTERNC_VHOST_FILE, $conf2) ) {
|
||||
die("Error: writing content\n");
|
||||
}
|
||||
|
||||
// Update the database to inform that we did the job
|
||||
foreach ( $todo as $taction=>$tlist){
|
||||
foreach ($tlist as $ttype) {
|
||||
foreach($ttype as $tid) {
|
||||
$dom->subdomain_modif_are_done($tid, $taction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hooks !
|
||||
foreach (array('DELETE', 'CREATE', 'UPDATE', 'ENABLE', 'DISABLE') as $y) {
|
||||
if (!isset($todo[$y]) || empty($todo[$y])) continue;
|
||||
$dom->generate_conf_oldhook($y, $todo); // old hooks for compatibility
|
||||
$hooks->invoke("hook_genconf", array($y, $todo[$y], $parameters)); // modern hooks
|
||||
}
|
||||
|
||||
echo $nb_todo;
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/php -q
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Generate Bind configuration for AlternC
|
||||
*
|
||||
* To force generation, /launch/generate_bind_conf.php --force
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
||||
ini_set("display_errors", 1);
|
||||
|
||||
$bind = new system_bind();
|
||||
|
||||
$force = false;
|
||||
if (in_array('--force', $argv)) { // Want to force
|
||||
$force=true;
|
||||
}
|
||||
|
||||
$bind->regenerate_conf($force);
|
||||
|
|
@ -4,7 +4,6 @@
|
|||
. /usr/lib/alternc/functions.sh
|
||||
|
||||
echo "This script will rebuild all web configuration and regenerate DNS."
|
||||
echo "Only files in $VHOST_MANUALCONF will be preserved."
|
||||
echo "Use --force to skip confirmation"
|
||||
|
||||
if [ ! "$1" == "--force" ] ; then
|
||||
|
@ -20,7 +19,6 @@ mysql_query "update domaines set dns_action = 'UPDATE' WHERE dns_action != '
|
|||
|
||||
echo "Now launching update_domains to rebuild."
|
||||
/usr/lib/alternc/update_domains.sh
|
||||
/usr/lib/alternc/generate_bind_conf.php --force
|
||||
|
||||
echo "Finish."
|
||||
|
||||
|
|
Loading…
Reference in New Issue