|
|
10 years ago | |
|---|---|---|
| .. | ||
| src | 10 years ago | |
| tests | 10 years ago | |
| .gitattributes | 10 years ago | |
| .updateignore | 10 years ago | |
| LICENSE | 11 years ago | |
| README.md | 10 years ago | |
| composer.json | 10 years ago | |
| composer.lock | 10 years ago | |
| example.php | 10 years ago | |
| example2.php | 10 years ago | |
Simple Github Updater for Web Projects [PHP]
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater('kanti/test');
$updater->update();
releases tab ‣‣Draft a new release ‣‣Publish release ‣‣The recommended way to install hub-updater is through Composer.
# Install Composer
curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of HubUpdater:
composer require kanti/hub-updater ~0.3
After installing, you need to require Composer's autoloader:
<?php
require 'vendor/autoload.php';
$settings = array(
"settingsKey" => 'value',
);
new \Kanti\HubUpdater($settings);
| setting | description | default |
|---|---|---|
| name | the name your Repository has | must be set |
| branch | the branch you like to watch. | master |
| cache | the directory you like to put the cache stuff | ./cache/ |
| save | the directory you like to put the content of the zip | ./ |
| prerelease | would you like to download the prereleases? | false |
| cacheFile | name of the InformationCacheFile(in cacheDir) | downloadInfo.json |
| holdTime | time(seconds) the Cached-Information will be used | 43200 |
| versionFile | name of the InstalledVersionInformation is safed(in cacheDir) | installedVersion.json |
| zipFile | name of the temporary zip file(in cacheDir) | tmpZipFile.zip |
| updateignore | name of the updateignore file(in root of project) | .updateignore |
| exceptions | if true, will throw new \Exception on failure |
false |
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater(array(
"cacheFile" => "downloadInfo.json",//name of the InformationCacheFile(in cacheDir)
"holdTime" => 43200,//time(seconds) the Cached-Information will be used
"versionFile" => "installedVersion.json",//name of the InstalledVersionInformation is safed(in cacheDir)
"zipFile" => "tmpZipFile.zip",//name of the temporary zip file(in cacheDir)
"updateignore" => ".updateignore",//name of the updateignore file(in root of project)
"name" => 'kanti/test',//Repository to watch
"branch" => 'master',//wich branch to watch
"cache" => 'cache/',//were to put the caching stuff
"save" => 'save/',//there to put the downloaded Version[default ./]
"prerelease" => true,//accept prereleases?
"exceptions" => true,//if true, will throw new \Exception on failure
));
if ($updater->able()) {
if (isset($_GET['update'])) {
$updater->update();
echo '<p>updated :)</p>';
} else {
echo '<a href="?update">Update Me</a>'; //only update if they klick this link
}
} else {
echo '<p>uptodate :)</p>';
}
put a file in one line and it will not be updated. note put the .updateignore in your projects root directory
.htaccess
favicon.ico
there/the/config.ini/is.ini