function migrateData()
 {
     $phpAdsNew = new OA_phpAdsNew();
     $aPanConfig = $phpAdsNew->_getPANConfig();
     $aValues['warn_limit_days'] = $aPanConfig['warn_limit_days'] ? $aPanConfig['warn_limit_days'] : 1;
     $sql = OA_DB_SQL::sqlForInsert('preference', $aValues);
     $result = $this->oDBH->exec($sql);
     return !PEAR::isError($result);
 }
 function test_migratePANConfig()
 {
     $oPAN = new OA_phpAdsNew();
     // Test 1
     $this->_putPanConfigFile('pan.config.inc.php');
     $aResult = $oPAN->_migratePANConfig($oPAN->_getPANConfig());
     $this->_deletePanConfigFile();
     $this->assertEqual($aResult['database']['host'], 'pan_host', 'host not set');
     $this->assertEqual($aResult['database']['port'], '9999', 'port not set');
     $this->assertEqual($aResult['database']['username'], 'pan_user', 'username not set');
     $this->assertEqual($aResult['database']['password'], 'pan_password', 'password not set');
     $this->assertEqual($aResult['database']['name'], 'pan_database', 'database not set');
     $this->assertFalse($aResult['database']['persistent'], 'persistent incorrect');
     $this->assertTrue($aResult['ui']['enabled'], '"UI Enabled" incorrect');
     $this->assertFalse($aResult['openads']['requireSSL'], 'requireSSL incorrect');
     $this->assertTrue($aResult['maintenance']['autoMaintenance'], 'autoMaintenance incorrect');
     $this->assertFalse($aResult['logging']['reverseLookup'], 'reverseLookup incorrect');
     $this->assertFalse($aResult['logging']['proxyLookup'], 'proxyLookup incorrect');
     $this->assertTrue($aResult['logging']['adImpressions'], 'adImpressions incorrect');
     $this->assertTrue($aResult['logging']['adClicks'], 'adClicks incorrect');
     //        $this->assertFalse($aResult[''][''] = $phpAds_config['log_beacon'],' incorrect');;
     //        $this->assertFalse($aResult[''][''] = $phpAds_config['ignore_hosts'],' incorrect');;
     $this->assertEqual($aResult['logging']['blockAdImpressions'], 0, 'blockAdImpressions incorrect');
     $this->assertEqual($aResult['logging']['blockAdClicks'], 0, 'blockAdClicks incorrect');
     $this->assertTrue($aResult['p3p']['policies'], 'policies incorrect');
     $this->assertEqual($aResult['p3p']['compactPolicy'], 'NOI CUR ADM OUR NOR STA NID', 'compactPolicy incorrect');
     $this->assertEqual($aResult['p3p']['policyLocation'], 'pan_p3p_policy_location', 'policyLocation incorrect');
     $this->assertTrue($aResult['delivery']['acls'], 'acls incorrect');
     $aExpections = $this->_getMigrationExpectations();
     foreach ($aExpections as $i => $v) {
         $this->_setPanConfigFile($v['source']);
         $aResult = $oPAN->_migratePANConfig($oPAN->_getPANConfig());
         $this->assertEqual($aResult['database']['protocol'], $v['target']['database']['protocol'], $v['desc'] . ' protocol');
         $this->assertEqual($aResult['database']['host'], $v['target']['database']['host'], $v['desc'] . ' host');
         $this->assertEqual($aResult['database']['port'], $v['target']['database']['port'], $v['desc'] . ' port');
         $this->assertEqual($aResult['database']['socket'], $v['target']['database']['socket'], $v['desc'] . ' socket');
         $this->assertEqual($aResult['database']['type'], $v['target']['database']['type'], $v['desc'] . ' db type');
         $this->assertEqual($aResult['table']['type'], $v['target']['table']['type'], $v['desc'] . ' table type');
     }
     $this->_deletePanConfigFile();
 }
 function statsCompacted()
 {
     $phpAdsNew = new OA_phpAdsNew();
     $aConfig = $phpAdsNew->_getPANConfig();
     return $this->compactStats || $aConfig['compact_stats'];
 }
 function migrateData()
 {
     $prefix = $this->getPrefix();
     $tablePreference = $prefix . 'preference';
     $aColumns = $this->oDBH->manager->listTableFields($tablePreference);
     $sql = "\n\t       SELECT * from {$prefix}config";
     $rsConfig = DBC::NewRecordSet($sql);
     if ($rsConfig->find() && $rsConfig->fetch()) {
         $aDataConfig = $rsConfig->toArray();
         $aValues = array();
         foreach ($aDataConfig as $column => $value) {
             if (in_array($column, $aColumns)) {
                 $aValues[$column] = $value;
             }
         }
         // Migrate PAN config variables
         $phpAdsNew = new OA_phpAdsNew();
         $aPanConfig = $phpAdsNew->_getPANConfig();
         $aValues['warn_admin'] = $aPanConfig['warn_admin'] ? 't' : 'f';
         $aValues['warn_client'] = $aPanConfig['warn_client'] ? 't' : 'f';
         $aValues['warn_limit'] = $aPanConfig['warn_limit'] ? $aPanConfig['warn_limit'] : 100;
         $aValues['default_banner_url'] = $aPanConfig['default_banner_url'];
         $aValues['default_banner_destination'] = $aPanConfig['default_banner_target'];
         $result = $this->createGeoTargetingConfiguration($aPanConfig['geotracking_type'], $aPanConfig['geotracking_location'], $aPanConfig['geotracking_stats']);
         if ($result === false) {
             return $this->_logErrorAndReturnFalse('Error configuring geotargeting');
         }
         $sql = OA_DB_SQL::sqlForInsert('preference', $aValues);
         $result = $this->oDBH->exec($sql);
         if (PEAR::isError($result)) {
             return $this->_logErrorAndReturnFalse('Error inserting preferences during data migration 108: ' . $result->getUserInfo());
         }
         return true;
     } else {
         return false;
     }
 }