Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Initialise common code.
- if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require ( 'core/includes/WebStart.php' );
- } else {
- require ( __DIR__ . '/includes/WebStart.php' );
- }
- function getChanges() {
- //Database query...
- $dbr = wfGetDB( DB_SLAVE );
- $res = $dbr->query("SELECT * FROM `wiki_recentchanges` ORDER BY rc_id DESC LIMIT 0,5");
- $changes = array();
- while ($row = $dbr->fetchRow($res)) {
- $changes[] = $row;
- }
- return array(
- 'changes' => $changes
- );
- }
- switch ($_REQUEST['action']) {
- case 'recent':
- case 'changes':
- $response = getChanges();
- break;
- default:
- $response = array('error' => 'Unknown action');
- }
- $response = json_encode($response);
- echo $response;
- die();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement