visualappeal / php-auto-update Goto Github PK
View Code? Open in Web Editor NEWPHP auto-update class. Let the user upgrade their installations automatically.
License: MIT License
PHP auto-update class. Let the user upgrade their installations automatically.
License: MIT License
I got this exception why does it happens? : Invalid argument supplied for foreach() on line: 484 in .. src/AutoUpdate.php
The url I added is correct surely. And I copied your update.json.
When attempting to run the update I get "no new version available"
I'm not sure why this is happening.
Current Version is up to date
Log:
[2015-02-20 15:30:50] auto-update.NOTICE: Checking for a new update... [] []
[2015-02-20 15:30:50] auto-update.DEBUG: Get new updates from http://_the_website_/update.json [] []
[2015-02-20 15:30:51] auto-update.DEBUG: No new version available [] []
Here's my update.json
{
“1.4.0”: "http://_the_website_/1.4.0.zip",
“1.5.0”: "http://_the_website_/1.5.0.zip"
}
Here's my index.php script
<?php
require '../vendor/autoload.php';
use \VisualAppeal\AutoUpdate;
$update = new AutoUpdate(__DIR__ . '/temp', __DIR__ . '/../', 60);
$update->setCurrentVersion('1.4.0'); //Must be an integer - you can't compare strings
$update->setUpdateUrl('http://_the_website_'); //Replace with your server update directory
// Optional:
//$update->addLogHandler(new Monolog\Handler\StreamHandler(__DIR__ . '/update.log'));
//$update->setCache(new Desarrolla2\Cache\Adapter\File(__DIR__ . '/cache'), 3600);
//Check for a new update
if ($update->checkUpdate() === false)
die('Could not check for updates! SEe log file for details.');
if ($update->newVersionAvailable()) {
//Install new update
echo 'New Version: ' . $update->getLatestVersion() . '<br>';
echo 'Installing UPdates: <br>';
echo '<pre>';
var_dump(array_map(function($version) {
return (string) $version;
}, $update->getVersionsToUpdate()));
echo '</pre>';
$result = $update->update();
if ($result === true) {
echo 'Update successful<br>';
} else {
echo 'Update failed: ' . $result . '!<br>';
if ($result = AutoUpdate::ERROR_SIMULATE) {
echo '<pre>';
var_dump($update->getSimulationResults());
echo '</pre>';
}
}
} else {
echo 'Current Version is up to date<br>';
}
echo 'Log:<br>';
echo nl2br(file_get_contents(__DIR__ . '/update.log'));
Can you tell me why PHP 5.4 is no longer supported? Did you add something that is only supported in PHP 5.5+?
1.) There is no error handler / error catcher for the connection loss error with downloading of update in ongoing.
2.) No error handler for No Internet Connection Available.
I'm testing the new version and I get this error.
PHP Parse error: syntax error, unexpected '[' in C:\inetpub\wwwroot\mamobile_test\vendor\visualappeal\php-auto-update\src\AutoUpdate.php on line 338
PHP-Auto-Update/src/AutoUpdate.php
Line 809 in 06394df
$fileStats['filename'] -> $fileStats['name']
PHP-Auto-Update/src/AutoUpdate.php
Line 812 in 06394df
, $this->installDir . $filename); -> , $this->installDir);
PHP-Auto-Update/src/AutoUpdate.php
Line 827 in 06394df
$fileStats['filename'] -> $fileStats['name']
Can you please add information about the license?
thanks
Hello,
I just had a look at your code and it looks quite good so far,
but then I found that you are only downloading the latest version, which would either force the user to never skip an update or the developer has to include all previous updates in the new version.zip file, which would lead to quite big zip files containing useless data for some users.
So wouldn't it be better to just loop through all the skipped versions and download them and afterwards install them?
Greetings, flx5.
Hello,
Would be great if we could have a list of clients in the server side and be able to update all of them from there
Is it possible?
Thanks!
I am currently using Monolog 1.22., but PHP Auto Update requires 1.21.
Is there something in 1.22.* that is not supported in the latest release of PHP Auto Update?
Error Message:
- visualappeal/php-auto-update 0.9.4 requires monolog/monolog 1.21.* -> satisfiable by monolog/monolog[1.21.0] but these conflict with your requirements or minimum-stability.
Hi,
while debugging I noticed, that in this piece of code the filename
variable seems to have issue:
The variable filename
is always ""
even though in fileStats
there is a valid name.
I am not sure but this seems strange to me. Is this intended behaviour?
Hello,
cool project :-)
But i have any questions. Can you help me?
I make the Server/client config und the update file to update, but it seems like SIMULATE.
[2016-10-17 15:10:56] auto-update.DEBUG: Latest update downloaded to "/html/cms/temp/0.2.0.zip" [] []
[2016-10-17 15:10:56] auto-update.NOTICE: Trying to install update "/html/cms/temp/0.2.0.zip" [] []
[2016-10-17 15:10:56] auto-update.NOTICE: [SIMULATE] Install new version [] []
[2016-10-17 15:10:56] auto-update.NOTICE: Update "0.2.0" successfully installed [] []
[2016-10-17 15:10:56] auto-update.DEBUG: Trying to delete update file "/html/cms/temp/0.2.0.zip" after successfull update [] []
[2016-10-17 15:10:56] auto-update.INFO: Update file "/html/cms/temp/0.2.0.zip" deleted after successfull update [] []
Where kann i set run a LIVE Update?
Where set the Version change after Update?
greetings Sam
Hi!
Please remove the @ chars from the class, so one can handle connection exceptions in their program. Exceptions are an important part of object oriented programming.
Thanks!
Hi,
I have an update package that looks like this:
UPDATE.md
logs/
test.txt
The extraction of UPDATE.md fails with this exception:
ZipArchive::extractTo(/var/www/html/mysecretapp/UPDATE.md/UPDATE.md): failed to open stream: No such file or directory
Strange thing is that, when debugging, like the extraction should actually work (sorry for the blurring, it all says the same very secret application name 😉):
I don't really get why the path is duplicated.
Edit: Oh, and the foldername
is /var/www/html/mysecretapp/.
Hi
in line 589
$this->_log->addDebug('[SIMULATE] Update script "%s" found', $absoluteFilename);
replace by
$this->_log->addDebug(sprintf('[SIMULATE] Update script "%s" found', $absoluteFilename));
Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead in C:\xampp\htdocs\xx\xxx\xxx\vendor\visualappeal\php-auto-update\src\AutoUpdate.php on line 590
Did you switch to using a json file to keep track of available updates?
Hi,
For security reasons and an increase in speed I want to update the PHP version of my WordPress website to PHP 7. WordPress also strongly recommends the latest version of PHP on their requirements page, https://wordpress.org/about/requirements/.
More information about currently supported versions of PHP can be found here: http://php.net/supported-versions.php.
I've heard that sometimes a website can break when updating the PHP version. Can you assist me and update my site safely to PHP 7?
Thanks!
Hello @VisualAppeal
First of all simple and great script.
While we were testing, we notice that if (!is_writable($this->installDir.$filename)) is called to check if the file is writable or not.
What is there is a case where a new files needs to be added, since the file is new then the check would fail and stop the script execution as it returns false.
Hope you are getting me...
Hi!
I can not install the package in PHP 8. Can you please also add 8.0 to composer.json
Problem 1
- Installation request for visualappeal/php-auto-update 0.13.1 -> satisfiable by visualappeal/php-auto-update[0.13.1].
- visualappeal/php-auto-update 0.13.1 requires php ^7.2.0 -> your PHP version (8.0.0) does not satisfy that requirement.
Thank you!
Hello,
The currentVersion variable in index.php (client side) should be dynamic, and change when the update is complete
index.php code in question:
$update->currentVersion = 1;
It's a static field, if I update my code to Version 2, I have to change this value manually, wich kills the purpose of an automated PHP system
Thanks
[2019-01-02 13:27:56] auto-update.NOTICE: Checking for a new update... [] []
[2019-01-02 13:27:56] auto-update.DEBUG: Get new updates from https://mysite.com/migrations/1.1/update.json [] []
[2019-01-02 13:27:56] auto-update.ERROR: Could not download update "https://mysite.com/migrations/1.1/update.json" via curl: SSL: no alternative certificate subject name matches target host name 'mysite.com'! [] []
[2019-01-02 13:27:56] auto-update.ERROR: Could not download update file "https://mysite.com/migrations/1.1/update.json" via curl! [] []
And PHP Error
Fatal error: Class 'VisualAppeal\Exceptions\DownloadException' not found in /home/mysite/public_html/lib/src/AutoUpdate.php on line 444
I had an update.ini file that looked like this.
[1]
version = 1.4
url = http://192.168.1.15/mamobile_update/1.4.zip
When the script tried to download the update, the path looked like this.
url = http://192.168.1.15/mamobile_update/1.zip
For some reason it was using 1.zip instead of 1.4.zip
I had to change the update.ini like this for it to work correctly
[1.4]
version = 1.4
url = http://192.168.1.15/mamobile_update/1.4.zip
Shouldn't it be getting the full path from url?
Hello,
how to update the database at the same time as the update?
Thanks.
Hi,
I am currently testing this library and noticed that it is only possible to set a Monolog\Handler\HandlerInterface
for logging.
I think that using a Psr\Log\LoggerInterface
would be a better option.
In a typical dependency injection chain I would not directly use a Handler for logging but rather the logger itself.
If this seems sensible I could submit a PR.
Hi,
thanks for this library, really useful and intuitive! Are you planning to add a new release anytime soon? I'm currently using the git-master as a dependency in composer because of the fixes applied after 0.9.2 (see #18 ). This messes up my CI workflow, since composer install
also creates .git/
directories which I then have to exclude from the artifact … etc. Would really appreciate a new release version 👍 😃
New files and folders are not created.
Its ok to update files that already exist but imagine you need to update your scripts with some new files and folders.
Is this a normal procedure?
Are you thinking on changing the semver class to composer/semver? It supports much more semantic versioning regex.
i have problem
#1 what is this error
Notice: Undefined variable: zip in C:\xampp\htdocs\PHP-Auto-Update-master\updater\src\AutoUpdate.php on line 694
Warning: zip_close() expects parameter 1 to be resource, null given in C:\xampp\htdocs\PHP-Auto-Update-master\updater\src\AutoUpdate.php on line 694
Update failed: 70!
array(32) {
[0]=>
array(3) {
["filename"]=>
string(6) "files/"
["foldername"]=>
string(66) "C:\xampp\htdocs\PHP-Auto-Update-master\example\client\update/..//."
["absolute_filename"]=>
string(71) "C:\xampp\htdocs\PHP-Auto-Update-master\example\client\update/..//files/"
}
how can use this code in codeigniter or other frameworks
Hi!
All the subdirs are created as files. And after that touch throws invalid argument exception.
Also is_dir returns false on subdirs.
I'm trieing on windows with xampp. I know that on linux folders are files too. Maybe this is the problem? I'll check it on linux later.
Can you please fix these problems? Thanx!
Hello,
Functions zip_open, zip_close, zip_entry_read are deprecated
Must use ZipArchive functions instead.
Thanks
I have made a branch support but now the updater says to me:
[2015-02-24 16:29:45] auto-update.NOTICE: Checking for a new update... [] []
[2015-02-24 16:29:45] auto-update.DEBUG: Get new updates from http://media.xxxx.de/rpicms/server/update.json.stable [] []
[2015-02-24 16:29:45] auto-update.INFO: Unknown file extension "stable" [] []
What must I change to allow this file extension? Or can branches made as an feature?
When checking the update logs, I noticed that appears with each entry a double slash?
Get new updates from https://update.server.de/folder//modul/update.json [] []
Furthermore, I always get the error "File not found" with Windows Server and everything works fine on Linux. Would be very grateful for an advice. Best regards, Daniel
Hi,
I freshly required the library over composer and tried implementing it into my existing code. After a first Test run, I had 2 Unknown Variables in the source of this library... Like how could this happen? I'm just using it to update stuff?? You cannot tell me that nobody else ran into this issue.
Nevertheless, I will build on this foundation and created a fork where I'll be refactor the code and fix the above mentioned errors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.