Remove the indexer lock if it's too old (> 5 hours)

This commit is contained in:
Daniel Berteaud 2013-10-07 16:43:14 +02:00
parent 23bbb41220
commit 587ba5234d
1 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,12 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){
$indexer = $share->prop('AjaxplorerIndexer') || 'enabled';
next if ($ajaxplorer ne 'enabled' || $indexer ne 'enabled');
my $name = $share->key;
# Check if the lock file is present and if it's too old (last index crashed ?)
if (-e "/var/cache/ajaxplorer/indexes/.ajxp_lock-$name"){
my $mtime = stat("/var/cache/ajaxplorer/indexes/.ajxp_lock-$name")->mtime;
unlink <"/var/cache/ajaxplorer/indexes/.ajxp_lock-$name">
if (time() - $mtime > 18000);
}
system('/usr/bin/sudo -u www /usr/bin/php /usr/share/ajaxplorer/cmd.php ' .
'-u=RDiin175M40T0cYvXLARpAi+1TsSVkbksEDZ4KvwBuY= '.
'-t=e71479ebc4365176d9f09fe957780024 -a=index '.