查看最近编辑etherpads(注意,开源代码EtherPad的新“EtherPad的”标签!)

StackOverflow https://stackoverflow.com/questions/2569194

有帮助吗?

解决方案

我还没有完全想通了,回答我原来的问题,但我写了实现类似的脚本。 它的主要目的是导出所有我垫的纯文本版本,并将它们存储在我的笔记本电脑。 作为一个副作用,它让我看到这片已经改变,让我看到自上次出口版本差异。 它还哪些被新创建的节目。

首先,创建下面的脚本,padlist.pl,在服务器上承载您的EtherPad的实例:

#!/usr/bin/env perl

$list = `mysql -u root -pPASSWD etherpad -e 
         "select id from PAD_SQLMETA order by lastWriteTime DESC, headRev DESC"`;

$list =~ s/^id\s*\n//s;  # get rid of the column header mysql adds.
print $list;

然后运行下面的脚本,fetchall.pl,在本地机器上。 它会倒吸了所有垫的快照,并告诉你哪些已经改变,已经新出现的。

#!/usr/bin/env perl

use LWP::Simple qw(get);
$| = 1;  # autoflush.
$server = "server.com"; # the server that hosts your etherpad instance.

$pads = `ssh $server etherpad/padlist.pl`;
@padlist = split(/\s+/, $pads);

$neednewline = 0; # printing "." for each pad where nothing to be done.
for(@padlist) {
  $ep = $_;
  $localfile = "$ep.txt";
  if(-e $localfile) { 
    $localexists = 1; 
    $localcontent = do {local (@ARGV,$/) = $localfile; <>};
  } else { $localexists = 0; }
  $livecontent = get("http://$server/ep/pad/export/$ep/latest?format=txt");
  if($livecontent ne $localcontent) {
    if($neednewline) { print "\n";  $neednewline = 0; }
    if($localexists) { 
      print "CHANGED: $ep\n"; 
      open(F, ">prev/$localfile") or die "Probably need to create 'prev' dir.";
      print F $localcontent;
      close(F);
    } else { print "NEW:     $ep\n"; }
    open(F, ">$localfile") or die;
    print F $livecontent;
    close(F);
  } else {
    print ".";
    $neednewline = 1;
} }

要看到垫FOO的一个diff自上次我拿来它:

diff prev/foo.txt foo.txt
scroll top