Skip to content

zxkiller/disqus-comment-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

disqus-comment-sync
~~~~~~~~~~~~~~~~~~~

Synchronize Disqus comments to a local database via their API.  To be run daily, fetches the comments and threads since it was last run.


Requirements
~~~~~~~~~~~~

* PHP >= 5.3.0
* PDO for PHP
* A copy of the allerinternett forked Disqus API (https://github.com/allerinternett/disqus-php)
* Disqus API access
* MySQL (or another database)
* Scheduling program (such as cron)


Installation
~~~~~~~~~~~~

- Get a copy of Aller Internett's forked Disqus API from: https://github.com/allerinternett/disqus-php.

- Edit the variables at the top of backup.php with values relevant to you.

- Create the following tables in your database:

  CREATE TABLE `disqus_threads` (
    `id` int(10) unsigned NOT NULL,
    `ident` int(10) unsigned NOT NULL,
    `forum` varchar(64) NOT NULL,
    `created` int(10) unsigned NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `ident` (`ident`),
    KEY `created` (`created`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8

  CREATE TABLE `disqus_comments` (
    `forum` varchar(100) NOT NULL,
    `isApproved` tinyint(4) NOT NULL DEFAULT '1',
    `author_name` varchar(255) NOT NULL,
    `author_url` varchar(255) NOT NULL,
    `avatar_url` varchar(255) DEFAULT NULL,
    `author_email` varchar(255) NOT NULL,
    `author_id` varchar(255) DEFAULT NULL,
    `author_our_id` int(10) unsigned DEFAULT NULL,
    `isAnonymous` tinyint(4) NOT NULL DEFAULT '1',
    `message` text,
    `ip_address` varchar(15) NOT NULL,
    `thread_id` int(10) unsigned NOT NULL,
    `comment_id` int(10) unsigned NOT NULL,
    `parent_id` int(10) unsigned DEFAULT NULL,
    `created` int(10) unsigned NOT NULL,
    `isSpam` tinyint(4) NOT NULL DEFAULT '0',
    `isDeleted` tinyint(4) NOT NULL DEFAULT '0',
    `isEdited` tinyint(4) NOT NULL DEFAULT '0',
    `likes` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`comment_id`),
    KEY `thread_id` (`thread_id`),
    KEY `created` (`created`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8

- Run the script for the first time:

    php backup.php

  This may take some time to finish (especially if you have many comments)

- Schedule the job to run daily with your local scheduling program.


Help
~~~~

Post any issues into: https://github.com/allerinternett/disqus-comment-sync/issues


License
~~~~~~~

GPL v3 (see LICENSE file)


Copyright
~~~~~~~~~

Aller Internett AS, 2012

About

Synchronize your Disqus comments to a local database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors