示例#1
0
| post_user_ip       | varchar(16)  | YES  |     | NULL              |                             |
| is_reply           | int(1)       | YES  |     | NULL              |                             |
| action             | int(3)       | YES  |     | NULL              |                             |
| metatitle          | varchar(201) | YES  |     | NULL              |                             |
| page_id            | int(11)      | YES  |     | NULL              |                             |
| parent_page_id     | int(11)      | YES  |     | NULL              |                             |
| event_date         | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| reason             | varchar(100) | YES  |     | NULL              |                             |
| revision_id        | int(11)      | YES  |     | NULL              |                             |
| deleted_or_removed | int(1)       | YES  |     | 0                 |                             |
| post_ns            | int(11)      | YES  |     | 1200              |                             |
| migrated           | int(1)       | YES  | MUL | 0                 |                             |
+--------------------+--------------+------+-----+-------------------+------------------------------
*/
$history = new WallHistory();
$dbw = $history->getDatawareDB();
$res = $dbw->select('wall_history', array('post_user_id', 'post_user_ip', 'is_reply', 'post_ns', 'page_id', 'parent_page_id', 'metatitle', 'deleted_or_removed', 'event_date', 'reason', 'action', 'revision_id', 'deleted_or_removed'), array('migrated' => 0, 'wiki_id' => $wgCityId), __METHOD__);
$in = array();
$db = $history->getDB(DB_MASTER);
$dir = dirname(__FILE__);
if (!$db->tableExists('wall_history')) {
    echo "Try to create table\\'n";
    $db->sourceFile($IP . "/extensions/wikia/Wall/sql/wall_history_local.sql");
}
while ($row = $dbw->fetchRow($res)) {
    if ($row['action'] == WH_NEW || $row['action'] == WH_EDIT) {
        $pagesRow = $db->selectRow('revision', array('rev_timestamp'), array('rev_id' => $row['revision_id']));
        $row['event_date'] = wfTimestamp(TS_DB, $pagesRow->rev_timestamp);
    }
    $mw = WallMessage::newFromId($row['page_id']);
    if (empty($mw)) {