Skip to content
Browse files

Make checksum code skippable

  • Loading branch information...
1 parent 63fe29e commit d9a5d6a8c859151894422a8a12ac4494638e2e60 @garvinhicking garvinhicking committed Dec 9, 2008
View
8 bundled-libs/serendipity_generateFTPChecksums.php
@@ -9,10 +9,15 @@
die ("Don't hack!\n");
}
+echo "Creating checksums.\n";
+
$basedir = realpath(dirname(__FILE__) . '/../') . '/';
require_once $basedir . 'include/functions_installer.inc.php';
require_once $basedir . 'include/functions_images.inc.php';
+$conf = file_get_contents($basedir . 'serendipity_config.inc.php');
+preg_match('@\$serendipity\[\'version\'\]\s*=\s*\'(.+)\'@imsU', $conf, $vmatch);
+
// Find all the files in the serendipity directory and calculate their md5 sums
$sums = array();
$excludes = array(
@@ -21,6 +26,7 @@
);
$files = serendipity_traversePath($basedir, '', false);
foreach ($files as $fdata) {
+ echo $fdata['relpath'] . "\n";
// Don't take checksums of directories
if ($fdata['directory']) {
continue;
@@ -48,7 +54,7 @@
if (!$file) {
die('Unable to open output file!');
}
- fwrite($file, '<?php' . "\n" . 'global $serendipity;' . "\n" . '$serendipity[\'checksums\'] = array (' . "\n");
+ fwrite($file, '<?php' . "\n" . 'global $serendipity;' . "\n" . '$serendipity[\'checksums_' . $vmatch[1] . '\'] = array (' . "\n");
foreach ($sums as $fname => $sum) {
fwrite($file, "'$fname' => '$sum',\n");
}
View
0 checksums.inc.php
No changes.
View
2 include/admin/upgrader.inc.php
@@ -276,7 +276,7 @@ function serendipity_upgraderResultDiagnose($result, $s) {
echo serendipity_upgraderResultDiagnose(S9Y_U_SUCCESS, CHECKSUMS_PASS);
} else {
foreach ($badsums as $rfile => $sum) {
- echo serendipity_upgraderResultDiagnose(S9Y_U_ERROR, sprintf(CHECKSUM_FAILED, $rfile));
+ echo serendipity_upgraderResultDiagnose(S9Y_U_WARNING, sprintf(CHECKSUM_FAILED, $rfile)) . "<br />\n";
}
}
?></td>
View
3 include/functions_config.inc.php
@@ -887,6 +887,9 @@ function serendipity_getSessionLanguage() {
return $serendipity['lang'];
}
*/
+ if (isset($serendipity['lang']) && !isset($serendipity['languages'][$serendipity['lang']])) {
+ $serendipity['lang'] = $serendipity['autolang'];
+ }
if (isset($_REQUEST['user_language']) && (!empty($serendipity['languages'][$_REQUEST['user_language']])) && !headers_sent()) {
serendipity_setCookie('serendipityLanguage', $_REQUEST['user_language'], false);
View
20 include/functions_installer.inc.php
@@ -1273,12 +1273,26 @@ function serendipity_FTPChecksum($filename, $type = null) {
* relative path of the file, and values are the bad checksum
*/
function serendipity_verifyFTPChecksums() {
+ global $serendipity;
+
+ $badsums = array();
+
// Load the checksums
- require_once S9Y_INCLUDE_PATH . 'checksums.inc.php';
+ $f = S9Y_INCLUDE_PATH . 'checksums.inc.php';
+
+ if (!file_exists($f) || filesize($f) < 1) {
+ return $badsums;
+ }
+
+ require_once $f;
// Verify that every file in the checksum list was uploaded correctly
- $badsums = array();
$basedir = realpath(dirname(__FILE__) . '/../');
- foreach ($serendipity['checksums'] as $prel => $sum) {
+
+ if (!is_array($serendipity['checksums_' . $serendipity['version']])) {
+ return $badsums;
+ }
+
+ foreach ($serendipity['checksums_' . $serendipity['version']] as $prel => $sum) {
$path = $basedir . '/' . $prel;
// Don't take checksums of directories
if (is_dir($path)) {
View
5 include/lang.inc.php
@@ -6,6 +6,10 @@
die ("Don't hack!");
}
+if (isset($serendipity['lang']) && !isset($serendipity['languages'][$serendipity['lang']])) {
+ $serendipity['lang'] = $serendipity['autolang'];
+}
+
if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) {
$charset = serendipity_getCharset();
@@ -21,6 +25,7 @@
}
// Try and include preferred language from the configurated setting
+
if (@include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) {
// Only here can we truely say the language is loaded
define('serendipity_LANG_LOADED', true);

0 comments on commit d9a5d6a

Please sign in to comment.
Something went wrong with that request. Please try again.