Adieu stats2.
Avec l'arrivé de vlogger, les stats sont directement rangé pour chaque user. Stats2 est remplacé par Logs
This commit is contained in:
parent
a3d9ed303b
commit
265a9a3f5e
|
@ -284,7 +284,6 @@ bureau/admin/menu_mem.php -text
|
|||
bureau/admin/menu_piwik.php -text
|
||||
bureau/admin/menu_quota.php -text
|
||||
bureau/admin/menu_sql.php -text
|
||||
bureau/admin/menu_sta2.php -text
|
||||
bureau/admin/menu_web.php -text
|
||||
bureau/admin/mxlist.php -text
|
||||
bureau/admin/phpinfo.php -text
|
||||
|
@ -315,12 +314,6 @@ bureau/admin/sql_users_dorights.php -text
|
|||
bureau/admin/sql_users_list.php -text
|
||||
bureau/admin/sql_users_password.php -text
|
||||
bureau/admin/sql_users_rights.php -text
|
||||
bureau/admin/sta2_add_raw.php -text
|
||||
bureau/admin/sta2_del_raw.php -text
|
||||
bureau/admin/sta2_doadd_raw.php -text
|
||||
bureau/admin/sta2_doedit_raw.php -text
|
||||
bureau/admin/sta2_edit_raw.php -text
|
||||
bureau/admin/sta2_list.php -text
|
||||
bureau/admin/stats_members.php -text
|
||||
bureau/admin/styles/passwordStrengthMeter.css -text
|
||||
bureau/admin/styles/style.css -text
|
||||
|
@ -352,7 +345,6 @@ bureau/class/m_mem.php -text
|
|||
bureau/class/m_mysql.php -text
|
||||
bureau/class/m_piwik.php -text
|
||||
bureau/class/m_quota.php -text
|
||||
bureau/class/m_sta2.php -text
|
||||
bureau/class/m_trash.php -text
|
||||
bureau/class/mime.php -text
|
||||
bureau/class/reset_stats_conf.php -text
|
||||
|
@ -531,7 +523,6 @@ src/quota_delete -text
|
|||
src/quota_edit -text
|
||||
src/quota_get -text
|
||||
src/quota_init -text
|
||||
src/rawstat.daily -text
|
||||
src/sendmail -text
|
||||
src/slave_dns -text
|
||||
src/spoolsize.php -text
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2000-2012 by the AlternC Development Team.
|
||||
https://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ############# STATS ############# */
|
||||
$q = $quota->getquota("sta2");
|
||||
$r = $quota->getquota("dom");
|
||||
if ($q["t"] > 0 || $r["u"] > 0) {
|
||||
?>
|
||||
<div class="menu-box">
|
||||
<div class="menu-title"><img src="images/stat.png" alt="<?php __("Raw web statistics"); ?>" /> <a href="sta2_list.php"><?php __("Raw web statistics"); ?> (<?php echo $q["u"]; ?>/<?php echo $q["t"]; ?>)</a></div>
|
||||
</div>
|
||||
<?php } ?>
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: sta2_add_raw.php,v 1.3 2004/09/07 17:09:57 anonymous Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file:
|
||||
Purpose of file:
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
if (!$quota->cancreate("sta2")) {
|
||||
$error=_("You cannot add any new statistics, your quota is over.");
|
||||
}
|
||||
|
||||
include_once("head.php");
|
||||
?>
|
||||
<h3><?php __("New Raw Statistics (apache)"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
if (isset($error) && $error) {
|
||||
echo "<p class=\"error\">$error</p>";
|
||||
include_once("foot.php");
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<form method="post" action="sta2_doadd_raw.php" id="main" name="main">
|
||||
<table class="tedit">
|
||||
<tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
|
||||
<label for="hostname"><?php __("Domain name:"); ?></label></th><td>
|
||||
<select class="inl" name="hostname" id="hostname"><?php $sta2->select_host_list($hostname); ?></select>
|
||||
</td></tr>
|
||||
<tr><th><label for="dir"><?php __("Folder where we will put the log file:"); ?></label></th><td><input type="text" class="int" name="dir" id="dir" value="" size="20" maxlength="255" />
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.write(" <input type=\"button\" name=\"bff\" class=\"bff\" onclick=\"browseforfolder('main.dir');\" value=\" <?php __("Choose a folder..."); ?> \" />");
|
||||
// -->
|
||||
</script>
|
||||
</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<input type="submit" class="inb" name="submit" value="<?php __("Create those raw statistics"); ?>" />
|
||||
</form>
|
||||
<?php $mem->show_help("sta2_add"); ?>
|
||||
<?php include_once("foot.php"); ?>
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: sta2_del_raw.php,v 1.1 2004/05/24 17:02:28 anonymous Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file:
|
||||
Purpose of file:
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
$error="";
|
||||
// On parcours les POST_VARS et on repere les del_.
|
||||
reset($_POST);
|
||||
while (list($key,$val)=each($_POST)) {
|
||||
if (substr($key,0,4)=="del_") {
|
||||
// Effacement du jeu de stats $val
|
||||
$r=$sta2->delete_stats_raw($val);
|
||||
if (!$r) {
|
||||
$error.=$err->errstr()."<br />";
|
||||
} else {
|
||||
$error.=sprintf(_("The statistics %s has been successfully deleted (the stats files must be manually deleted)"),$r)."<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include("sta2_list.php");
|
||||
exit();
|
||||
?>
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: sta2_doadd_raw.php,v 1.1 2004/05/24 17:02:28 anonymous Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file:
|
||||
Purpose of file:
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
$fields = array (
|
||||
"hostname" => array ("post", "string", ""),
|
||||
"dir" => array ("post", "string", ""),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
$r=$sta2->add_stats_raw($hostname,$dir);
|
||||
if (!$r) {
|
||||
$error=$err->errstr();
|
||||
include("sta2_add_raw.php");
|
||||
exit();
|
||||
} else {
|
||||
$error=_("The statistics has been successfully created");
|
||||
include("sta2_list.php");
|
||||
exit();
|
||||
}
|
||||
?>
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: sta2_doedit_raw.php,v 1.1 2004/05/24 17:02:28 anonymous Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file:
|
||||
Purpose of file:
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
$fields = array (
|
||||
"id" => array ("post", "integer", ""),
|
||||
"dir" => array ("post", "string", ""),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
if (empty($id)) {
|
||||
$error=_("No Statistics selected!");
|
||||
} else {
|
||||
$r=$sta2->put_stats_details_raw($id,$dir);
|
||||
if (!$r) {
|
||||
$error=$err->errstr();
|
||||
include("sta2_edit_raw.php");
|
||||
exit();
|
||||
} else {
|
||||
$error=_("The Statistics has been successfully changed");
|
||||
include("sta2_list.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,75 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: sta2_edit_raw.php,v 1.2 2004/08/27 18:06:13 anonymous Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file:
|
||||
Purpose of file:
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
include_once("head.php");
|
||||
|
||||
$fields = array (
|
||||
"id" => array ("get", "integer", ""),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
if (empty($id)) {
|
||||
$error=_("No Statistics selected!");
|
||||
} else {
|
||||
$r=$sta2->get_stats_details_raw($id);
|
||||
if (!$r) {
|
||||
$error=$err->errstr();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<h3><?php __("Change the Raw Statistics"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
if (isset($error) && $error) {
|
||||
echo "<p class=\"error\">$error</p>";
|
||||
include_once("foot.php");
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<form method="post" action="sta2_doedit_raw.php" id="main" name="main">
|
||||
<table border="1" cellspacing="0" cellpadding="4">
|
||||
<tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
|
||||
<?php __("Domain name:"); ?></th><td>
|
||||
<?php echo $r["hostname"]; ?>
|
||||
</td></tr>
|
||||
<tr><th><label for="dir"><?php __("Folder where we will put the log file:"); ?></label></th><td><input type="text" class="int" name="dir" id="dir" value="<?php ehe($r["folder"]); ?>" size="20" maxlength="255" />
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.write(" <input type=\"button\" name=\"bff\" class=\"bff\" onclick=\"browseforfolder('main.dir');\" value=\" <?php __("Choose a folder..."); ?> \" />");
|
||||
// -->
|
||||
</script>
|
||||
</td></tr>
|
||||
<tr><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Change those Raw Statistics."); ?>" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php include_once("foot.php"); ?>
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: sta2_list.php,v 1.3 2005/05/08 20:23:11 arnaud-lb Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file:
|
||||
Purpose of file:
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
require_once("../class/config.php");
|
||||
|
||||
include_once("head.php");
|
||||
|
||||
?>
|
||||
<h3><?php __("Raw Statistics List"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
if ($quota->cancreate("sta2")) { ?>
|
||||
<p>
|
||||
<span class="ina"><a href="sta2_add_raw.php"><?php __("Create new Raw Statistics (apache)"); ?></a></span>
|
||||
</p>
|
||||
<?php }
|
||||
|
||||
if (isset($error) && $error) {
|
||||
echo "<p class=\"error\">$error</p>";
|
||||
}
|
||||
|
||||
if (!$r=$sta2->get_list_raw()) {
|
||||
$error=$err->errstr();
|
||||
echo "<p class=\"error\">$error</p>";
|
||||
} else {
|
||||
|
||||
?>
|
||||
|
||||
<form method="post" action="sta2_del_raw.php">
|
||||
<table class="tlist">
|
||||
<tr><th colspan="2"> </th><th><?php __("Domain name"); ?></th><th><?php __("Folder"); ?></th><th><?php __("View"); ?></th></tr>
|
||||
<?php
|
||||
reset($r);
|
||||
$col=1;
|
||||
while (list($key,$val)=each($r))
|
||||
{
|
||||
$col=3-$col;
|
||||
?>
|
||||
<tr class="lst<?php echo $col; ?>">
|
||||
<td><input type="checkbox" class="inc" name="del_<?php echo $val["id"]; ?>" value="<?php echo $val["id"]; ?>" /></td>
|
||||
<td><div class="ina"><a href="sta2_edit_raw.php?id=<?php echo $val["id"] ?>"><img src="images/edit.png" alt="<?php __("Edit"); ?>" alt="<?php __("Edit"); ?>" /><?php __("Edit"); ?></a></div></td>
|
||||
<td><?php echo $val["hostname"] ?></td>
|
||||
<td><code>/<?php echo $val["folder"] ?></code></td>
|
||||
<td><?php
|
||||
if ($uv=$bro->viewurl($val["folder"], $val["hostname"].'.log')) echo "<a href=\"$uv\">"._("View")."</a>";
|
||||
?> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<tr><td colspan="5"><input type="submit" class="inb" name="submit" value="<?php __("Delete the checked Raw Statistics (apache)"); ?>" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
<?php include_once("foot.php"); ?>
|
|
@ -1,300 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
$Id: m_sta2.php,v 1.10 2005/12/18 09:51:32 benjamin Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file: Benjamin Sonntag
|
||||
Purpose of file: Manage raw apache log availability for the users
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class manages raw Apache log file for the end users.
|
||||
*
|
||||
* This class allow each AlternC's account to get its raw apache log
|
||||
* file put in its user space every day. <br>
|
||||
* The file is stored in the user space and will grow from time to time...
|
||||
*
|
||||
* @copyright AlternC's Team 2002-2005 http://alternc.org/
|
||||
*
|
||||
*/
|
||||
class m_sta2 {
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/**
|
||||
* Constructor, dummy
|
||||
*/
|
||||
function m_sta2() {
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Returns the list of domains and/or subdomains for this account
|
||||
*
|
||||
* @return array returns an array with all the domains / subdomains for this account.
|
||||
*/
|
||||
function host_list() {
|
||||
global $db,$err,$cuid;
|
||||
$r=array();
|
||||
$db->query("SELECT domaine,sub FROM sub_domaines WHERE compte='$cuid' ORDER BY domaine,sub;");
|
||||
while ($db->next_record()) {
|
||||
if ($db->f("sub")) {
|
||||
$r[]=$db->f("sub").".".$db->f("domaine");
|
||||
} else {
|
||||
$r[]=$db->f("domaine");
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Draw option html tags of ths allowed domains / subdomains for the account.
|
||||
*
|
||||
* @param $current string The current selected value in the list
|
||||
*/
|
||||
function select_host_list($current) {
|
||||
$r=$this->host_list();
|
||||
reset($r);
|
||||
while (list($key,$val)=each($r)) {
|
||||
if ($current==$val) $c=" selected=\"selected\""; else $c="";
|
||||
echo "<option$c>$val</option>";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Hook function that delete a user's raw stats.
|
||||
*/
|
||||
function alternc_del_member() {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("sta2","del_member");
|
||||
$db->query("DELETE FROM stats2 WHERE mid='$cuid';");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Hook function that delete a user's domain, called by m_dom.
|
||||
* @param string $dom is the domain that is to be deleted.
|
||||
*/
|
||||
function alternc_del_domain($dom) {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("sta2","del_dom",$dom);
|
||||
// Suppression des stats apache brutes :
|
||||
$db->query("SELECT * FROM stats2 WHERE mid='$cuid' AND hostname like '%$dom'");
|
||||
$cnt=0;
|
||||
$t=array();
|
||||
while ($db->next_record()) {
|
||||
$cnt++;
|
||||
$t[]=$db->f("hostname");
|
||||
}
|
||||
// on détruit les jeux de stats associés au préfixe correspondant :
|
||||
for($i=0;$i<$cnt;$i++) {
|
||||
$db->query("DELETE FROM stats2 WHERE mid='$cuid' AND hostname='".$t[$i]."';");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Returns an array with the user's raw stat list
|
||||
* The returned array is as follow :
|
||||
* $r[0-n]["id"] = Id of the raw stat set.
|
||||
* $r[0-n]["hostname"]= Domain
|
||||
* $r[0-n]["folder"]= Destination's folder (in the user space)
|
||||
*
|
||||
* @return array Returns the array or FALSE if an error occured.
|
||||
*/
|
||||
function get_list_raw() {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("sta2","get_list_raw");
|
||||
$r=array();
|
||||
$db->query("SELECT id, hostname, folder FROM stats2 WHERE mid='$cuid' ORDER BY hostname;");
|
||||
if ($db->num_rows()) {
|
||||
while ($db->next_record()) {
|
||||
// We skip /var/alternc/html/u/user
|
||||
// FIXME: utiliser ALTERNC_HTML au lieu de /var/alternc/html/
|
||||
preg_match("/^\/var\/alternc\/html\/.\/[^\/]*\/(.*)/", $db->f("folder"),$match);
|
||||
$r[]=array(
|
||||
"id"=>$db->f("id"),
|
||||
"hostname"=>$db->f("hostname"),
|
||||
"folder"=>$match[1]
|
||||
);
|
||||
}
|
||||
return $r;
|
||||
} else {
|
||||
$err->raise("sta2",_("You cannot create more raw statistic set."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Get the details of a raw statistic set.
|
||||
*
|
||||
* This function returns the details of a raw statistic set (raw logs)
|
||||
* The returned value is an associative array as follow :
|
||||
* $ret["id"] = raw stat id.
|
||||
* $ret["hostname"] = the domain we get the raw log.
|
||||
* $ret["folder"] = the destination folder for the logs (inside the user space)
|
||||
* @param $id string The raw stat number we want details of.
|
||||
* @return array returns an array with the raw log parameters or FALSE if an error occured.
|
||||
*/
|
||||
function get_stats_details_raw($id) {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("sta2","get_stats_details_raw",$id);
|
||||
$r=array();
|
||||
$db->query("SELECT id, hostname, folder FROM stats2 WHERE mid='$cuid' AND id='$id';");
|
||||
if ($db->num_rows()) {
|
||||
$db->next_record();
|
||||
// We skip /var/alternc/html/u/user
|
||||
// FIXME: utiliser ALTERNC_HTML au lieu de /var/alternc/html/
|
||||
preg_match("/^\/var\/alternc\/html\/.\/[^\/]*\/(.*)/", $db->f("folder"),$match);
|
||||
return array(
|
||||
"id"=>$db->f("id"),
|
||||
"hostname"=> $db->f("hostname"),
|
||||
"folder"=>$match[1]
|
||||
);
|
||||
} else {
|
||||
$err->raise("sta2",_("The requested raw statistic set has not been found."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Edit a raw statistic set.
|
||||
*
|
||||
* This function edit a raw statistic set.
|
||||
* $folder is the new destination folder inside the user space where the log
|
||||
* file will be put.
|
||||
* @param $id integer The raw statistic number we are changing
|
||||
* @param $folder string new destination folder
|
||||
* @return boolean TRUE if the set has been changed, FALSE if an error occured.
|
||||
*/
|
||||
function put_stats_details_raw($id,$folder) {
|
||||
global $db,$err,$bro,$mem,$cuid;
|
||||
$err->log("sta2","put_stats_details_raw",$id);
|
||||
$db->query("SELECT count(*) AS cnt FROM stats2 WHERE id='$id' and mid='$cuid';");
|
||||
$db->next_record();
|
||||
if (!$db->f("cnt")) {
|
||||
$err->raise("sta2",_("The requested raw statistic set has not been found."));
|
||||
return false;
|
||||
}
|
||||
// TODO : replace with ,1 on convertabsolute call, and delete "/Var/alternc.../" at the query. ???
|
||||
$folder=$bro->convertabsolute($folder);
|
||||
if (substr($folder,0,1)=="/") {
|
||||
$folder=substr($folder,1);
|
||||
}
|
||||
$db->query("UPDATE stats2 SET folder='".getuserpath()."/$folder', mid='$cuid' WHERE id='$id';");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Delete a raw statistic set
|
||||
*
|
||||
* This function erase the raw statistic set pointed to by $id.
|
||||
* The raw log files that may be present in the folder will NOT be deleted.
|
||||
* @param $id integer is the set that has to be deleted.
|
||||
* @return boolean TRUE if the raw stat has been deleted, FALSE if an error occured.
|
||||
*/
|
||||
function delete_stats_raw($id) {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("sta2","delete_stats_raw",$id);
|
||||
$db->query("SELECT hostname FROM stats2 WHERE id='$id' and mid='$cuid';");
|
||||
if (!$db->num_rows()) {
|
||||
$err->raise("sta2",_("The requested raw statistic set has not been found."));
|
||||
return false;
|
||||
}
|
||||
$db->next_record();
|
||||
$db->query("DELETE FROM stats2 WHERE id='$id'");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Create a new raw statistic set (raw log)
|
||||
* This function create a new raw log set for the current user.
|
||||
* The raw statistics allow any user to get its raw apache log put daily in
|
||||
* one of its folders in its user space.
|
||||
* @param $hostname string this is the domain name (hosted by the current user)
|
||||
* for which we want raw logs
|
||||
* @param $dir string this is the folder where we will put the raw log files.
|
||||
* @return boolean TRUE if the set has been created, or FALSE if an error occured.
|
||||
*/
|
||||
function add_stats_raw($hostname,$dir) {
|
||||
global $db,$err,$quota,$bro,$mem,$cuid;
|
||||
$err->log("sta2","add_stats_raw",$hostname);
|
||||
// TODO : utiliser le second param de convertabsolute pour simplification.
|
||||
$dir=$bro->convertabsolute($dir);
|
||||
if (substr($dir,0,1)=="/") {
|
||||
$dir=substr($dir,1);
|
||||
}
|
||||
if ($quota->cancreate("sta2")) {
|
||||
$db->query("INSERT INTO stats2 (hostname,folder,mid) VALUES ('$hostname','".getuserpath()."/$dir','$cuid')");
|
||||
return true;
|
||||
} else {
|
||||
$err->raise("sta2",_("You cannot create more raw statistic set."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Quota computing Hook function
|
||||
* This is the quota computing hook function for sta2. It computes the
|
||||
* used quota of raw stats for the current user.
|
||||
* @param $name string name of the quota
|
||||
* @return integer the number of service used or false if an error occured
|
||||
* @access private
|
||||
*/
|
||||
function hook_quota_get() {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("sta2","get_quota");
|
||||
$q=Array("name"=>"sta2", "description"=>_("RAW Statistics"), "used"=>0);
|
||||
$db->query("SELECT COUNT(*) AS cnt FROM stats2 WHERE mid='$cuid'");
|
||||
if ($db->next_record()) {
|
||||
$q['used']=$db->f("cnt");
|
||||
}
|
||||
return $q;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/**
|
||||
* Exporte toutes les informations states brutes du compte.
|
||||
* @access private
|
||||
* EXPERIMENTAL 'sid' function ;)
|
||||
*/
|
||||
function alternc_export_conf() {
|
||||
global $db,$err;
|
||||
$err->log("sta2","export");
|
||||
$f=$this->get_list_raw();
|
||||
$str="<sta2>\n";
|
||||
foreach ($f as $d) {
|
||||
$str.=" <stats>\n";
|
||||
$str.=" <hostname>".($s[hostname])."</hostname>\n";
|
||||
$str.=" <folder>".($s[folder])."</folder>\n";
|
||||
$str.=" </stats>\n";
|
||||
}
|
||||
$str.="</sta2>\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
} /* CLASSE m_sta2 */
|
||||
|
||||
?>
|
|
@ -1,6 +1,3 @@
|
|||
# Every day at 4am, produce raw statistics
|
||||
0 4 * * * root /usr/lib/alternc/rawstat.daily
|
||||
|
||||
# Every 2 days compress log files
|
||||
0 4 * * * alterncpanel /usr/lib/alternc/compress_logs.sh
|
||||
|
||||
|
|
|
@ -279,21 +279,6 @@ CREATE TABLE IF NOT EXISTS `recipient` (
|
|||
) COMMENT = 'Table containing other recipients (aliases) for an address.';
|
||||
|
||||
|
||||
--
|
||||
-- Structure de la table `stats3`
|
||||
--
|
||||
-- Liste des jeux de stat brutes demandées sur le serveur
|
||||
|
||||
CREATE TABLE IF NOT EXISTS stats2 (
|
||||
id int(10) unsigned NOT NULL auto_increment, -- Numéro du jeu de stat brut
|
||||
mid int(10) unsigned NOT NULL default '0', -- Numéro de l`utilisateur
|
||||
hostname varchar(255) NOT NULL default '', -- Domaine concerné
|
||||
folder varchar(255) NOT NULL default '', -- Dossier de stockage des logs
|
||||
PRIMARY KEY (id),
|
||||
KEY mid (mid)
|
||||
) TYPE=MyISAM COMMENT='Statistiques apaches brutes';
|
||||
|
||||
|
||||
--
|
||||
-- Structure de la table `defquotas`
|
||||
--
|
||||
|
@ -317,7 +302,6 @@ INSERT IGNORE INTO defquotas (quota,value) VALUES ('mail',10);
|
|||
INSERT IGNORE INTO defquotas (quota,value) VALUES ('ftp',2);
|
||||
INSERT IGNORE INTO defquotas (quota,value) VALUES ('stats',1);
|
||||
INSERT IGNORE INTO defquotas (quota,value) VALUES ('mysql',1);
|
||||
INSERT IGNORE INTO defquotas (quota,value) VALUES ('mysql_users',1);
|
||||
|
||||
|
||||
--
|
||||
|
|
|
@ -217,3 +217,9 @@ CREATE TABLE IF NOT EXISTS `piwik_sites` (
|
|||
-- No longer MySQL User quotas
|
||||
DELETE FROM defquotas WHERE quota = 'mysql_users';
|
||||
DELETE FROM quotas WHERE name = 'mysql_users';
|
||||
|
||||
-- Raw web statistics are deprecated since vlogger
|
||||
DELETE FROM quotas WHERE name = 'sta2';
|
||||
DELETE FROM defquotas WHERE quota = 'sta2';
|
||||
|
||||
DROP TABLE stats2;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
# ----------------------------------------------------------------------
|
||||
#
|
||||
SETUID=quota_edit quota_get mem_add mem_del du.pl
|
||||
SCRIPTS=sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh postfix-add-policy
|
||||
SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh postfix-add-policy
|
||||
LIBS=functions.sh functions_hosting.sh functions_dns.sh
|
||||
BIN=$(DESTDIR)/usr/lib/alternc/
|
||||
|
||||
|
|
|
@ -1,220 +0,0 @@
|
|||
#!/usr/bin/php -q
|
||||
<?php
|
||||
/*
|
||||
$Id: rawstat.daily,v 1.4 2005/05/11 15:39:34 arnaud-lb Exp $
|
||||
----------------------------------------------------------------------
|
||||
AlternC - Web Hosting System
|
||||
Copyright (C) 2002 by the AlternC Development Team.
|
||||
http://alternc.org/
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||
----------------------------------------------------------------------
|
||||
LICENSE
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License (GPL)
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||
----------------------------------------------------------------------
|
||||
Original Author of file: Arnaud lb
|
||||
Purpose of file: Provides raw statistics to members
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
require("/var/alternc/bureau/class/local.php");
|
||||
$FILES_OWNER = 33;
|
||||
$APACHE_LOG = '/var/log/apache/access.log.1';
|
||||
$APACHE2_LOG = '/var/log/apache2/access.log';
|
||||
umask(0177);
|
||||
$hosts = array();
|
||||
$nolog_hosts = array();
|
||||
$LOGS_SUFIX='.log';//For testing
|
||||
|
||||
if (!mysql_connect($L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD)) {
|
||||
echo "Cannot connect to Mysql !\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!mysql_select_db($L_MYSQL_DATABASE)) {
|
||||
echo "Cannot connect to Mysql database $L_MYSQL_DATABASE !\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
$query = "SELECT mid,folder,hostname FROM stats2 ORDER BY CHAR_LENGTH(hostname) ASC";
|
||||
$result = mysql_query($query);
|
||||
if (mysql_errno()) {
|
||||
echo 'MySQL error: '.mysql_error()."\n";
|
||||
}
|
||||
|
||||
//Fetch the list of raw stats, and caching some data
|
||||
while ($row = mysql_fetch_assoc($result)) {
|
||||
$hosts[$row['hostname']] = array(
|
||||
'mid'=>$row['mid'],
|
||||
'log_files'=>array(
|
||||
$row['folder'].'/'.$row['hostname'].$LOGS_SUFIX =>''
|
||||
)
|
||||
);
|
||||
|
||||
//A log line with host.test.com should go to the test.com's log file too, if the member want logs for host.test.com and test.com.
|
||||
$parent_host = $row['hostname'];
|
||||
while ($pos = strpos($parent_host, '.')) {
|
||||
$parent_host = substr($parent_host, $pos+1);
|
||||
if (!isset($hosts[$parent_host])) {
|
||||
continue;
|
||||
}
|
||||
//link the parent-hostnames's log-files in this host
|
||||
$parent_log_files = array_keys($hosts[$parent_host]['log_files']);
|
||||
foreach($parent_log_files as $parent_log_file) {
|
||||
$hosts[$row['hostname']]['log_files'][$parent_log_file] = &$hosts[$parent_host]['log_files'][$parent_log_file];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Open apache log file
|
||||
//Open apache log file
|
||||
if (!$apache_log_file = @fopen($APACHE_LOG, 'r')) {
|
||||
if (!$apache_log_file = @fopen($APACHE2_LOG, 'r')) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Parsing log file
|
||||
while ($line = fgets($apache_log_file)) {
|
||||
|
||||
//Get the hostname in this log line
|
||||
//assume that hostname is at end of line and separated with a space
|
||||
$host = substr($line, strrpos($line, ' ')+1, -1);
|
||||
|
||||
if (isset($hosts[$host]) && is_null($hosts[$host])) {
|
||||
unset($hosts[$host]);
|
||||
$nolog_hosts[$host]='';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($nolog_hosts[$host])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//If hostname is not listed in hostnames to log, link it to a listed parent if exists.
|
||||
//Processed only one time by not listed hostname
|
||||
if (!isset($hosts[$host])) {
|
||||
$parent_host = $host;
|
||||
while ($pos = strpos($parent_host, '.')) {
|
||||
$parent_host = substr($parent_host, $pos+1);
|
||||
if (isset($nolog_hosts[$parent_host])) {
|
||||
$pos = false;
|
||||
break;
|
||||
}
|
||||
if (isset($hosts[$parent_host]) && is_null($hosts[$parent_host])) {
|
||||
unset($hosts[$parent_host]);
|
||||
$nolog_hosts[$parent_host]='';
|
||||
$pos = false;
|
||||
break;
|
||||
}
|
||||
if (isset($hosts[$parent_host])) {
|
||||
//link this host to the parent hostname
|
||||
$hosts[$host] = &$hosts[$parent_host];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($pos === false) {
|
||||
//We will not have to search again for this host
|
||||
$nolog_hosts[$host]='';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$log_files = array_keys($hosts[$host]['log_files']);
|
||||
if (count($log_files) < 1) {
|
||||
$hosts[$host] = null;
|
||||
unset($hosts[$host]);
|
||||
$nolog_hosts[$host]='';
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($log_files as $log_file) {
|
||||
|
||||
if (is_null($hosts[$host]['log_files'][$log_file])) {
|
||||
// has been set to null throught a reference for a future unset
|
||||
unset($hosts[$host]['log_files'][$log_file]);
|
||||
continue;
|
||||
}
|
||||
|
||||
//file isn't opened yet
|
||||
if (!is_resource($hosts[$host]['log_files'][$log_file])) {
|
||||
|
||||
//Log file doesn't exists, we create an empty one with good owner and perms
|
||||
if (!file_exists($log_file)) {
|
||||
if (!touch($log_file)) {
|
||||
$hosts[$host]['log_files'][$log_file] = null;
|
||||
unset($hosts[$host]['log_files'][$log_file]);
|
||||
continue;
|
||||
}
|
||||
if (!chgrp($log_file, (int)$hosts[$host]['mid'])) {
|
||||
unlink($log_file);
|
||||
$hosts[$host]['log_files'][$log_file] = null;
|
||||
unset($hosts[$host]['log_files'][$log_file]);
|
||||
continue;
|
||||
}
|
||||
if (!chown($log_file, (int)$FILES_OWNER)) {
|
||||
unlink($log_file);
|
||||
$hosts[$host]['log_files'][$log_file] = null;
|
||||
unset($hosts[$host]['log_files'][$log_file]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Open the log file
|
||||
if (!$hosts[$host]['log_files'][$log_file] = fopen($log_file, 'a')) {
|
||||
$hosts[$host]['log_files'][$log_file] = null;
|
||||
unset($hosts[$host]['log_files'][$log_file]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Write the log line
|
||||
if (!fwrite($hosts[$host]['log_files'][$log_file], $line)) {
|
||||
fclose($hosts[$host]['log_files'][$log_file]);
|
||||
$hosts[$host]['log_files'][$log_file] = null;
|
||||
unset($hosts[$host]['log_files'][$log_file]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Close all opened files
|
||||
$hostnames = array_keys($hosts);
|
||||
while ($host = array_pop($hostnames)) {
|
||||
if (is_null($hosts[$hostname]['log_files'])) {
|
||||
unset($hosts[$hostname]['log_files'][$log_file]);
|
||||
continue;
|
||||
}
|
||||
$log_files = array_keys($hosts[$hostname]['log_files']);
|
||||
while ($log_file = array_pop($log_files)) {
|
||||
if (is_null($hosts[$hostname]['log_files'][$log_file])) {
|
||||
unset($hosts[$hostname]['log_files'][$log_file]);
|
||||
continue;
|
||||
}
|
||||
if (is_resource($hosts[$hostname]['log_files'][$log_file])) {
|
||||
fclose($hosts[$hostname]['log_files'][$log_file]);
|
||||
$hosts[$hostname]['log_files'][$log_file] = null;
|
||||
unset($hosts[$hostname]['log_files'][$log_file]);
|
||||
}
|
||||
}
|
||||
$hosts[$hostname] = null;
|
||||
unset($hosts[$hostname]);
|
||||
}
|
||||
|
||||
fclose($apache_log_file);
|
||||
|
||||
return 0;
|
||||
?>
|
Loading…
Reference in New Issue