You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.3 KiB
36 lines
1.3 KiB
11 years ago
|
#!/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');
|
||
|
}
|