aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Channel_purge.php
blob: 9fceb0fb9ed97060c530041d77ee319944c53fc3 (plain) (blame)
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
32
33
34
<?php

namespace Zotlabs\Daemon;

class Channel_purge {

	static public function run($argc,$argv) {

		cli_startup();

		$channel_id = intval($argv[1]);

		$channel = q("select * from channel where channel_id = %d and channel_removed = 1",
			intval($channel_id)
		);

		if (! $channel) {
			return;
		}

		do {
			$r = q("select id from item where uid = %d and item_deleted = 0 limit 1000",
				intval($channel_id)
			);
			if ($r) {
				foreach ($r as $rv) {
					drop_item($rv['id'], false);
				}
			}
		} while ($r);

		return;
	}
}