<?php

/**********************************************************
* File         : retry_app_ad_relation.php
* Authors      : mie tsutsui
* Date         : 2013.01.10
* Last Update  : 2013.01.10
* Copyright    :
***********************************************************/
set_include_path('.:/usr/share/pear:/var/www/phplib');
require_once "mgr/app_regist_common_mgr.class.php";
require_once "sql/app_regist_common_sql.inc.php";
$oMgr = new app_regist_common_mgr();
$sql = "\nSELECT\n    log_cd,\n    app_id\nFROM\n    app_ad_errlog\nWHERE\n    complete_flg='0'\n";
$aryId = $oMgr->oDb->getAssoc2Ary($sql);
if (is_array($aryId)) {
    foreach ($aryId as $log_cd => $app_id) {
        // 結果にかかわらず完了フラグ1を立てる
        $sql = "UPDATE app_ad_errlog SET complete_flg = '1' WHERE log_cd = '" . $log_cd . "'";
        $oMgr->oDb->query($sql);
        $aryEnt = $oMgr->getAppHead($app_id);
        $aryEntList = $oMgr->getAppList($app_id);
        // 連携
        $ret = $oMgr->relationAd($aryEnt['wire_kbn'], array(), $aryEnt, array(), $aryEntList, true);
        if (!$ret) {
            // 未処理に戻す
            $sql = "UPDATE app_ad_errlog SET complete_flg = '0' WHERE log_cd = '" . $log_cd . "'";
            $oMgr->oDb->query($sql);
        }
    }
}
<?php

/**********************************************************
* File         : retry_wireless_ad_relation.php
* Authors      : mie tsutsui
* Date         : 2013.01.10
* Last Update  : 2013.01.10
* Copyright    :
***********************************************************/
set_include_path('.:/usr/share/pear:/var/www/phplib');
require_once "mgr/app_regist_common_mgr.class.php";
require_once "sql/app_regist_common_sql.inc.php";
$oMgr = new app_regist_common_mgr();
$sql = "\nSELECT\n    log_cd,\n    user_id,\n    wireless_id\nFROM\n    wireless_ad_errlog\nWHERE\n    complete_flg='0'\n";
$aryId = $oMgr->oDb->getAssoc($sql);
if (!defined("LDAP_HOST_1")) {
    exit;
}
//接続開始
$ldap_conn = ldap_connect("ldaps://" . LDAP_HOST_1);
if (!$ldap_conn) {
    $ldap_conn = ldap_connect("ldaps://" . LDAP_HOST_2);
}
if (!$ldap_conn) {
    Debug_Trace("接続失敗", 987);
    exit;
}
// バインド
$ldap_bind = ldap_bind($ldap_conn, LDAP_DN, LDAP_PASS);
if (!$ldap_bind) {
    Debug_Trace("バインド失敗", 987);