blob: 8f04e05f8ea96e8adce2b1c579367985a76fc589 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
namespace Zotlabs\Daemon;
class Importdoc {
static public function run($argc, $argv) {
require_once('include/help.php');
self::update_docs_dir('doc/*');
return;
}
static public function update_docs_dir($s) {
$f = basename($s);
$d = dirname($s);
if ($s === 'doc/html') {
return;
}
$files = glob("$d/$f");
if ($files) {
foreach ($files as $fi) {
if ($fi === 'doc/html') {
continue;
}
if (is_dir($fi)) {
self::update_docs_dir("$fi/*");
}
else {
// don't update media content
if (strpos(z_mime_content_type($fi), 'text') === 0) {
store_doc_file($fi);
}
}
}
}
// remove old files that weren't updated (indicates they were most likely deleted).
$i = q("select * from item where item_type = 5 and edited < %s - %s",
db_utcnow(),
db_quoteinterval('14 DAY', true)
);
if ($i) {
foreach ($i as $iv) {
drop_item($iv['id'], DROPITEM_NORMAL, true);
}
}
}
}
|