Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Oct 29, 2017
1 parent 84c30df commit e95dd10
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@

Cronable is a simple script that allows auto-updating CIDRAM and phpMussel via cronjobs.

*THIS IS NOT YET PRODUCTION READY!*
*Cronable isn't compatible with all versions of the packages that it's associated with. For compatibility information (to know which versions of the packages that it's associated with that it can update from), please refer to the [Compatibility Charts](https://maikuolan.github.io/Compatibility-Charts/).*

---

### How to install:

@todo@
You can download the file containing the class, [Cronable.php](src/Cronable.php), directly from this repository, or, if you'd prefer, you can install it using Composer:

`composer require maikuolan/cronable`

Cronable is a stand-alone class that has no dependencies other than PHP, the cURL extension of PHP, and something to trigger it at the desired interval (generally, a cron manager of some description), and so, downloading it is all there really is to "installing" it.

---

### How to use:

@todo@
For auto-updating CIDRAM or phpMussel with Cronable, front-end management will need to be enabled. Create a new account from the accounts page for Cronable to use, and set the permissions for this new account to "Cronable" (the "Cronable" permissions type is intended only for Cronable, and shouldn't be used for anything else). Take note of the username and password that you choose for this new account, because you'll need it in a moment.

Next, check the [examples.php](examples.php) file, and using the instructions and examples given in the file, create your update tasks as per necessary.

Using your cron manager or other triggering mechanism, create a new cron task with the desired update interval (please don't choose an excessively short interval, as the inbound requests received by the servers containing the updates may perceive this as abuse, and you may blocked by them as a consequence; checking for updates once a day should be more than enough; most updates tend to be released once per week or once per month anyhow), pointing to the file containing your Cronable update tasks.

That's everything. :-)

---

Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
},
"require": {
"php": ">=5.4.0"
},
"autoload": {
"psr-4": {
"Maikuolan\\Cronable\\": "src/"
}
}
}
48 changes: 43 additions & 5 deletions examples.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,57 @@
<?php
require 'cronable.php';
/**
* This file provides some basic examples of how to use Cronable.
*
* You could instantiate an object from the Cronable class directly within the
* class file itself if you wanted to, perhaps for the sake of simplicity, or,
* if you'd prefer to maintain good SoC and avoid overriding changes during
* Composer updates, you could do as is done by this example file, by requiring
* the class file and importing the class from its namespace into a new,
* separate PHP file, and instantiating the object there.
*/

/** Requiring the Cronable class file. */
require __DIR__ . 'src/Cronable.php';

/** Importing the Cronable class from its namespace. */
use \Maikuolan\Cronable\Cronable;

/** Instantiate the Cronable class to an object. */
/** Instantiate a new object from the Cronable class. */
$Cronable = new Cronable;

/** Create a tast to update CIDRAM. */
/**
* Create a task to update CIDRAM.
*
* The createTask method accepts 4 parameters:
* - The type of package to be updated (must always be "CIDRAM" for updating CIDRAM).
* - The username of the front-end account to be used by Cronable for updating the package.
* - The password of the front-end account to be used by Cronable for updating the package.
* - The location of the package loader file.
*/
$Cronable->createTask('CIDRAM', 'username', 'password', 'http://foo.tld/cidram/loader.php');

/** Create a tast to update phpMussel. */
/**
* Create a task to update phpMussel.
*
* The createTask method accepts 4 parameters:
* - The type of package to be updated (must always be "phpMussel" for updating phpMussel).
* - The username of the front-end account to be used by Cronable for updating the package.
* - The password of the front-end account to be used by Cronable for updating the package.
* - The location of the package loader file.
*/
$Cronable->createTask('phpMussel', 'username', 'password', 'http://foo.tld/phpmussel/loader.php');

/** Execute all tasks. */
$Cronable->execute();

/** Print output for cron. */
/**
* Print output for cron.
*
* This should be done as so that your cronjob can properly report whether
* updating was successful, and which components were updated accordingly.
*
* Output should either be a list of which components were updated, separated
* by their relevant associated tasks, or the relevant associated error
* messages, if problems occurred while attempting to update.
*/
echo $Cronable->Output;
7 changes: 4 additions & 3 deletions cronable.php → src/Cronable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
namespace Maikuolan\Cronable;

/**
* Cronable v0.0.1-ALPHA (last modified: 2017.10.29).
* Cronable v1.0.0 (last modified: 2017.10.29).
*
* Description: Allows auto-updating CIDRAM and phpMussel via cronjobs.
* Description: Cronable is a simple script that allows auto-updating CIDRAM
* and phpMussel via cronjobs.
*
* CRONABLE COPYRIGHT 2017 and beyond by Caleb Mazalevskis (Maikuolan).
*
Expand All @@ -16,7 +17,7 @@ class Cronable
{

/** Cronable user agent. */
private $ScriptUA = 'Cronable v0.0.1-ALPHA';
private $ScriptUA = 'Cronable v1.0.0';

/** Default timeout. */
private $Timeout = 12;
Expand Down

0 comments on commit e95dd10

Please sign in to comment.