Project

General

Profile

Download (1.72 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-2016 Rubicon Communications, LLC (Netgate)
8
 * All rights reserved.
9
 *
10
 * Originally part of m0n0wall (http://m0n0.ch/wall)
11
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
 * All rights reserved.
13
 *
14
 * Licensed under the Apache License, Version 2.0 (the "License");
15
 * you may not use this file except in compliance with the License.
16
 * You may obtain a copy of the License at
17
 *
18
 * http://www.apache.org/licenses/LICENSE-2.0
19
 *
20
 * Unless required by applicable law or agreed to in writing, software
21
 * distributed under the License is distributed on an "AS IS" BASIS,
22
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
 * See the License for the specific language governing permissions and
24
 * limitations under the License.
25
 */
26

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

    
35
global $g;
36
global $cpzone;
37
global $cpzoneid;
38

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

    
46
$rcprunelock = try_lock("rcprunecaptiveportal{$cpzone}", 3);
47

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

    
54
captiveportal_prune_old();
55

    
56
unlock($rcprunelock);
57

    
58
?>
(62-62/78)