Improve handling of failed integrity checks (#104)
* [event_autoupdate] Add option to disable file integrity checks for one run of the auto updater. Signed-off-by: Matthias Gutjahr <mattsches@gmail.com> * [event_autoupdate] Add button to retry auto update without integrity checks after failure Signed-off-by: Matthias Gutjahr <mattsches@gmail.com> * [event_autoupdate] Remove wrong return statement Signed-off-by: Matthias Gutjahr <mattsches@gmail.com> * [event_autoupdate] Repeat file integrity check for text files that were treated as binary files in S9y versions < 2.3 Signed-off-by: Matthias Gutjahr <mattsches@gmail.com> * Automagic XML sync * [event_autoupdate] Show error message and list of files with wrong checksum Signed-off-by: Matthias Gutjahr <mattsches@gmail.com>
This commit is contained in:
parent
9cbcfc51ca
commit
907b27c94a
|
@ -1,3 +1,6 @@
|
|||
1.1.10: Repeat file integrity check for text files that were treated as binary
|
||||
files in S9y versions < 2.3
|
||||
|
||||
1.1.9: Add config setting 'disable_integrity_checks' to disable file integrity
|
||||
checks for one run (see https://board.s9y.org/viewtopic.php?f=1&t=24492)
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
@define('PLUGIN_EVENT_AUTOUPDATE_NAME', 'Serendipity Autoupdate');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DESC', 'Sobald das Dashboard Plugin (einmal am Tag) ein Serendipity Update entdeckt, setzt dieses Plugin eine Ein-Klick Option in das Dashboard des Backends, um ein manuelles Download oder ein automatisches und gesichertes Upgrade der Blogsoftware zu starten.');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_UPDATEBUTTON', 'Automatisches Upgrade starten');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_ERROR_INTEGRITY_CHECKS', 'Upgrade nicht erfolgreich, weil die Integritätsprüfung für folgende Dateien fehlgeschlagen ist:');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS', 'Deaktiviere Integritätsprüfung (ACHTUNG!)');
|
||||
@define(
|
||||
'PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS_DESC',
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
@define('PLUGIN_EVENT_AUTOUPDATE_NAME', 'Serendipity Autoupdate');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DESC', 'When the dashboard-plugin (once a day) detects an update, this plugin adds the option to manually download or start an automatic and secured upgrade of the blog directly with one click from within the adminarea.');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_UPDATEBUTTON', 'Start automatic upgrade');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_ERROR_INTEGRITY_CHECKS', 'Updating failed, because the integrity-test for the following files failed:');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS', 'Disable integrity checks (CAUTION!)');
|
||||
@define(
|
||||
'PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS_DESC',
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
@define('PLUGIN_EVENT_AUTOUPDATE_NAME', 'Serendipity Autoupdate');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DESC', 'Sobald das Dashboard Plugin (einmal am Tag) ein Serendipity Update entdeckt, setzt dieses Plugin eine Ein-Klick Option in das Dashboard des Backends, um ein manuelles Download oder ein automatisches und gesichertes Upgrade der Blogsoftware zu starten.');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_UPDATEBUTTON', 'Automatisches Upgrade starten');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_ERROR_INTEGRITY_CHECKS', 'Upgrade nicht erfolgreich, weil die Integritätsprüfung für folgende Dateien fehlgeschlagen ist:');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS', 'Deaktiviere Integritätsprüfung (ACHTUNG!)');
|
||||
@define(
|
||||
'PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS_DESC',
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
@define('PLUGIN_EVENT_AUTOUPDATE_NAME', 'Serendipity Autoupdate');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DESC', 'When the dashboard-plugin (once a day) detects an update, this plugin adds the option to manually download or start an automatic and secured upgrade of the blog directly with one click from within the adminarea.');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_UPDATEBUTTON', 'Start automatic upgrade');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS', 'Disable integrity casdf hecks (CAUTION!)');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_ERROR_INTEGRITY_CHECKS', 'Updating failed, because the integrity-test for the following files failed:');
|
||||
@define('PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS', 'Disable integrity checks (CAUTION!)');
|
||||
@define(
|
||||
'PLUGIN_EVENT_AUTOUPDATE_DISABLE_INTEGRITY_CHECKS_DESC',
|
||||
'This setting disables the file integrity checks for one run of the auto updater. It will be automatically reset to `No` after the update.'
|
||||
|
|
|
@ -22,7 +22,7 @@ class serendipity_event_autoupdate extends serendipity_event {
|
|||
$propbag->add('description', PLUGIN_EVENT_AUTOUPDATE_DESC);
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('author', 'onli, Ian');
|
||||
$propbag->add('version', '1.1.9');
|
||||
$propbag->add('version', '1.1.10');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '0.8',
|
||||
'php' => '5.2'
|
||||
|
@ -580,56 +580,54 @@ EOS;
|
|||
function checkIntegrity($version) {
|
||||
global $serendipity;
|
||||
|
||||
$updateDir = (string)$serendipity['serendipityPath'] . 'templates_c/' . "serendipity-$version/";
|
||||
$checksumFile = (string)$updateDir . "serendipity/checksums.inc.php";
|
||||
|
||||
if (strpos($version, 'beta') !== FALSE) {
|
||||
if (strpos($version, 'beta') !== false) {
|
||||
return true;
|
||||
}
|
||||
$updateDir = $serendipity['serendipityPath'] . 'templates_c/' . "serendipity-$version/";
|
||||
$checksumFile = $updateDir .'serendipity/checksums.inc.php';
|
||||
include_once $checksumFile;
|
||||
|
||||
$checksums = $serendipity['checksums_' . $version];
|
||||
|
||||
foreach ($checksums as $file => $checksum) {
|
||||
$check = serendipity_FTPChecksum($updateDir . "serendipity/" . $file);
|
||||
if ($checksum != $check) {
|
||||
$path = $updateDir.'serendipity/'.$file;
|
||||
if ($checksum !== serendipity_FTPChecksum($path) && $checksum !== serendipity_FTPChecksum($path, 'text')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks updates checksum file array with updates realfiles
|
||||
* shows error message and list of files with wrong checksum
|
||||
* @param string version
|
||||
* @return error
|
||||
* @return void
|
||||
*/
|
||||
function showChecksumErrors($version) {
|
||||
global $serendipity;
|
||||
|
||||
$updateDir = (string)$serendipity['serendipityPath'] . 'templates_c/' . "serendipity-$version/";
|
||||
$checksumFile = (string)$updateDir . "serendipity/checksums.inc.php";
|
||||
|
||||
$updateDir = $serendipity['serendipityPath'] . 'templates_c/' . "serendipity-$version/";
|
||||
$checksumFile = $updateDir .'serendipity/checksums.inc.php';
|
||||
include_once $checksumFile;
|
||||
|
||||
$checksums = $serendipity['checksums_' . $version];
|
||||
$errors = array();
|
||||
|
||||
foreach ($checksums as $file => $checksum) {
|
||||
$check = serendipity_FTPChecksum($updateDir . "serendipity/" . $file);
|
||||
if ($checksum != $check) {
|
||||
$errors[] = $updateDir . "serendipity/" . $file;
|
||||
$path = $updateDir.'serendipity/'.$file;
|
||||
if ($checksum !== serendipity_FTPChecksum($path) && $checksum !== serendipity_FTPChecksum($path, 'text')) {
|
||||
$errors[] = $path;
|
||||
}
|
||||
}
|
||||
ob_start();
|
||||
echo '<p class="msg_error"><span class="icon-error" aria-hidden="true"></span>Updating failed, because the integrity-test for the following files failed:</p>';
|
||||
echo "<ul>";
|
||||
echo '<p class="msg_error"><span class="icon-error" aria-hidden="true"></span>'.PLUGIN_EVENT_AUTOUPDATE_ERROR_INTEGRITY_CHECKS.'</p>';
|
||||
echo '<ul>';
|
||||
foreach ($errors as $file) {
|
||||
echo "<li>$file</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
$integrity_error = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo '</ul>';
|
||||
$integrity_error = ob_get_clean();
|
||||
$this->show_message($integrity_error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue