GithubHelp home page GithubHelp logo

jrcron_bonfire-module's Introduction

jrCron Bonfire Module

At first I planned to create an entire application in Bonfire, but I've found that for what I need I only have to create a single module.

This is it; the jrCron Bonfire Module. This module is an extension for Bonfire designed with the ability in mind of managing cron jobs and scrapers. It shows reports on your cron jobs, provides an interface to review and download exported files, and allows you to control what cron jobs will run and what time.

Initially I'm only configuring this to do what I need it to do for this job, but anyone may extend it if they please, or they can simply use the code I have for their own projects. I'll only extend it if I ever need to improve it for any reason.

Q. Why not just call it "Cron"?

I originally called it that, but then I designed I should probably differentiate it from other potential modules that may be made in the future. So I gave it my own prefix.

Q. Is this module plug-in and play?

No. Unfortunately, with this kind of thing its really pretty much impossible. It simply makes it easier to manage and watch cron jobs. You have to be the one to write your own cron jobs, but if you use the function wrappers properly, it will automatically keep records of your cron jobs and enable you to shut off certain jobs from running if you decide to go that route.

Naturally, you have to connect it up in cron. This is vital. It won't run at all if its not in cron in the first place. But my idea is that this module will work well as a wrapper for anything that you may want to run in cron. Primarily its for my own ease of use, but anyone can use it if they wish.

Update #7:

I just made a quick bugfix. So long as the job is successful runtime should be no less than one second.

Update #6:

Its been about a week since I've updated, huh? Well, I've made some MAJOR updates over the past few days.

There's now officially a fully working Settings panel. The Settings > Cron panel lists all cron jobs available. These cron jobs must be defined in the new "$cron_jobs" variable array located in jrcron_model.php. The functions added to the model for managing cron job data will properly convert the arrays into objects, and will also grab them from the database if required.

The new migration, version 3, adds some functions to be used. I also fixed several bugs related to migrations. First of all, prefix was not being defined properly in migrations. I found several other odd issues as well which have been fixed. These right here resolved the error in migrations, array() to string conversion. I also fixed a bug where some settings in migration #2 were not being added to the administrator role.

In the new settings panel, it has a list of cron jobs. These settings can be updated on the main panel to be active or inactive. This means that when the job is run, it will not process the job, as defined in jrcron.php. There are also additional settings that can be updated by clicking on each individual job.

Memory Limit will change the memory limit on execution of the cron job. It automatically defines the 'M'; the field will only accept numeric characters. Time limit does the same but for time. I also added the ability to change what the file name will appear as in the control panel. The default file export name is defined in the $cron_jobs variable array. All of these settings are job-specific, and the ability to change the limit is useful if you don't want to have all jobs running at longer times, but you do want it to work on jobs that take a little longer to process.

I also completely overhauled the Exports page. The page now displays all jobs by default, but also displays information about the latest time the job was run. If it has been run, it'll show the latest export available for download on the right side. I also added a link at the bottom of the page called "Download Zip," which compiles all exported files listed on the page into one zip file.

In addition to this, there's now a separate page for each cron job. This will list every time the cron job has been run, and provided an exported file for each. Download Zip also appears on this page, and obviously, it will download the zip file of exported CSV's for every time that single cron job has run. This page does not have pagination at this time, though, so if these jobs are run at shorter intervals it may cause problems.

There is still no Reports page, though. I even removed the Reports page from the list so people wouldn't try to use it.

jrcron_bonfire-module's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

jrcron_bonfire-module's Issues

Array to string error on install

When installing module in Bonfire I get an array to string conversion error. This error did not occur the first time I installed the module but has happened every time since then.

I have not tried installing the module on a new installation of Bonfire. It's possible it's just my installation that's messed up. At this point, though, I'm not too concerned about it; I'll fix it later.

Add Cron Settings Panel

Add a basic cron settings panel in the backend. Later I will add extended support for specific jobs, but initially it'll just be global settings.

Errors when migrating down and up again

When first migrating jrcron up it works fine. When trying to migrate down it returns an array to string conversion error, and it continues to so this if you migrate up and down after that; it only works on the first migration up without error.

Create Cron Jobs Ended Report

Like the cron jobs ended report, its just a report listing off the cron jobs that have ended, in descending order from newest to oldest.

Create Cron Jobs Started Report

One of several reports to be created is the cron jobs started report. This would show off all cron jobs started and when, in descending order.

Cron Reports Dashboard

Create a cron reports dashboard showing short lists of the latest cron logs. This dashboard will probably consist of the latest cron jobs started, the latest cron jobs finished, and the latest cron errors that were thrown.

Create Cron Logs Report

Create a cron logs report that shows off all cron logs for every cron job. This would primarily be for showing all logs on one specific job.

Create Exports List

A list of cron exports needs to be displayed in the backend admin with links to the files. The exports would generally be CSV files and would be exported during cron jobs that support them.

Create Cron Errors Report

Create a report that shows off and and all cron errors. If any error is thrown at any point, it will be archived and listed in here so it can be debugged properly by the developers of the cron jobs.

end_session doesn't update job status

In the jrcron_model end_session will create a cron log but it won't end the current open cron session. Maybe I just need to use the cron id instead of the session number to update the row?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.