Project

General

Profile

Download (1.81 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php-cgi -f
2
<?php
3
/*
4
 * rc.prunecaptiveportal
5
 *
6
 * part of pfSense (https://www.pfsense.org)
7
 * Copyright (c) 2004-2013 BSD Perimeter
8
 * Copyright (c) 2013-2016 Electric Sheep Fencing
9
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
10
 * All rights reserved.
11
 *
12
 * Originally part of m0n0wall (http://m0n0.ch/wall)
13
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
14
 * All rights reserved.
15
 *
16
 * Licensed under the Apache License, Version 2.0 (the "License");
17
 * you may not use this file except in compliance with the License.
18
 * You may obtain a copy of the License at
19
 *
20
 * http://www.apache.org/licenses/LICENSE-2.0
21
 *
22
 * Unless required by applicable law or agreed to in writing, software
23
 * distributed under the License is distributed on an "AS IS" BASIS,
24
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
 * See the License for the specific language governing permissions and
26
 * limitations under the License.
27
 */
28

    
29
/* parse the configuration and include all functions used below */
30
/* config.inc retrieves the util.inc and globals.inc */
31
require_once("config.inc");
32
require_once("functions.inc");
33
require_once("filter.inc");
34
require_once("shaper.inc");
35
require_once("captiveportal.inc");
36

    
37
global $g;
38
global $cpzone;
39
global $cpzoneid;
40

    
41
$cpzone = str_replace("\n", "", $argv[1]);
42
if (!is_array($config['captiveportal'][$cpzone])) {
43
	log_error("{$cpzone} is not a valid zone in the configuration!");
44
	return;
45
}
46
$cpzoneid = $config['captiveportal'][$cpzone]['zoneid'];
47

    
48
$rcprunelock = try_lock("rcprunecaptiveportal{$cpzone}", 3);
49

    
50
if (!$rcprunelock) {
51
	log_error("Skipping CP pruning process for zone {$cpzone} because previous/another instance is already running");
52
	unlock_force("rcprunecaptiveportal{$cpzone}");
53
	return;
54
}
55

    
56
captiveportal_prune_old();
57

    
58
unlock($rcprunelock);
59

    
60
?>
(64-64/82)