-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,10 @@ | |
}, | ||
"require": { | ||
"php": ">=5.4.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Maikuolan\\Cronable\\": "src/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters