Files
librenms-librenms/scripts/update-sql.php
T

27 lines
413 B
PHP
Raw Normal View History

2010-09-03 18:26:59 +00:00
#!/usr/bin/env php
2009-10-28 13:49:37 +00:00
<?php
include("config.php");
include("includes/functions.php");
2011-12-15 16:34:13 +00:00
if ($fd = @fopen($argv[1],'r'))
2011-03-16 22:04:29 +00:00
{
2011-12-15 16:34:13 +00:00
$data = fread($fd,4096);
while (!feof($fd))
{
$data .= fread($fd,4096);
}
2009-10-28 13:49:37 +00:00
2011-12-15 16:34:13 +00:00
foreach (explode("\n", $data) as $line)
{
$update = mysql_query($line);
# FIXME check query success?
echo("$line \n");
}
}
else
2011-03-16 22:04:29 +00:00
{
2011-12-15 16:34:13 +00:00
echo("ERROR: Could not open file \"$argv[1]\".\n");
2009-10-28 13:49:37 +00:00
}
2011-03-16 22:04:29 +00:00
?>