autoupdate - fix and fake unsupported unicode-icons for chrome

This commit is contained in:
Ian 2014-02-26 18:39:03 +01:00
parent 996cfda0b0
commit 037497cfa4
3 changed files with 33 additions and 29 deletions

View file

@ -1,5 +1,9 @@
1.1
* Translated and faked message unicode-icons to Chrome Browser, since this
does not work with all native unicodes (like clock and triangled <!>).
1.0
* Trying to enable flush on FastCGI servers
* Enable flush to work on FastCGI servers
0.9
* Check if ZIP extension is installed and loaded

View file

@ -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.0');
$propbag->add('version', '1.1');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'php' => '5.1'
@ -177,8 +177,8 @@ class serendipity_event_autoupdate extends serendipity_event {
<article>
EOS;
$this->show_message('<p class="msg_notice"><span class="icon-attention-circle"></span>Download, verify, check, unzip, copy, remove temporary stuff for Serendipity Update: ' . $_REQUEST['serendipity']['newVersion'] . ' may take a little while...<br>Please don\'t get nervous and do not close this page while in progress!</p><hr>');
$this->show_message('<p class="msg_notice" style="font-size: small;color: #999;"><span class="icon-attention-circle"></span>Please note: If this page ever stops with an error message during procession, you can normally just RELOAD your browser [by keyboard shortcut] to get another run. This does not do any harm to a continued upgrade.</p>');
$this->show_message('<p class="msg_notice"><span class="icon-attention"></span>Download, verify, check, unzip, copy, remove temporary stuff for Serendipity Update: ' . $_REQUEST['serendipity']['newVersion'] . ' may take a little while...<br>Please don\'t get nervous and do not close this page while in progress!</p><hr>');
$this->show_message('<p class="msg_notice" style="font-size: small;color: #999;"><span class="icon-attention"></span>Please note: If this page ever stops with an error message during procession, you can normally just RELOAD your browser [by keyboard shortcut] to get another run. This does not do any harm to a continued upgrade.</p>');
$this->show_message('<p class="msg_notice"><span class="icon-attention"></span>PHP max execution time set to 210 seconds</p>');
$start = microtime(true);
if(false === ($update = $this->fetchUpdate($nv))) {
@ -194,49 +194,49 @@ EOS;
usleep(1);
$time = microtime(true) - $start;
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn verifyUpdate()...\n", $time); // print in readable format 1.2345
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function verify update', 'checking write permissions');
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function verify update', 'checking write permissions');
$start = microtime(true);
if ($this->checkWritePermissions($update)) {
usleep(1);
$time = microtime(true) - $start;
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn checkWritePermissions()...\n", $time); // print in readable format 1.2345
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function check write permissions', 'unpacking the update');
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function check write permissions', 'unpacking the update');
$start = microtime(true);
$unpacked = $this->unpackUpdate($nv);
usleep(1);
$time = microtime(true) - $start;
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn unpackUpdate()...\n", $time); // print in readable format 1.2345
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function unpack update', 'checking integrity');
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function unpack update', 'checking integrity');
if ($unpacked) {
$start = microtime(true);
if ($this->checkIntegrity($nv)) {
usleep(1);
$time = microtime(true) - $start;
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn checkIntegrity()...\n", $time); // print in readable format 1.2345
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function check integrity', 'finally copy update');
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function check integrity', 'finally copy update');
$start = microtime(true);
$copied = $this->copyUpdate($nv);
usleep(1);
$time = microtime(true) - $start;
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn copyUpdate()...\n", $time); // print in readable format 1.2345
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function copy update', 'cleaning up temporary directory');
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function copy update', 'cleaning up temporary directory');
if ($copied) {
$start = microtime(true);
if (true === $this->cleanTemplatesC($nv, true) ) {
$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></span>Cleanup download temp done!</p>');
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Cleanup download temp done!</p>');
}
usleep(1);
$time = microtime(true) - $start;
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn cleanTemplatesC()...\n", $time); // print in readable format 1.2345
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function cleanup templates_c', 'finish processing unit');
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function cleanup templates_c', 'finish processing unit');
sleep(2);
echo '<script language="javascript">var el = document.getElementById("loader"); el.style.display = "none";</script>';
sleep(2);
$this->show_message('<p class="msg_notice"><span class="icon-attention-circle"></span><a href="'.$serendipity['serendipityHTTPPath'].'">click to start Serendipity Installer here</a>!</p>');
$this->show_message('<p class="msg_notice"><span class="icon-attention"></span><a href="'.$serendipity['serendipityHTTPPath'].'">click to start Serendipity Installer here</a>!</p>');
sleep(1);
$this->doUpdate();//$logmsg
} else {
$this->show_message('<p class="msg_error"><span class="icon-cancel-circle"></span>Copying the files for the update failed</p>');
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Copying the files for the update failed</p>');
}
} else {
$this->showChecksumErrors($nv);
@ -246,11 +246,11 @@ EOS;
</form>';
}
} else {
$this->show_message('<p class="msg_error"><span class="icon-cancel-circle"></span>Unpacking the update failed</p>');
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Unpacking the update failed</p>');
if (true === $this->cleanTemplatesC($nv, false) ) {
$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></span>Cleaning up the failed unpack directory!</p>');
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Cleaning up the failed unpack directory!</p>');
}
$this->show_message('<p class="msg_notice"><span class="icon-attention-circle"></span>Please reload this page by F5 to have another try upgrading your Blog successfully!</p>');
$this->show_message('<p class="msg_notice"><span class="icon-attention"></span>Please reload this page by F5 to have another try upgrading your Blog successfully!</p>');
}
} else {
@ -301,12 +301,12 @@ EOS;
$success = @curl_exec($ch);
if ( !$success ) {
$this->show_message('<p class="msg_error"><span class="icon-cancel-circle"></span>Downloading update failed</p>');
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Downloading update failed</p>');
return false;
}
}
}
$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></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;
}
@ -328,7 +328,7 @@ EOS;
if ($check == $checksum) {
return true;
} else {
$this->show_message('<p class="msg_error"><span class="icon-cancel-circle"></span>Error. Could not verify the update.</p>');
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Error. Could not verify the update.</p>');
return false;
}
}
@ -382,7 +382,7 @@ EOS;
}
// 2.extraxt all files to temp
$zip->extractTo($updateDir);
$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></span>Extracting the zip in templates_c done</p>');
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Extracting the zip in templates_c done</p>');
$zip->close();
} else {
return false;
@ -427,7 +427,7 @@ EOS;
$success = @copy($updateDir . $file, $target);
}
if ( !$success ) {
$this->show_message('<p class="msg_error"><span class="icon-cancel-circle"></span>Error copying file to '.$target.'</p>');
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Error copying file to '.$target.'</p>');
return false;
}
}
@ -498,7 +498,7 @@ EOS;
}
}
ob_start();
echo '<p class="msg_error"><span class="icon-cancel-circle"></span>Unpacking the update failed, because following files were not writeable:</p>';
echo '<p class="msg_error"><span class="icon-error"></span>Unpacking the update failed, because following files were not writeable:</p>';
echo "<ul>";
foreach ($notWriteable as $file) {
echo "<li>$file</li>";
@ -556,7 +556,7 @@ EOS;
}
}
ob_start();
echo '<p class="msg_error"><span class="icon-cancel-circle"></span>Updating failed, because the integrity-test for the following files failed:</p>';
echo '<p class="msg_error"><span class="icon-error"></span>Updating failed, because the integrity-test for the following files failed:</p>';
echo "<ul>";
foreach ($errors as $file) {
echo "<li>$file</li>";
@ -591,7 +591,7 @@ EOS;
global $serendipity;
$msg = "Autoupdate successfully done!\nWe now refresh to Serendipity Installer!\n";
$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></span>Autoupdate successfully done - refresh to Serendipity Installer</p>', 'Autoupdate');
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Autoupdate successfully done - refresh to Serendipity Installer</p>', 'Autoupdate');
$this->close_page();
// this is working for me.... is it for you?
@ -639,18 +639,18 @@ EOS;
// leave rm zip untouched here as not causing any errors
#unlink($zip);// if(unlink($zip)) { else error note?
#$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></span>Removing the zip file in templates_c done</p>');
#$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Removing the zip file in templates_c done</p>');
// As trying to remove a directory that php is still using, we use open/closedir($handle) to be sure
if( $handle = opendir($zipDir) ) {
$this->empty_dir($zipDir);
$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></span>Removing all files in '.$zipDir.' done</p>');
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Removing all files in '.$zipDir.' done</p>');
closedir($handle);
}
if(rmdir($zipDir)) {
$this->show_message('<p class="msg_success"><span class="icon-ok-circle"></span>Removing the empty directory: '.$zipDir.' done</p>');
$this->show_message('<p class="msg_success"><span class="icon-ok"></span>Removing the empty directory: '.$zipDir.' done</p>');
} else {
$this->show_message('<p class="msg_error"><span class="icon-cancel-circle"></span>Removing the empty directory: '.$zipDir.' failed!</p>');
$this->show_message('<p class="msg_error"><span class="icon-error"></span>Removing the empty directory: '.$zipDir.' failed!</p>');
}
// We clear all compiles smarty template files in templates_c which only leaves the page we are on: /serendipity/templates/default/admin/index.tpl
if ($finish) {

File diff suppressed because one or more lines are too long