2016-05-20 02:42:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Daemon;
|
|
|
|
|
|
|
|
|
|
|
|
class Importdoc {
|
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
public static function run($argc, $argv) {
|
2016-05-20 02:42:45 +00:00
|
|
|
|
|
|
|
require_once('include/help.php');
|
|
|
|
|
|
|
|
self::update_docs_dir('doc/*');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
public static function update_docs_dir($s) {
|
2016-05-20 02:42:45 +00:00
|
|
|
$f = basename($s);
|
|
|
|
$d = dirname($s);
|
|
|
|
if($s === 'doc/html')
|
|
|
|
return;
|
|
|
|
$files = glob("$d/$f");
|
|
|
|
if($files) {
|
|
|
|
foreach($files as $fi) {
|
2017-05-25 05:34:52 +00:00
|
|
|
if($fi === 'doc/html') {
|
2016-05-20 02:42:45 +00:00
|
|
|
continue;
|
2017-05-25 05:34:52 +00:00
|
|
|
}
|
|
|
|
if(is_dir($fi)) {
|
2016-05-20 02:42:45 +00:00
|
|
|
self::update_docs_dir("$fi/*");
|
2017-05-25 05:34:52 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// don't update media content
|
|
|
|
if(strpos(z_mime_content_type($fi),'text') === 0) {
|
|
|
|
store_doc_file($fi);
|
|
|
|
}
|
|
|
|
}
|
2016-05-20 02:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-01 23:59:57 +00:00
|
|
|
// 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 - INTERVAL %s",
|
|
|
|
db_utcnow(),
|
|
|
|
db_quoteinterval('14 DAY')
|
|
|
|
);
|
|
|
|
if ($i) {
|
|
|
|
foreach ($i as $iv) {
|
|
|
|
drop_item($iv['id'],false,DROPITEM_NORMAL,true);
|
|
|
|
}
|
|
|
|
}
|
2016-05-20 02:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|