admin管理员组文章数量:1122832
I am interesting in setting up a Wordpress Website which needs to keep updating certain custom database tables after fetching data from RESTful Web Services, lets say once in a day.
I can achieve this by having a script to make request to REST API, process data and then store it into required tables.
However, I am not sure where to put this script file so cron can call it without any issues (security wise)
- Can I place these script files at root level of wordpress directory (such as
/script1.php
,script2.php
etc)? - Or I create a plugin of the script, would cron be able to access this file placed inside a plugins directory?
UPDATE
- There will be multiple scripts used by cron, therefore, I want to make plugins out of each script.. Would cron be table to access files in the plugins directory?
Anyone who can help?
I am interesting in setting up a Wordpress Website which needs to keep updating certain custom database tables after fetching data from RESTful Web Services, lets say once in a day.
I can achieve this by having a script to make request to REST API, process data and then store it into required tables.
However, I am not sure where to put this script file so cron can call it without any issues (security wise)
- Can I place these script files at root level of wordpress directory (such as
/script1.php
,script2.php
etc)? - Or I create a plugin of the script, would cron be able to access this file placed inside a plugins directory?
UPDATE
- There will be multiple scripts used by cron, therefore, I want to make plugins out of each script.. Would cron be table to access files in the plugins directory?
Anyone who can help?
Share Improve this question edited Oct 1, 2014 at 12:39 Ghazanfar Mir asked Oct 1, 2014 at 12:00 Ghazanfar MirGhazanfar Mir 1631 gold badge2 silver badges10 bronze badges 6- Use the script the WordPress API, the Cron of WordPress or functions? If not, leave outside the installation, is not in the context of this WP install. – bueltge Commented Oct 1, 2014 at 12:15
- There will be multiple scripts used by cron, therefore, I want to make plugins out of each script.. Would cron be table to access files in the plugins directory? – Ghazanfar Mir Commented Oct 1, 2014 at 12:35
- @bueltge: I am talking about Cron Jobs, not the wordpress cron. – Ghazanfar Mir Commented Oct 1, 2014 at 12:49
- Then outside the web root, because security issues. Also is it not in the context with the installation. – bueltge Commented Oct 1, 2014 at 13:09
- If you are running cron jobs then you should place those files outside web root. A place where these files cannot be accessed directly from browser. – Robert hue Commented Oct 1, 2014 at 13:51
1 Answer
Reset to default 0Assuming you're running cron jobs under your user account, it will have access to any folder that your account has read access to. If you do not need them to be publicly accessible, and you have access to a folder outside your public web root, then for security purposes you should put them outside of the web root.
However, if you are on shared hosting, this may not be possible due to open_basedir
restrictions. In that case, you can either create a subdirectory under your main Wordpress directory, or in your plugins folder. You can add an htaccess file to block access from the outside.
本文标签: plugin developmentBest place to keep files that are called by cron jobs
版权声明:本文标题:plugin development - Best place to keep files that are called by cron jobs? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736293421a1929143.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论