File "msg_list.php"
Full path: /www/ansys/qgis/007_honmoku/messages/output/msg_list.php
File size: 3.12 KiB (3195 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// 自動でクラスを参照する
// 関数名 : __autoload()
// 備考 : 参照先は./class/XXX.phpとする
// 更新 : 2012/10/19 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function __autoload($className)
{
$fPath = "./class/" . str_replace("_", "/", $className) . ".php";
require_once $fPath;
}
//===============================================
// DEBUG_MODE
// 備考 :
// 更新 : 2012/10/19 KMK-Teraoka
//===============================================
define("DEBUG_MODE", "0");
Debug::setMode(DEBUG_MODE);
if (DEBUG_MODE == 1)
{
Stopwatch::start();
}
//===============================================
// CommonUtilities
// 備考 :
// 更新 : 2012/11/06 KMK-Teraoka
//===============================================
$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";
$LOG_FILE = "./log/msg_list.log";
$MSG_DIRECTORY = "../msg_files";
$CONST_ID = "10";
$APP_ID = "17";
try
{
$_log = new Log($LOG_FILE);
//===============================================
// POST、GETパラメータの受け取り
// 備考 : const_id, app_id
// 更新 : 2012/10/25 KMK-Teraoka
//===============================================
if (DEBUG_MODE == 1)
{
extract($_POST);
extract($_GET);
Debug::writes($_POST);
}
//$androidId = isset($_POST["android_id"]) ? htmlspecialchars($_POST["android_id"]) : "";
//================================================
// データベース接続
// 備考 :
// 更新 : 2012/11/29 KMK-Teraoka
//================================================
$conn = pg_connect("
host = ". $HOST. "
dbname = ". $DB. "
user = ". $USER. "
password= ". $PASS. "
");
if (!$conn)
{
throw new Exception("データベースへの接続に失敗しました");
}
//================================================
// ファイル一覧を取得
// 備考 :
// 更新 : 2012/12/14 KMK-Teraoka
//================================================
$selectList = "SELECT msg_id, msg_file_name FROM qgis.messages";
$selectList .= " WHERE const_id='". $CONST_ID. "'";
$selectList .= " AND app_id='". $APP_ID. "'";
$selectList .= ";";
$_log->write($selectList. "\n");
if (!($resList = pg_query($conn, $selectList)))
{
throw new Exception("データ行数の取得に失敗\n". $resList. "\n". pg_last_error(). "\n");
}
$totalSize = 0;
$output = "";
$listCount = pg_num_rows($resList);
for($iCount = 0; $iCount < $listCount; $iCount++)
{
$rowList = pg_fetch_array($resList, $iCount, PGSQL_ASSOC);
$chkPath = $MSG_DIRECTORY. "/". $rowList["msg_file_name"];
$fSize = filesize($chkPath);
$totalSize += $fSize;
if (0 != $iCount && $listCount != ($iCount - 1))
{
$output .= "#";
}
$output .= $rowList["msg_id"]. ",". $rowList["msg_file_name"];
}
print $totalSize. "#". $output. "\n";
}
catch(Exception $exc)
{
$_log->write($exc->getMessage(). "\n");
}
//===============================================
// Postgresql終了処理
// 備考 :
// 更新 : 2012/10/19 KMK-Teraoka
//===============================================
pg_close($conn);
?>