serendipity autoupdate 1.1.4
use github repository download and disable old sourceforge url location References #358
This commit is contained in:
parent
9e0df165be
commit
ae07377091
2 changed files with 20 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
1.1.4
|
||||||
|
* Check into github repository from now on
|
||||||
|
* Remove dashboard plugin dependency with >= 2.0
|
||||||
|
|
||||||
1.1.3
|
1.1.3
|
||||||
* Fix bug when trying to download with cURL
|
* Fix bug when trying to download with cURL
|
||||||
|
|
||||||
|
|
|
@ -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.3');
|
$propbag->add('version', '1.1.4');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '0.8',
|
'serendipity' => '0.8',
|
||||||
'php' => '5.1'
|
'php' => '5.1'
|
||||||
|
@ -30,7 +30,9 @@ class serendipity_event_autoupdate extends serendipity_event {
|
||||||
$propbag->add('event_hooks', array('plugin_dashboard_updater' => true,
|
$propbag->add('event_hooks', array('plugin_dashboard_updater' => true,
|
||||||
'backend_sidebar_entries_event_display_update' => true));
|
'backend_sidebar_entries_event_display_update' => true));
|
||||||
$propbag->add('groups', array('BACKEND_FEATURES'));
|
$propbag->add('groups', array('BACKEND_FEATURES'));
|
||||||
$this->dependencies = array('serendipity_event_dashboard' => 'keep');
|
if ($serendipity['version'][0] < 2) {
|
||||||
|
$this->dependencies = array('serendipity_event_dashboard' => 'keep');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_content(&$title) {
|
function generate_content(&$title) {
|
||||||
|
@ -283,7 +285,8 @@ 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)"http://prdownloads.sourceforge.net/php-blog/serendipity-$version.zip?download";
|
||||||
|
$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?
|
// do we already have it?
|
||||||
|
@ -317,13 +320,16 @@ 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)"http://prdownloads.sourceforge.net/php-blog/serendipity-$version.zip?download";
|
||||||
$updatePage = (string)$this->getPage("http://www.s9y.org/12.html");
|
$url = (string)"https://github.com/s9y/Serendipity/releases/download/$version/serendipity-$version.zip";
|
||||||
$downloadLink = substr($updatePage, strpos($updatePage, $url), 200);
|
#$updatePage = (string)$this->getPage("http://www.s9y.org/12.html");
|
||||||
|
$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: (.*)\)/", $downloadLink, $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>');
|
||||||
$check = md5_file($update);
|
$check = md5_file($update);
|
||||||
if ($check == $checksum) {
|
if ($check == $checksum) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -668,13 +674,13 @@ EOS;
|
||||||
if ($finish) {
|
if ($finish) {
|
||||||
// We have to reduce this call() = all tpl files, to clear the blogs template only, to not have the following automated recompile, force the servers memory
|
// We have to reduce this call() = all tpl files, to clear the blogs template only, to not have the following automated recompile, force the servers memory
|
||||||
// to get exhausted, when using serendipity_event_gravatar plugin, which can eat up some MB...
|
// to get exhausted, when using serendipity_event_gravatar plugin, which can eat up some MB...
|
||||||
if(method_exists($serendipity['smarty'], 'clearCompiledTemplate')) { // SMARTY 3
|
if (method_exists($serendipity['smarty'], 'clearCompiledTemplate')) { // SMARTY 3
|
||||||
if($serendipity['smarty']->clearCompiledTemplate(null, $serendipity['template'])) {
|
if ($serendipity['smarty']->clearCompiledTemplate(null, $serendipity['template'])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(method_exists($serendipity['smarty'], 'clear_compiled_tpl')) { // SMARTY 2
|
if (method_exists($serendipity['smarty'], 'clear_compiled_tpl')) { // SMARTY 2
|
||||||
if($serendipity['smarty']->clear_compiled_tpl(null, $serendipity['template'])) {
|
if ($serendipity['smarty']->clear_compiled_tpl(null, $serendipity['template'])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue