Version Beta
This commit is contained in:
parent
25e56bea80
commit
1dbf6de165
2
cli.php
2
cli.php
|
@ -2,7 +2,7 @@
|
|||
|
||||
require_once ('vn/lib/cli-app.php');
|
||||
|
||||
$cliApp = new Vn\Lib\CliApp ('hedera-web');
|
||||
$cliApp = new Vn\Lib\CliApp ('hedera-web', './rest');
|
||||
$cliApp->run ();
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Alias /hedera-web /usr/share/hedera-web/web/
|
||||
# Alias /vn-image-data /var/cache/hedera-web/image/
|
||||
# Alias /hedera-web /usr/share/hedera-web/
|
||||
# Alias /vn-image-data /var/cache/hedera-web/image-db/
|
||||
|
||||
<Directory /usr/share/hedera-web/web/>
|
||||
<Directory /usr/share/hedera-web/>
|
||||
|
||||
Options -Indexes -FollowSymLinks
|
||||
AllowOverride None
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
</Directory>
|
||||
|
||||
<Directory /var/cache/hedera-web/image/>
|
||||
<Directory /var/cache/hedera-web/image-db/>
|
||||
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride FileInfo Options
|
||||
|
|
|
@ -7,7 +7,7 @@ echo '<meta name="content-language" content="'. Locale::get () .'"/>'."\n\t\t";
|
|||
if ($result = $db->query ('SELECT name, content FROM metatag'))
|
||||
{
|
||||
while ($row = $result->fetch_assoc ())
|
||||
echo '<meta name="'. $row['name'] .'" content="'. $row['content'] .'"/>'."\n\t\t";
|
||||
echo "<meta name=\"{$row['name']}\" content=\"{$row['content']}\"/>\n\t\t";
|
||||
|
||||
$result->free ();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
require_once (__DIR__.'/lib/edi-method.php');
|
||||
require_once (__DIR__.'/lib/method.php');
|
||||
|
||||
class Clean extends EdiMethod
|
||||
class Clean extends Edi\Method
|
||||
{
|
||||
function ediRun ()
|
||||
{
|
||||
|
@ -36,13 +36,10 @@ class Clean extends EdiMethod
|
|||
else
|
||||
$count = 0;
|
||||
|
||||
printf ('%d mails deleted from %s mailbox.'
|
||||
,$count
|
||||
,$folder
|
||||
);
|
||||
echo "$count mails deleted from $folder mailbox\n";
|
||||
}
|
||||
|
||||
printf ('Total: %d mails deleted.', $deleted);
|
||||
echo "Total $deleted mails deleted\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Vn\Edi;
|
||||
namespace Edi;
|
||||
|
||||
require_once (__DIR__.'/section.php');
|
||||
|
||||
|
@ -17,7 +17,7 @@ class Message
|
|||
|
||||
static function loadSchema ($schemaName)
|
||||
{
|
||||
$ediSchemaStr = file_get_contents ("vn/edi/schemas/$schemaName.json", TRUE);
|
||||
$ediSchemaStr = file_get_contents (__DIR__."/$schemaName.json", TRUE);
|
||||
|
||||
if ($ediSchemaStr !== FALSE)
|
||||
return json_decode ($ediSchemaStr, TRUE);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Edi;
|
||||
|
||||
require_once ('vn/lib/method.php');
|
||||
|
||||
abstract class EdiMethod extends Vn\Lib\Method
|
||||
abstract class Method extends \Vn\Lib\Method
|
||||
{
|
||||
protected $imap;
|
||||
protected $imapConf;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Vn\Edi;
|
||||
namespace Edi;
|
||||
|
||||
require_once (__DIR__.'/segment.php');
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Vn\Edi;
|
||||
namespace Edi;
|
||||
|
||||
require_once ('vn/lib/type.php');
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
require_once (__DIR__.'/lib/method.php');
|
||||
require_once (__DIR__.'/lib/edi.php');
|
||||
require_once (__DIR__.'/lib/message.php');
|
||||
|
||||
class Load extends EdiMethod
|
||||
class Load extends Edi\Method
|
||||
{
|
||||
function ediRun ()
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ class Load extends EdiMethod
|
|||
$inboxCount = count ($inbox);
|
||||
|
||||
if ($inboxCount > 0)
|
||||
printf ('Total: %d messages readed.', $inboxCount);
|
||||
echo "Total $inboxCount messages readed\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class Load extends EdiMethod
|
|||
|
||||
// Adds the exchange to the Database
|
||||
|
||||
$res = $db->queryFromFile ('sql/batch-add', $ediValues);
|
||||
$res = $db->queryFromFile (__DIR__.'/sql/batch-add', $ediValues);
|
||||
|
||||
if (!$res)
|
||||
throw new Exception ('Failed to insert the line.');
|
||||
|
@ -180,12 +180,12 @@ class Load extends EdiMethod
|
|||
if (!$error)
|
||||
{
|
||||
$folder = $this->imapConf['success_folder'];
|
||||
printf ('EDI: Mail loaded with %d lines.', $count);
|
||||
printf ('Mail loaded with %d lines.', $count);
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = $this->imapConf['error_folder'];
|
||||
printf ('EDI: Mail error: %s', $error);
|
||||
printf ('Mail error: %s', $error);
|
||||
}
|
||||
|
||||
// Moves the mail to another folder
|
||||
|
|
|
@ -15,6 +15,8 @@ class Update extends Vn\Lib\Method
|
|||
// Establece una conexión FTP
|
||||
|
||||
$ftpConf = $db->getRow ('SELECT host, user, password FROM ftp_config');
|
||||
|
||||
echo "Openning FTP connection to {$ftpConf['host']}\n";
|
||||
$ftpConn = ftp_connect ($ftpConf['host']);
|
||||
|
||||
if (!$ftpConn)
|
||||
|
@ -56,6 +58,7 @@ class Update extends Vn\Lib\Method
|
|||
{
|
||||
$dwFiles[$file] = TRUE;
|
||||
|
||||
echo "Downloading $remoteFile\n";
|
||||
if (!ftp_get ($ftpConn, $zipFile, $remoteFile, FTP_BINARY))
|
||||
throw new Exception ("Error downloading $remoteFile to $zipFile");
|
||||
|
||||
|
@ -89,7 +92,8 @@ class Update extends Vn\Lib\Method
|
|||
|
||||
// Actualiza los datos de la tabla
|
||||
|
||||
$importQuery = $db->loadFromFile ("sql/$table", ['file' => $fileName]);
|
||||
echo "Dumping data to table $table\n";
|
||||
$importQuery = $db->loadFromFile (__DIR__."/sql/$table", ['file' => $fileName]);
|
||||
|
||||
$db->multiQuery (
|
||||
"START TRANSACTION;
|
||||
|
@ -113,6 +117,8 @@ class Update extends Vn\Lib\Method
|
|||
|
||||
shell_exec ("rm -R $tmpDir");
|
||||
ftp_close ($ftpConn);
|
||||
|
||||
echo "Update completed\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ class ExchangeRate extends Vn\Lib\Method
|
|||
function run ()
|
||||
{
|
||||
$db = $this->getSysConn ();
|
||||
$db->selectDb ('vn2008');
|
||||
|
||||
// Indica la URL del archivo
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ class Mail extends Vn\Lib\Method
|
|||
function run ()
|
||||
{
|
||||
$db = $this->getSysConn ();
|
||||
$db->selectDb ('vn2008');
|
||||
$db->query ('START TRANSACTION');
|
||||
|
||||
$conf = $db->getRow (
|
||||
|
@ -18,6 +19,8 @@ class Mail extends Vn\Lib\Method
|
|||
'SELECT * FROM mail WHERE sent = 0 ORDER BY DATE_ODBC DESC
|
||||
LIMIT 20 FOR UPDATE');
|
||||
|
||||
$count = 0;
|
||||
|
||||
while ($row = $res->fetch_assoc ())
|
||||
{
|
||||
$sent = 1;
|
||||
|
@ -73,6 +76,8 @@ class Mail extends Vn\Lib\Method
|
|||
|
||||
if (!$mail->Send ())
|
||||
throw new Exception ('Send error: '.$mail->ErrorInfo);
|
||||
|
||||
$count++;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
|
@ -85,6 +90,7 @@ class Mail extends Vn\Lib\Method
|
|||
}
|
||||
|
||||
$db->query ('COMMIT');
|
||||
echo "Total $count mails sent\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class VisitsSync extends Vn\Lib\Method
|
|||
$count++;
|
||||
}
|
||||
|
||||
echo "$count records updated";
|
||||
echo "$count records updated\n";
|
||||
}
|
||||
|
||||
if ($stmt)
|
||||
|
|
Loading…
Reference in New Issue