function Autocount() { $auto = new autofs(); $hash = $auto->automounts_Browse(); $sock = new sockets(); $count = count($hash); echo "Starting......: " . date("H:i:s") . " AutoFS {$count} mounted directories\n"; $sock->SET_INFO("AutoFSCountDirs", $count); }
function popup() { $tpl = new templates(); $page = CurrentPageName(); $add = Paragraphe("64-wizard.png", "{add_mount_point}", "{add_mount_point_text}", "javascript:Loadjs('autofs.php?form-add-js=yes&field={$_GET["field"]}')"); $autofs = new autofs(); $hash = $autofs->automounts_Browse(); if (count($hash) > 0) { $list = Paragraphe("wifi-ok-64.png", "{mounts_list} (." . count($hash) . ")", "{mounts_list_explain}", "javascript:Loadjs('autofs.php?mounts-list-js=yes&field={$_GET["field"]}')"); } $html = "\n\t<div style='width:99%' class=form>\t\t\n\t<div style='font-size:14px' class=explain>{autofs_wizard_explain}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=50% align=center>{$add}</td>\n\t\t<td width=50% align=center>{$list}</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\t\t\n\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function mount_list() { $field = $_GET["field"]; $autofs = new autofs(); $hash = $autofs->automounts_Browse(); $title = "/automounts/..."; if ($field != null) { $title = "{SELECT_RESSOURCE}"; } $html = "\n\t<H3>{$title}</H3>\n\t<table style='width:100%'>"; while (list($mount, $array) = each($hash)) { $js = null; $delete = imgtootltip('ed_delete.gif', '{delete}', "AutoMountDelete('{$mount}')"); if ($field != null) { $delete = imgtootltip('add-18.gif', '{SELECT_RESSOURCE}', "AutoMountSelect('{$mount}')"); $js = "AutoMountSelect('{$mount}')"; } $html = $html . "<tr " . CellRollOver($js) . ">\n\t\t<td valign='top' width=1%><img src='img/fw_bold.gif'></td>\n\t\t<td valign='top' width=1%><code style='font-weight:bold'>{$mount}</code></td>\n\t\t<td valign='top' width=1%><code style='font-weight:bold'>{$array["FS"]}</code></td>\n\t\t<td valign='top' width=99%><code style='font-weight:bold;font-size:9px'>{$array["SRC"]}</code></td>\n\t\t<td valign='top' width=1%>{$delete}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=5 align='right'>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . texttooltip('{backup}', '{automount_add_backup}', "Loadjs('cyrus.backup.php?add-automount={$mount}')") . " | \n\t\t\t\t\t\t" . texttooltip('{restore}', '{automount_restore_from}', "Loadjs('cyrus.backup.restore.php?automount={$mount}')") . " | \n\t\t\t\t\t\t\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t<hr>\n\t\t\t</td>\n\t\t</tr>\n\t\t\t"; } $html = $html . "</table>"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html, 'automount.php'); }
function SHARED_REBUILD() { $autofs = new autofs(); $autofs->AutofsSharedDir($_GET["shared-rebuild"]); }
function autofs_remove() { $sock = new sockets(); $lvs = $_POST["lvs"]; $vg = $_POST["vg"]; $array = unserialize(base64_decode($sock->getFrameWork("lvm.php?lvdisplay=" . urlencode($vg)))); $status = $array["/dev/{$vg}/{$lvs}"]; $auto = new autofs(); $auto->uuid = $status["INFOS"]["UUID"]; $auto->by_uuid_removemedia("{$vg}-{$lvs}", "auto"); }
function nfs_delete() { $mount = $_GET["nfs-delete"]; $auto = new autofs(); $auto->nfs_delete($mount); }
function automount_del() { $uuid = $_GET["automount-del"]; $folder = $_GET["automount-folder"]; $autfs = new autofs($uuid); $autfs->by_uuid_removemedia($folder, $uuid); }
function Autocount() { if (isset($GLOBALS["AutocountEXec"])) { return; } $GLOBALS["AutocountEXec"] = true; $auto = new autofs(); $hash = $auto->automounts_Browse(); $sock = new sockets(); $count = count($hash); echo "Starting......: " . date("H:i:s") . " AutoFS {$count} mounted directories\n"; $sock->SET_INFO("AutoFSCountDirs", $count); }
function item_popup() { $ldap = new clladp(); $tpl = new templates(); $page = CurrentPageName(); $id = $_GET["item-id"]; if (!is_numeric($id)) { $id = 0; } $t = $_GET["t"]; $bname = "{add}"; $ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM = $tpl->javascript_parse_text("{ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}"); $q = new mysql(); if ($id > 0) { $bname = "{apply}"; $sql = "SELECT * FROM xapian_folders WHERE ID={$id}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $directory = $ligne["directory"]; $depth = $ligne["depth"]; $maxsize = $ligne["maxsize"]; $samplsize = $ligne["sample-size"]; $lang = $ligne["lang"]; $DiplayFullPath = $ligne["DiplayFullPath"]; $AllowDownload = $ligne["AllowDownload"]; $WebCopyID = $ligne["WebCopyID"]; $autmountdn = $ligne["autmountdn"]; } if ($lang == null) { $lang = "english"; } if (!is_numeric($samplsize)) { $samplsize = 512; } if (!is_numeric($maxsize)) { $maxsize = 60; } if (!is_numeric($depth)) { $depth = 0; } $l["none"] = "none"; $l["danish"] = "danish"; $l["dutch"] = "dutch"; $l["english"] = "english"; $l["finnish"] = "finnish"; $l["french"] = "french"; $l["german"] = "german"; $l["german2"] = "german2"; $l["hungarian"] = "hungarian"; $l["italian"] = "italian"; $l["kraaij_pohlmann"] = "kraaij_pohlmann"; $l["lovins"] = "lovins"; $l["norwegian"] = "norwegian"; $l["porter"] = "porter"; $l["portuguese"] = "portuguese"; $l["romanian"] = "romanian"; $l["russian"] = "russian"; $WebCopyCount = $q->COUNT_ROWS("httrack_sites", "artica_backup"); if ($WebCopyCount > 0) { $sql = "SELECT ID,sitename FROM httrack_sites"; $results_webcopy = $q->QUERY_SQL($sql, "artica_backup"); $WebCopyHash[0] = "{none}"; while ($ligneWebCopy = mysql_fetch_assoc($results_webcopy)) { $WebCopyHash[$ligneWebCopy["ID"]] = $ligneWebCopy["sitename"]; } $WebCopyTR = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:14px'>WebCopy:</td>\n\t\t\t\t<td>" . Field_array_Hash($WebCopyHash, "WebCopyID-{$t}", $WebCopyID, "WebCopyCheck{$t}()", null, 0, "font-size:14px") . "</td>\n\t\t\t\t<td></td>\n\t\t\t</tr>"; } $autofs = new autofs(); $autofs->automounts_Browse(); if (count($autofs->hash_by_dn) > 0) { while (list($dn, $dnarr) = each($autofs->hash_by_dn)) { $autofsDNS[null] = "{none}"; $InfosDN = $dnarr["INFOS"]["FS"]; $autofsDNS[$dn] = $dnarr["FOLDER"] . " ({$InfosDN})"; } $autofsTR = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:14px'>{automount}:</td>\n\t\t\t\t<td>" . Field_array_Hash($autofsDNS, "autmountdn-{$t}", $autmountdn, "autmountdnCheck{$t}()", null, 0, "font-size:14px") . "</td>\n\t\t\t\t<td></td>\n\t\t\t</tr>"; } $language = Field_array_Hash($l, "lang-{$t}", $lang, null, null, 0, "font-size:14px"); $html = "\t\t\n<div id='anime-{$t}'></div>\n<table style='width:99%' class=form>\n<tr>\t\n\t<td class=legend style='font-size:14px' nowrap>{directory}:</strong></td>\n\t<td align=left>" . Field_text("directory-{$t}", $directory, "width:280px;font-size:14px", "script:SaveDirXapCheck(event)") . "</strong></td>\n\t<td width=1%>" . button("{browse}", "javascript:Loadjs('browse-disk.php?field=directory-{$t}&replace-start-root=0');") . "</td>\n<tr>\n{$WebCopyTR}\n{$autofsTR}\n<tr>\n\t<td class=legend style='font-size:14px' nowrap>{depth}:</strong></td>\n\t<td align=left style='font-size:14px'>" . Field_text("depth-{$t}", $depth, "width:60px;font-size:14px", "script:SaveDirXapCheck(event)") . " {levels}</strong></td>\n\t<td> </td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px' nowrap>{maxsize}:</strong></td>\n\t<td align=left style='font-size:14px'>" . Field_text("maxsize-{$t}", $maxsize, "width:60px;font-size:14px", "script:SaveDirXapCheck(event)") . " M</strong></td>\n\t<td> </td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px' nowrap>{sample-size}:</strong></td>\n\t<td align=left style='font-size:14px'>" . Field_text("samplsize-{$t}", $samplsize, "width:60px;font-size:14px", "script:SaveDirXapCheck(event)") . " Bytes</strong></td>\n\t<td> </td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px' nowrap>{DiplayFullPath}:</strong></td>\n\t<td align=left style='font-size:14px'>" . Field_checkbox("DiplayFullPath", 1, $DiplayFullPath) . "</td>\n\t<td> </td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px' nowrap>{AllowPublicDownload}:</strong></td>\n\t<td align=left style='font-size:14px'>" . Field_checkbox("AllowDownload", 1, $AllowDownload) . "</td>\n\t<td> </td>\n</tr>\n\n<tr>\n\t<td class=legend style='font-size:14px' nowrap>{language}:</strong></td>\n\t<td align=left>{$language}</strong></td>\n\t<td> </td>\n</tr>\n<tr>\t\n\t<td colspan=3 align='right'><hr>" . button("{$bname}", "SaveDirXap{$t}();", "18px") . "</td>\n<tr>\n</table>\n<script>\n\n\t\tfunction SaveDirXapCheck(e){\n\t\t\tSaveDNSCheckFields();\n\t\t\tif(checkEnter(e)){SaveDirXap{$t}();return;}\n\t\t}\n\t\t\n\n\t\tvar x_SaveDirXap{$t}=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tdocument.getElementById('anime-{$t}').innerHTML='';\n\t\t\tif (results.length>3){alert(results);return;}\n\t\t\t\$('#flexRT{$t}').flexReload();\n\t\t}\n\n\t\tfunction WebCopyCheck{$t}(){\n\t\t\tif(!document.getElementById('WebCopyID-{$t}')){return;}\n\t\t\tvar sid=document.getElementById('WebCopyID-{$t}').value;\n\t\t\tif(sid>0){\n\t\t\t\tdocument.getElementById('directory-{$t}').disabled=true;\n\t\t\t\tdocument.getElementById('DiplayFullPath').disabled=true;\n\t\t\t\tdocument.getElementById('AllowDownload').disabled=true;\n\t\t\t\tif(document.getElementById('autmountdn-{$t}')){document.getElementById('autmountdn-{$t}').disabled=true;}\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('directory-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('DiplayFullPath').disabled=false;\n\t\t\t\tdocument.getElementById('AllowDownload').disabled=false;\t\t\n\t\t\t\tif(document.getElementById('autmountdn-{$t}')){document.getElementById('autmountdn-{$t}').disabled=false;}\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction autmountdnCheck{$t}(){\n\t\t\tif(!document.getElementById('autmountdn-{$t}')){return;}\n\t\t\tvar sid=document.getElementById('autmountdn-{$t}').value;\n\t\t\tif(sid.length>0){\n\t\t\t\tdocument.getElementById('directory-{$t}').disabled=true;\n\t\t\t\tdocument.getElementById('DiplayFullPath').disabled=true;\n\t\t\t\tdocument.getElementById('AllowDownload').disabled=true;\n\t\t\t\tif(document.getElementById('WebCopyID-{$t}')){document.getElementById('WebCopyID-{$t}').disabled=true;}\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('directory-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('DiplayFullPath').disabled=false;\n\t\t\t\tdocument.getElementById('AllowDownload').disabled=false;\t\t\n\t\t\t\tif(document.getElementById('WebCopyID-{$t}')){document.getElementById('WebCopyID-{$t}').disabled=false;}\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction SaveDirXap{$t}(){\n\t\t\tvar ok=1;\n\t\t\tWebCopyID=0;\n\t\t\tvar directory=document.getElementById('directory-{$t}').value;\n\t\t\tif(document.getElementById('WebCopyID-{$t}')){WebCopyID=document.getElementById('WebCopyID-{$t}').value;}\n\t\t\tif(document.getElementById('autmountdn-{$t}')){autmountdn=document.getElementById('autmountdn-{$t}').value;}\n\t\t\tif(WebCopyID>0){directory='';}\n\t\t\tif(WebCopyID==0){if(directory.length==0){ok=0;}}\n\t\t\tif(autmountdn.length>1){if(directory.length==0){ok=1;directory='';}}\n\t\t\tif(ok==0){alert('{$ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}');return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tvar pp=encodeURIComponent(document.getElementById('directory-{$t}').value);\n\t\t\tXHR.appendData('ID','{$id}');\n\t\t\tXHR.appendData('directory',pp);\n\t\t\tXHR.appendData('depth',document.getElementById('depth-{$t}').value);\n\t\t\tXHR.appendData('lang',document.getElementById('lang-{$t}').value);\n\t\t\tXHR.appendData('maxsize',document.getElementById('maxsize-{$t}').value);\n\t\t\tXHR.appendData('samplsize',document.getElementById('samplsize-{$t}').value);\n\t\t\tif(document.getElementById('WebCopyID-{$t}')){XHR.appendData('WebCopyID',document.getElementById('WebCopyID-{$t}').value);}\n\t\t\tif(document.getElementById('autmountdn-{$t}')){XHR.appendData('autmountdn',document.getElementById('autmountdn-{$t}').value);}\n\t\t\tif(document.getElementById('DiplayFullPath').checked){XHR.appendData('DiplayFullPath',1);}else{XHR.appendData('DiplayFullPath',0);}\n\t\t\tif(document.getElementById('AllowDownload').checked){XHR.appendData('AllowDownload',1);}else{XHR.appendData('AllowDownload',0);}\n\t\t\tAnimateDiv('anime-{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveDirXap{$t});\n\t\t\n\t\t}\n\t\t\n\t\tWebCopyCheck{$t}();\n\t\tautmountdnCheck{$t}();\n</script>\n\n"; echo $tpl->_ENGINE_parse_body($html); }
function mounts_delete() { $ldap = new clladp(); $auto = new autofs(); $auto->automounts_Browse(); $INFOS = $auto->hash_by_dn[$_GET["AutoFSDeleteDN"]]; $FOLDER = $INFOS["FOLDER"]; $FOLDER = addslashes($FOLDER); $q = new mysql(); $sql = "DELETE FROM automount_davfs WHERE local_dir='{$FOLDER}'"; $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; } if (!$ldap->ldap_delete($_GET["AutoFSDeleteDN"])) { echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error; return; } $sock = new sockets(); $sock->getFrameWork("cmd.php?autofs-reload=yes"); }
function build() { @unlink("/etc/greyhole.conf"); if (!checkdb()) { echo "Starting......: " . date("H:i:s") . " Checking database failed\n"; return; } @mkdir("/var/spool/greyhole", 0777, true); shell_exec("/bin/chmod 777 /var/spool/greyhole >/dev/null 2>&1"); $sock = new sockets(); $EnableGreyHoleDebug = $sock->GET_INFO("EnableGreyHoleDebug"); if (!is_numeric($EnableGreyHoleDebug)) { $EnableGreyHoleDebug = 0; } if ($EnableGreyHoleDebug == 1) { $DEBUG = "DEBUG"; } else { $DEBUG = "INFO"; } echo "Starting......: " . date("H:i:s") . " greyhole verbosity {$DEBUG}\n"; $unix = new unix(); $q = new mysql(); $f[] = "db_engine = mysql"; $f[] = "db_host = {$q->mysql_server}"; $f[] = "db_user = {$q->mysql_admin}"; $f[] = "db_pass = {$q->mysql_password}"; $f[] = "db_name = greyhole"; $f[] = "email_to = root"; $f[] = "greyhole_log_file = /var/log/greyhole.log"; $f[] = "log_level = {$DEBUG}"; $f[] = "log_memory_usage = no"; $f[] = "df_cache_time = 15"; $f[] = "balance_modified_files = no"; $f[] = "check_for_open_files = yes"; $f[] = "max_queued_tasks = 100000"; $f[] = "dir_selection_algorithm = most_available_space"; $touch = $unix->find_program("touch"); $sql = "SELECT * FROM greyhole_spools ORDER BY free_g DESC"; $results = $q->QUERY_SQL($sql, "artica_backup"); $autofs = new autofs(); $hash = $autofs->automounts_Browse(); if (!$q->ok) { echo $q->mysql_error; @file_put_contents("/etc/greyhole.conf", "#"); } $count = mysql_num_rows($results); if ($count == 0) { echo "Starting......: " . date("H:i:s") . " greyhole no pool defined\n"; return; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $array = $autofs->hash_by_dn[$ligne["dn"]]; $FOLDER = $array["FOLDER"]; $size = $ligne["free_g"]; echo "Starting......: " . date("H:i:s") . " greyhole storage pool directory {$FOLDER} min_free: {$size}gb\n"; $f[] = "storage_pool_directory = /automounts/{$FOLDER}, min_free: {$size}gb"; if (!is_file("/automounts/{$FOLDER}/.greyhole_uses_this")) { @file_put_contents("/automounts/{$FOLDER}/.greyhole_uses_this", "#"); } } $sql = "SELECT * FROM `greyhole_dirs` WHERE num_copies > 0"; $results = $q->QUERY_SQL($sql, "artica_backup"); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { echo "Starting......: " . date("H:i:s") . " greyhole {$ligne["shared_dir"]} with {$ligne["num_copies"]} num_copies\n"; $f[] = "num_copies[{$ligne["shared_dir"]}] = {$ligne["num_copies"]}"; } $unix = new unix(); $modprobe = $unix->find_program("modprobe"); shell_exec("{$modprobe} cifs >/dev/null 2>&1"); @file_put_contents("/proc/fs/cifs/OplockEnabled", "0"); @file_put_contents("/etc/greyhole.conf", @implode("\n", $f)); }
function mounts_delete() { $ldap = new clladp(); include_once 'ressources/class.samba.inc'; $auto = new autofs(); $auto->automounts_Browse(); $INFOS = $auto->hash_by_dn[$_GET["AutoFSDeleteDN"]]; $FOLDER = $INFOS["FOLDER"]; $fullpath = "/automounts/{$FOLDER}"; $FOLDER = addslashes($FOLDER); $q = new mysql(); $sql = "DELETE FROM automount_davfs WHERE local_dir='{$FOLDER}'"; $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $sql = "DELETE FROM xapian_folders WHERE autmountdn='{$_GET["AutoFSDeleteDN"]}'"; $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $samba = new samba(); if (isset($samba->main_shared_folders[$fullpath])) { unset($samba->main_array[$samba->main_shared_folders[$fullpath]]); $samba->SaveToLdap(); } if (!$ldap->ldap_delete($_GET["AutoFSDeleteDN"])) { echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error; return; } $sock = new sockets(); $sock->getFrameWork("autofs.php?autofs-reload=yes"); }
function page() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $AutoFSEnabled = 1; $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $EnableIntelCeleron = intval($sock->GET_INFO("EnableIntelCeleron")); if ($SquidPerformance > 2) { $AutoFSEnabled = 0; } if ($EnableIntelCeleron == 1) { $AutoFSEnabled = 0; } $LogRotatePath = $sock->GET_INFO("LogRotatePath"); $SystemLogsPath = $sock->GET_INFO("SystemLogsPath"); $BackupMaxDays = $sock->GET_INFO("BackupMaxDays"); $BackupMaxDaysDir = $sock->GET_INFO("BackupMaxDaysDir"); $LogRotateH = $sock->GET_INFO("LogRotateH"); $LogRotateM = $sock->GET_INFO("LogRotateM"); $LogsRotateRemoveApacheMaxSize = $sock->GET_INFO("LogsRotateRemoveApacheMaxSize"); if (!is_numeric($LogsRotateRemoveApacheMaxSize)) { $LogsRotateRemoveApacheMaxSize = 50; } $LogsRotateDefaultSizeRotation = $sock->GET_INFO("LogsRotateDefaultSizeRotation"); if (!is_numeric($LogsRotateDefaultSizeRotation)) { $LogsRotateDefaultSizeRotation = 100; } if ($SystemLogsPath == null) { $SystemLogsPath = "/var/log"; } if (!is_numeric($BackupMaxDays)) { $BackupMaxDays = 30; } $t = time(); if ($LogRotatePath == null) { $LogRotatePath = "/home/logrotate"; } if ($BackupMaxDaysDir == null) { $BackupMaxDaysDir = "/home/logrotate_backup"; } $BackupSquidLogsUseNas = $sock->GET_INFO("BackupSquidLogsUseNas"); $BackupSquidLogsNASIpaddr = $sock->GET_INFO("BackupSquidLogsNASIpaddr"); $BackupSquidLogsNASFolder = $sock->GET_INFO("BackupSquidLogsNASFolder"); $BackupSquidLogsNASUser = $sock->GET_INFO("BackupSquidLogsNASUser"); $BackupSquidLogsNASPassword = $sock->GET_INFO("BackupSquidLogsNASPassword"); if (!is_numeric($BackupSquidLogsUseNas)) { $BackupSquidLogsUseNas = 0; } $SquidLogRotateFreq = intval($sock->GET_INFO("SquidLogRotateFreq")); if ($SquidLogRotateFreq < 10) { $SquidLogRotateFreq = 1440; } $SquidRotateOnlySchedule = intval($sock->GET_INFO("SquidRotateOnlySchedule")); $BackupLogsMaxStoragePercent = intval($sock->GET_INFO("BackupLogsMaxStoragePercent")); if ($BackupLogsMaxStoragePercent == 0) { $BackupLogsMaxStoragePercent = 50; } $SquidRotateAutomount = intval($sock->GET_INFO("SquidRotateAutomount")); $SquidRotateClean = intval($sock->GET_INFO("SquidRotateClean")); $SquidRotateAutomountRes = $sock->GET_INFO("SquidRotateAutomountRes"); $SquidRotateAutomountFolder = $sock->GET_INFO("SquidRotateAutomountFolder"); $AUTOFSR[null] = "{select}"; if ($AutoFSEnabled == 1) { $autofs = new autofs(); $hashZ = $autofs->automounts_Browse(); if (file_exists('ressources/usb.scan.inc')) { include "ressources/usb.scan.inc"; } while (list($localmount, $array) = each($hashZ)) { $AUTOFSR[$localmount] = "{$localmount}"; } } $freq[20] = "20mn"; $freq[30] = "30mn"; $freq[60] = "1h"; $freq[120] = "2h"; $freq[300] = "5h"; $freq[600] = "10h"; $freq[1440] = "24h"; $freq[2880] = "48h"; $freq[4320] = "3 {days}"; $freq[10080] = "1 {week}"; for ($i = 0; $i < 24; $i++) { $H = $i; if ($i < 10) { $H = "0{$i}"; } $Hours[$i] = $H; } for ($i = 0; $i < 60; $i++) { $M = $i; if ($i < 10) { $M = "0{$i}"; } $Mins[$i] = $M; } $html = "\n<div style='width:100%;font-size:42px;margin-bottom:20px'>{legal_logs}: {log_retention}</div>\n<div style='width:98%' class=form>\t\n<div style='text-align:right;font-size:22px;text-align:right;text-decoration:underline;margin-top:20px'>\n\t\t" . button("{squid_logs_urgency_section}", "Loadjs('system.log.emergency.php')", 20) . "\n\t\t\t\t\t\n\t\t\t\t</div>\t\t\t\n\t\t\t\n<table style='width:100%'>\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{only_by_schedule}", "{only_by_schedule_squid_rotation_explain}") . ":</td>\n\t\t<td style='font-size:16px'>" . Field_checkbox_design("SquidRotateOnlySchedule-{$t}", 1, $SquidRotateOnlySchedule, "SquidRotateOnlyScheduleCheck()") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{schedule}:</td>\n\t\t<td style='font-size:16px' colspan=2>\n\t\t\t\t<table style='width:135px'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-size:22px'>" . Field_array_Hash($Hours, "LogRotateH-{$t}", $LogRotateH, "style:font-size:22px") . "</td>\n\t\t\t\t\t<td style='font-size:22px'>:</td>\n\t\t\t\t\t<td style='font-size:22px'>" . Field_array_Hash($Mins, "LogRotateM-{$t}", $LogRotateM, "style:font-size:22px") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{export_logs_each}:</td>\n\t\t<td style='font-size:16px'>" . Field_array_Hash($freq, "SquidLogRotateFreq-{$t}", $SquidLogRotateFreq, "style:font-size:22px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{export_log_if_size_exceed}:</td>\n\t\t<td style='font-size:22px'>" . Field_text("LogsRotateDefaultSizeRotation-{$t}", $LogsRotateDefaultSizeRotation, "font-size:22px;width:110px") . " Mo</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{temporay_storage_path}", "{temporay_storage_path_explain}") . ":</td>\n\t\t<td>" . Field_text("LogRotatePath", $LogRotatePath, "font-size:22px;width:420px") . "</td>\n\t\t<td>" . button("{browse}..", "Loadjs('SambaBrowse.php?no-shares=yes&field=LogRotatePath')", 18) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{backup_folder}", "{BackupMaxDaysDir_explain}") . ":</td>\n\t\t<td style='font-size:22px;'>" . Field_text("BackupMaxDaysDir", $BackupMaxDaysDir, "font-size:22px;width:420px") . "</td>\n\t\t<td>" . button("{browse}..", "Loadjs('SambaBrowse.php?no-shares=yes&field=BackupMaxDaysDir')", 18) . "</td>\n\t</tr>\n\t<tr><td colspan=3> </td></tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{automount_ressource}", "{automount_ressource_explain}") . ":</td>\n\t\t<td style='font-size:16px'>" . Field_checkbox_design("SquidRotateAutomount-{$t}", 1, $SquidRotateAutomount, "SquidRotateAutomountCheck()") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{resource}:</td>\n\t\t<td style='font-size:16px'>" . Field_array_Hash($AUTOFSR, "SquidRotateAutomountRes-{$t}", $SquidRotateAutomountRes, "style:font-size:22px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{directory}", "{SquidRotateAutomountFolder}") . ":</td>\n\t\t<td style='font-size:22px;'>" . Field_text("SquidRotateAutomountFolder-{$t}", $SquidRotateAutomountFolder, "font-size:22px;width:420px") . "</td>\n\t\t<td></td>\n\t</tr>\n\t<tr><td colspan=3> </td></tr>\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{clean_old_files}", "{clean_old_files_accesslog_explain}") . ":</td>\n\t\t<td style='font-size:16px'>" . Field_checkbox_design("SquidRotateClean-{$t}", 1, $SquidRotateClean, "SquidRotateCleanCheck()") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{max_storage_days}", "{max_storage_days_log_explain}") . ":</td>\n\t\t<td style='font-size:22px;'>" . Field_text("BackupMaxDays", $BackupMaxDays, "font-size:22px;width:90px") . " {days}</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{max_percent_storage}", "{BackupLogsMaxStoragePercent_explain}") . ":</td>\n\t\t<td style='font-size:22px;'>" . Field_text("BackupLogsMaxStoragePercent", $BackupLogsMaxStoragePercent, "font-size:22px;width:90px", null, "BackupLogsMaxStoragePercent_infos()", null, false, "BackupLogsMaxStoragePercent_infos()") . " %</td>\n\t\t<td><span id='BackupLogsMaxStoragePercent-info'></span></td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 align=right style='font-size:42px'>" . button("{export_logs_now}", "Loadjs('squid.rotate.progress.php')", 42) . " | " . button("{apply}", "SaveRotateOptions{$t}()", 42) . "</td>\n\t</tr>\n\t</table>\n</div>\n<script>\n\t\nvar x_SaveSettsLogRotate{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\tCacheOff();\n}\n\nfunction SquidRotateOnlyScheduleCheck(){\n\tdocument.getElementById('LogRotateH-{$t}').disabled=true;\n\tdocument.getElementById('LogRotateM-{$t}').disabled=true;\n\tdocument.getElementById('SquidLogRotateFreq-{$t}').disabled=false;\n\tif(!document.getElementById('SquidRotateOnlySchedule-{$t}').checked){return;}\n\tdocument.getElementById('LogRotateH-{$t}').disabled=false;\n\tdocument.getElementById('LogRotateM-{$t}').disabled=false;\n\tdocument.getElementById('SquidLogRotateFreq-{$t}').disabled=true;\n}\n\nfunction SquidRotateCleanCheck(){\n\tdocument.getElementById('BackupMaxDays').disabled=true;\n\tdocument.getElementById('BackupLogsMaxStoragePercent').disabled=true;\n\tif(document.getElementById('SquidRotateClean-{$t}').checked){\n\t\tdocument.getElementById('BackupMaxDays').disabled=false;\n\t\tdocument.getElementById('BackupLogsMaxStoragePercent').disabled=false;\t\n\t}\n}\n\nfunction SquidRotateAutomountCheck(){\n\tvar AutoFSEnabled={$AutoFSEnabled};\n\tdocument.getElementById('SquidRotateAutomount-{$t}').disabled=true;\n\tdocument.getElementById('SquidRotateAutomountRes-{$t}').disabled=true;\n\tdocument.getElementById('SquidRotateAutomountFolder-{$t}').disabled=true;\n\t\n\t\n\t\n\tif(AutoFSEnabled==0){return;}\n\tdocument.getElementById('SquidRotateAutomount-{$t}').disabled=false;\t\n\tif(document.getElementById('SquidRotateAutomount-{$t}').checked){\n\t\tdocument.getElementById('SquidRotateAutomountRes-{$t}').disabled=false;\n\t\tdocument.getElementById('SquidRotateAutomountFolder-{$t}').disabled=false;\n\t\tdocument.getElementById('BackupMaxDaysDir').disabled=true;\n\t}\n}\n\n\t\nfunction SaveRotateOptions{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('LogRotateCompress',1);\n\tXHR.appendData('LogRotateMysql',0);\n\t\n\tXHR.appendData('BackupLogsMaxStoragePercent',document.getElementById('BackupLogsMaxStoragePercent').value);\n\t\n\tXHR.appendData('LogRotatePath',document.getElementById('LogRotatePath').value);\n\tXHR.appendData('SquidLogRotateFreq',document.getElementById('SquidLogRotateFreq-{$t}').value);\n\tXHR.appendData('SquidRotateAutomountRes',document.getElementById('SquidRotateAutomountRes-{$t}').value);\n\tXHR.appendData('SquidRotateAutomountFolder',document.getElementById('SquidRotateAutomountFolder-{$t}').value);\n\tXHR.appendData('LogsRotateDefaultSizeRotation',document.getElementById('LogsRotateDefaultSizeRotation-{$t}').value);\n\tXHR.appendData('BackupMaxDays',document.getElementById('BackupMaxDays').value);\n\tXHR.appendData('BackupMaxDaysDir',document.getElementById('BackupMaxDaysDir').value);\n\tXHR.appendData('LogRotateH',document.getElementById('LogRotateH-{$t}').value);\n\tXHR.appendData('LogRotateM',document.getElementById('LogRotateM-{$t}').value);\n\tif(document.getElementById('SquidRotateOnlySchedule-{$t}').checked){ XHR.appendData('SquidRotateOnlySchedule',1); }else{ XHR.appendData('SquidRotateOnlySchedule',0); }\n\tif(document.getElementById('SquidRotateClean-{$t}').checked){ XHR.appendData('SquidRotateClean',1); }else{ XHR.appendData('SquidRotateClean',0); }\n\tif(document.getElementById('SquidRotateAutomount-{$t}').checked){ XHR.appendData('SquidRotateAutomount',1); }else{ XHR.appendData('SquidRotateAutomount',0); }\t\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',x_SaveSettsLogRotate{$t});\n}\n\t\nvar x_SaveSettsLogRotate{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n}\n\nfunction BackupLogsMaxStoragePercent_infos(){\n\tBackupLogsMaxStoragePercent=document.getElementById('BackupLogsMaxStoragePercent').value;\n\tLoadAjaxSilent('BackupLogsMaxStoragePercent-info','{$page}?BackupLogsMaxStoragePercent-info='+BackupLogsMaxStoragePercent);\n\n}\n\t\nSquidRotateOnlyScheduleCheck();\nSquidRotateCleanCheck();\nSquidRotateAutomountCheck();\nBackupLogsMaxStoragePercent_infos();\n\n\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function ACTION_LVS_REMOVE(){ include_once('ressources/class.autofs.inc'); $sock=new sockets(); $lvs=$_POST["lvs"]; $vg=$_POST["vg"]; $array=unserialize(base64_decode($sock->getFrameWork("lvm.php?lvdisplay=".urlencode($vg)))); $status=$array["/dev/$vg/$lvs"]; if($status["INFOS"]["UUID"]<>null){ $auto=new autofs(); $auto->uuid=$status["INFOS"]["UUID"]; $auto->by_uuid_addmedia("$vg-$lvs","auto"); } $datas=base64_decode($sock->getFrameWork("lvm.php?lvremove=yes&lvs=$lvs&vg=$vg")); echo $datas; }
<?php if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } include_once dirname(__FILE__) . '/ressources/class.templates.inc'; include_once dirname(__FILE__) . '/ressources/class.ini.inc'; include_once dirname(__FILE__) . '/ressources/class.samba.inc'; include_once dirname(__FILE__) . '/ressources/class.autofs.inc'; $ldap = new clladp(); $suffix = "dc=organizations,{$ldap->suffix}"; $filter = "(&(ObjectClass=SharedFolders)(SharedFolderList=*))"; $attr = array("gidNumber"); $sr = @ldap_search($ldap->ldap_connection, $suffix, $filter, $attr); $hash = ldap_get_entries($ldap->ldap_connection, $sr); for ($i = 0; $i < $hash["count"]; $i++) { $gpid = $hash[$i][strtolower("gidNumber")][0]; $auto = new autofs(); $auto->AutofsSharedDir($gpid); }
function remove($path) { $unix = new unix(); $umount = $unix->find_program("umount"); $sql = "SELECT * FROM loop_disks WHERE `path`='{$path}'"; $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $disk_name = $ligne["disk_name"]; $loop_dev = $ligne["loop_dev"]; $GetLoops = GetLoops(); $dev = $GetLoops[$path]; if ($dev == null) { $dev = $loop_dev; } $uuid = Getuuid($dev); if ($dev != null) { echo "Starting......: " . date("H:i:s") . " {$dev} umounting...\n"; exec("{$umount} -l {$dev} 2>&1", $results); exec("{$umount} -l {$dev} 2>&1", $results); exec("{$umount} -l {$dev} 2>&1", $results); while (list($num, $ligne) = each($results)) { echo "Starting......: " . date("H:i:s") . " {$dev} {$ligne}\n"; } } $results = array(); if ($uuid != null) { echo "Starting......: " . date("H:i:s") . " {$dev} disconnect {$uuid}...{$disk_name}\n"; $autofs = new autofs(); $autofs->uuid = $uuid; $autofs->by_uuid_removemedia($disk_name, "auto"); } if ($dev != null) { echo "Starting......: " . date("H:i:s") . " dev:`{$dev}` remove media\n"; $cmd = "{$GLOBALS["losetup"]} -d {$dev} 2>&1"; exec($cmd, $results); while (list($num, $ligne) = each($results)) { echo "Starting......: " . date("H:i:s") . " {$dev} {$ligne}\n"; } if (is_file($path)) { echo "Starting......: " . date("H:i:s") . " {$dev} remove file\n"; shell_exec("/bin/rm -f {$path}"); } } echo "Starting......: " . date("H:i:s") . " {$dev} remove entry in database\n"; $sql = "DELETE FROM loop_disks WHERE `path`='{$path}'"; $q->QUERY_SQL($sql, "artica_backup"); echo "Starting......: " . date("H:i:s") . " {$dev} removed\n"; $nohup = $unix->find_program("nohup"); shell_exec("{$nohup} /etc/init.d/autofs restart >/dev/null 2>&1 &"); }
function pools_list() { $page = CurrentPageName(); $tpl = new templates(); $autofs = new autofs(); $hash = $autofs->automounts_Browse(); $q = new mysql(); $sql = "SELECT * FROM greyhole_spools ORDER BY free_g DESC"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return null; } $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th> </th>\n\t\t<th>{type}</th>\n\t\t<th>{local_directory_name}</th>\n\t\t<th>{source}</th>\n\t\t<th>{size}</th>\n\t\t<th> </th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $dn = $ligne["dn"]; if ($GLOBALS["VERBOSE"]) { echo "{$dn}\n"; } $array = $autofs->hash_by_dn[$dn]; $FOLDER = $array["FOLDER"]; $FS = $array["INFOS"]["FS"]; $SRC = $array["INFOS"]["SRC"]; if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $color = "black"; $delete = imgtootltip("delete-32.png", "{delete}", "AutoFSUSB('{$UUID}')"); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/usb-32-green.png'></td>\n\t\t\t<td width=1% align='center' nowrap><strong style='font-size:14px'><code style='color:{$color}'>{$FS}</code></td>\n\t\t\t<td width=1% align='left'><strong style='font-size:14px'>{$FOLDER}</strong></td>\n\t\t\t<td width=99% align='left' nowrap><strong style='font-size:14px'>{$SRC}</strong></td>\n\t\t\t<td width=1% align='left'><strong style='font-size:14px'>{$ligne["free_g"]}Gb</strong></td>\n\t\t\t<td width=1%>{$delete}</td>\n\t\t</tr>"; } $html = $html . "</tbody></table>\n\t<script>\n\n\tvar x_AutoFSUSB= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue);return;}\t\n\t\tYahooWin4Hide();\n\t\tRefreshTab('main_config_autofs');\n\t}\t\t\n\t\n\tfunction AutoFSUSB(key){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('USB_UUID',key);\t\n\t\tvar localdir=document.getElementById('USB_LOCAL_DIR').value;\n\t\tif(localdir.length==0){alert('LOCAL DIR !');return;}\n\t\tXHR.appendData('USB_LOCAL_DIR',document.getElementById('USB_LOCAL_DIR').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_AutoFSUSB);\n\t\t}\t\n\n\t</script>\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function popup_resource_automount_list() { $page = CurrentPageName(); $tpl = new templates(); $auto = new autofs(); $hash = $auto->automounts_Browse(); $add = imgtootltip("32-plus.png", "{add}", "Loadjs('autofs.php?form-add-js=yes')"); $html = "\n\t\t\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t\t\t<thead class='thead'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{$add}</th>\n\t\t\t\t\t<th>{proto}</th>\n\t\t\t\t\t<th>{source}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody class='tbody'>"; while (list($localmount, $array) = each($hash)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $color = "black"; if (preg_match("#\\{device\\}:(.+)#", $array["SRC"], $re)) { $uuid = $re[1]; $ligne = $_GLOBAL["usb_list"][$uuid]; $TYPE = $ligne["TYPE"]; $ID_MODEL = $ligne["ID_MODEL"]; $LABEL = $ligne["LABEL"]; $DEV = $ligne["DEV"]; if ($LABEL == null) { $LABEL = $ID_MODEL; } $SIZE = explode(";", $ligne["SIZE"]); $array["SRC"] = "{device}: {$LABEL} ({$SIZE[0]})"; } $select = imgtootltip("arrow-left-32.png", "{select}", "WizardAutomountSaveRessource('/automounts/{$localmount}')"); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/net-drive-32.png'></td>\n\t\t\t<td width=1% align='center' nowrap><strong style='font-size:14px'><code style='color:{$color}'>{$array["FS"]}</code></td>\n\t\t\t<td width=99% align='left'><strong style='font-size:14px'>{$array["SRC"]}</strong><div style='font-size:11px'><i>/automounts/{$localmount}</i></div></td>\n\t\t\t<td width=1%>{$select}</td>\n\t\t</td>\n\t\t</tr>"; } $html = $html . "</tbody></table>"; echo $tpl->_ENGINE_parse_body($html); }
function Scan_mysql_dirs() { $GLOBALS["INDEXED"] = 0; $GLOBALS["SKIPPED"] = 0; $GLOBALS["DIRS"] = array(); $unix = new unix(); $GLOBALS["omindex"] = $unix->find_program("omindex"); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid)) { system_admin_events("Already instance executed pid:{$olpid}", __FUNCTION__, __FILE__, __LINE__, "xapian"); die; } @file_put_contents($pidfile, getmypid()); $q = new mysql(); $q->check_storage_table(true); $localdatabase = "/usr/share/artica-postfix/LocalDatabases"; $nice = EXEC_NICE(); $sql = "SELECT * FROM xapian_folders"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { system_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "xapian"); return; } $t1 = time(); if (!is_file($GLOBALS["omindex"])) { system_admin_events("omindex no such binary, aborting", __FUNCTION__, __FILE__, __LINE__, "xapian"); return; } $autofs = new autofs(); $autofs->automounts_Browse(); $count = 0; while ($ligne = mysql_fetch_assoc($results)) { $directory = $ligne["directory"]; $database = "{$localdatabase}/samba." . md5($directory) . ".db"; $depth = $ligne["depth"]; $maxsize = $ligne["maxsize"]; $samplsize = $ligne["sample-size"]; $lang = $ligne["lang"]; $WebCopyID = $ligne["WebCopyID"]; $autmountdn = $ligne["autmountdn"]; if ($lang == null) { $lang = "english"; } $indexed = $ligne["indexed"]; if (!is_numeric($samplsize)) { $samplsize = 512; } if (!is_numeric($maxsize)) { $maxsize = 60; } if (!is_numeric($depth)) { $depth = 0; } $BaseUrl = $directory; if ($WebCopyID > 0) { $directory = WebCopyIDDirectory($WebCopyID); $BaseUrl = WebCopyIDAddresses($WebCopyID) . "/"; } if ($autmountdn != null) { if (!isset($autofs->hash_by_dn[$autmountdn])) { system_admin_events("Fatal.. {$autmountdn} no such connection", __FUNCTION__, __FILE__, __LINE__, "xapian"); continue; } $autmountdn_array = $autofs->hash_by_dn[$autmountdn]; $directory = "/automounts/{$autmountdn_array["FOLDER"]}"; $autmountdn_infos = $autmountdn_array["INFOS"]; if (!isset($autmountdn_infos["BROWSER_URI"])) { system_admin_events("Fatal.. {$autmountdn} external protocol error", __FUNCTION__, __FILE__, __LINE__, "xapian"); continue; } $BaseUrl = $autmountdn_infos["BROWSER_URI"]; } if (!is_dir($database)) { @mkdir($database, 0755, true); } if (!is_dir($directory)) { system_admin_events("{$directory}, no such directory", __FUNCTION__, __FILE__, __LINE__, "xapian"); continue; } $t = time(); $cmd = "{$nice}{$GLOBALS["omindex"]} -l {$depth} -s {$lang} -E {$samplsize} -m {$maxsize}M --follow -D \"{$database}\" -U \"{$BaseUrl}\" \"{$directory}\" 2>&1"; if ($GLOBALS["VERBOSE"]) { echo "{$cmd}\n"; } $GLOBALS["DIRS"]["{$directory}"] = true; $results_scan = array(); exec($cmd, $results_scan); $dirRes = ParseLogs($results_scan); $took = $unix->distanceOfTimeInWords($t, time(), true); $DatabaseSize = $unix->DIRSIZE_BYTES($database); $count++; $indexed = $indexed + $dirRes[0]; system_admin_events("scanned {$directory} took {$took} indexed:{$indexed} skipped:{$dirRes[1]}", __FUNCTION__, __FILE__, __LINE__, "xapian"); $q->QUERY_SQL("UPDATE xapian_folders SET ScannedTime=NOW(),indexed={$indexed},DatabasePath='{$database}',DatabaseSize='{$DatabaseSize}'\n\t\n\t\tWHERE ID={$ligne["ID"]}", "artica_backup"); if (!$q->ok) { system_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "xapian"); } } $took = $unix->distanceOfTimeInWords($t1, time(), true); system_admin_events("scanned {$count} directorie(s) took {$took}", __FUNCTION__, __FILE__, __LINE__, "xapian"); }