autotupdate: better error message when download failed
Also docuemnt and ship disabled checksums for beta
This commit is contained in:
parent
61a1bc89f1
commit
78c0e0fbf1
2 changed files with 12 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
1.1.6
|
||||||
|
* When curl download could not be tried, detect this as fail
|
||||||
|
* Improve error messages if update can't be downloaded
|
||||||
|
* Don't check checksums for beta
|
||||||
|
|
||||||
1.1.5
|
1.1.5
|
||||||
* Check for broken existing zip file
|
* Check for broken existing zip file
|
||||||
* Set new requirement for PHP 5.2+
|
* Set new requirement for PHP 5.2+
|
||||||
|
|
|
@ -22,7 +22,7 @@ class serendipity_event_autoupdate extends serendipity_event {
|
||||||
$propbag->add('description', PLUGIN_EVENT_AUTOUPDATE_DESC);
|
$propbag->add('description', PLUGIN_EVENT_AUTOUPDATE_DESC);
|
||||||
$propbag->add('stackable', false);
|
$propbag->add('stackable', false);
|
||||||
$propbag->add('author', 'onli, Ian');
|
$propbag->add('author', 'onli, Ian');
|
||||||
$propbag->add('version', '1.1.5');
|
$propbag->add('version', '1.1.6');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '0.8',
|
'serendipity' => '0.8',
|
||||||
'php' => '5.2'
|
'php' => '5.2'
|
||||||
|
@ -284,11 +284,9 @@ EOS;
|
||||||
*/
|
*/
|
||||||
function fetchUpdate($version) {
|
function fetchUpdate($version) {
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
|
|
||||||
#$url = (string)"http://prdownloads.sourceforge.net/php-blog/serendipity-$version.zip?download";
|
|
||||||
$url = (string)"https://github.com/s9y/Serendipity/releases/download/$version/serendipity-$version.zip";
|
$url = (string)"https://github.com/s9y/Serendipity/releases/download/$version/serendipity-$version.zip";
|
||||||
$update = (string)$serendipity ['serendipityPath'] . 'templates_c/' . "serendipity-$version.zip";
|
$update = (string)$serendipity ['serendipityPath'] . 'templates_c/' . "serendipity-$version.zip";
|
||||||
|
|
||||||
// do we already have it and is it eventually broken?
|
// do we already have it and is it eventually broken?
|
||||||
if (file_exists($update)) {
|
if (file_exists($update)) {
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
|
@ -320,10 +318,13 @@ EOS;
|
||||||
|
|
||||||
$success = @curl_exec($ch);
|
$success = @curl_exec($ch);
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Downloading update failed</p>');
|
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Downloading update failed (curl installed, but failed). Does '. $url .' exist?</p>');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Downloading update failed (copy failed, curl not available). Does '. $url .' exist?</p>');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Fetch download to templates_c done</p>');
|
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Fetch download to templates_c done</p>');
|
||||||
return $update;
|
return $update;
|
||||||
|
@ -336,14 +337,10 @@ EOS;
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function verifyUpdate($update, $version) {
|
function verifyUpdate($update, $version) {
|
||||||
#$url = (string)"http://prdownloads.sourceforge.net/php-blog/serendipity-$version.zip?download";
|
|
||||||
$url = (string)"https://github.com/s9y/Serendipity/releases/download/$version/serendipity-$version.zip";
|
$url = (string)"https://github.com/s9y/Serendipity/releases/download/$version/serendipity-$version.zip";
|
||||||
#$updatePage = (string)$this->getPage("http://www.s9y.org/12.html");
|
|
||||||
$updatePage = (string)$this->getPage("https://github.com/s9y/Serendipity/releases/tag/$version");
|
$updatePage = (string)$this->getPage("https://github.com/s9y/Serendipity/releases/tag/$version");
|
||||||
#$downloadLink = substr($updatePage, strpos($updatePage, $url), 200);
|
|
||||||
$found = array();
|
$found = array();
|
||||||
// grep the checksum
|
// grep the checksum
|
||||||
#preg_match("/\(MD5: (.*)\)/", $downloadLink, $found);
|
|
||||||
preg_match("/\(MD5: (.*)\)/", $updatePage, $found);
|
preg_match("/\(MD5: (.*)\)/", $updatePage, $found);
|
||||||
$checksum = $found[1];
|
$checksum = $found[1];
|
||||||
$this->show_message('<p class="msg_notice"><span class="icon-attention"></span>Checking MD5 zip file checksum: ' . $checksum . '</p>');
|
$this->show_message('<p class="msg_notice"><span class="icon-attention"></span>Checking MD5 zip file checksum: ' . $checksum . '</p>');
|
||||||
|
@ -547,7 +544,6 @@ EOS;
|
||||||
if (strpos($version, 'beta') !== FALSE) {
|
if (strpos($version, 'beta') !== FALSE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once $checksumFile;
|
include_once $checksumFile;
|
||||||
|
|
||||||
$checksums = $serendipity['checksums_' . $version];
|
$checksums = $serendipity['checksums_' . $version];
|
||||||
|
|
Loading…
Reference in a new issue