Exemple #1
0
/**
 * 書き込みデータの保存形式を変更する
 *
 * @param string $post_db_path
 * @return void
 */
function _100120_0700_convert_post_data_store($post_db_path)
{
    if (!file_exists($post_db_path)) {
        return;
    }
    $oldKvs = P2KeyValueStore::getStore($post_db_path, P2KeyValueStore::CODEC_SERIALIZING);
    $newKvs = PostDataStore::getKVS();
    foreach ($oldKvs as $key => $value) {
        $newKvs->set($key, $value);
    }
    if ($oldKvs->getTableName() != $newKvs->getTableName()) {
        $oldKvs->prepare('DROP TABLE $__table')->execute();
    }
    // プリペアードステートメントを破棄するために optimize()
    $newKvs->optimize();
}