我目前正在开发一个cron作业,它从外部源下载一个xml文件,并将其存储在wordpress媒体中。为了调试建议,我安装了插件Advanced Cron Manager,它允许我手动运行Cron作业。
cronjob的手动执行工作正常,没有任何问题。当cronjob按照其时间表执行时,我面临的问题是:;很抱歉,出于安全原因,不允许使用此文件类型;。
在我的cron函数中,我配置了:
/** Allow all filetypes to be uploaded */
define(\'ALLOW_UNFILTERED_UPLOADS\', true);
由于这不起作用,我还尝试添加ALLOW_UNFILTERED_UPLOADS
在我的wp-config.php
, 结果是一样的。还将其添加到ALLOW_UNFILTERED_UPLOADS
至wp cron。php没有帮助。在执行过程中,我还看到以下通知:
[24-Nov-2021 08:54:14 UTC] PHP Notice Constant ALLOW_UNFILTERED_UPLOADS already defined in /var/www/virtual/wpwwwdev/html/wp-content/plugins/phantoms-wp/includes/cron.php on line 16
所以常数是确定的。我还需要为cron调用设置其他内容吗?错误由以下原因引发:
$file = [
\'uri\' => \'https://vereine.football-verband.de/xmlspielplan.php5?Ausgabe=xml\',
\'description\' => date(\'d.m.Y\', time()) . \' - XML Spielplan\',
\'name\' => \'xmlspielplan.xml\',
\'type\' => \'xml\',
\'tmp_name\' => download_url(\'https://vereine.football-verband.de/xmlspielplan.php5?Ausgabe=xml\')
];
media_handle_sideload( $file, 0, $file[\'description\'] );
向你问好,塞巴斯蒂安