parent
714b11a2cf
commit
8dced78dc7
1 changed files with 35 additions and 0 deletions
@ -0,0 +1,35 @@ |
||||
#!/usr/bin/perl -w |
||||
|
||||
use strict; |
||||
use esmith::ConfigDB; |
||||
use esmith::AccountsDB; |
||||
|
||||
my $c = esmith::ConfigDB->open_ro || die "Couldn't open ConfigDB\n"; |
||||
my $a = esmith::AccountsDB->open_ro || die "Couldn't open AccountsDB\n"; |
||||
|
||||
my $ajaxplorer = $c->get('ajaxplorer') || die "ajaxplorer entry is missing in the configuration database\n"; |
||||
my $status = $ajaxplorer->prop('status') || 'disabled'; |
||||
my $indexer = $ajaxplorer->prop('Indexer') || 'enabled'; |
||||
|
||||
exit(0) if ($status ne 'enabled' || $indexer ne 'enabled'); |
||||
|
||||
# Generate a random ID for our requests |
||||
my @chars = ('a'..'z','A..Z','0'..'9'); |
||||
my $id = ''; |
||||
foreach (0..32){ |
||||
$id .= $chars[rand @chars]; |
||||
} |
||||
foreach my $share ($a->get_all_by_prop(type => 'share')){ |
||||
$ajaxplorer = $share->prop('Ajaxplorer') || 'disabled'; |
||||
$indexer = $share->prop('AjaxplorerIndexer') || 'enabled'; |
||||
next if ($ajaxplorer ne 'enabled' || $indexer ne 'enabled'); |
||||
my $name = $share->key; |
||||
system('/usr/bin/sudo -u www /usr/bin/php /usr/share/ajaxplorer/cmd.php ' . |
||||
'-u=RDiin175M40T0cYvXLARpAi+1TsSVkbksEDZ4KvwBuY= '. |
||||
'-t=e71479ebc4365176d9f09fe957780024 -a=index '. |
||||
'-r='.$name.' --secure_token='.$id.' --dir=/ --_method=put 2>/dev/null 2>&1'); |
||||
} |
||||
# We should now restart OOo to release memory |
||||
if (-d '/var/service/ooo'){ |
||||
system('/usr/bin/sv t /service/ooo'); |
||||
} |
Loading…
Reference in new issue