forked from 540co/yourTwapperKeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstoparchiving.php
31 lines (26 loc) · 930 Bytes
/
stoparchiving.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// Load important files
session_start();
require_once('config.php');
require_once('function.php');
require_once('twitteroauth.php');
// Ensure user is an administrator
if (!(in_array($_SESSION['access_token']['screen_name'],$admin_screen_name))) {
$_SESSION['notice'] = "Only administrators are allowed to stop / start archiving processes";
header('Location:index.php');
die;
}
// List of archiving scripts
$cmd = $archive_process_array;
// Query PIDS and kill jobs
foreach ($cmd as $key=>$value) {
$pid = mysql_fetch_assoc(mysql_query("select pid from processes where process = '$value'", $db->connection));
$pid = $pid['pid'];
$tk->killProcess($pid);
$pids .= $pid.",";
mysql_query("update processes set pid = '0' where process = '$value'", $db->connection);
}
$pids = substr($pids, 0, -1);
$_SESSION['notice'] = "Twitter archiving processes have been stopped. (PIDs = $pids)";
header('Location:index.php');
?>