autoupdate button and done msg
this runs too fast now on my server and I don't know why. Is it Serendipity or PHP ... counting seconds for running functions will only work if autoupdate is a little more slow processing. Still needs overview commit 5723673 first, to work with/on 2.0.
This commit is contained in:
parent
9de2acc562
commit
6a7891a734
|
@ -1,3 +1,9 @@
|
||||||
|
1.1.2
|
||||||
|
* some fixes for 2.0
|
||||||
|
|
||||||
|
1.1.1
|
||||||
|
* (html)specialchars for PHP 5.4 charset changes
|
||||||
|
|
||||||
1.1
|
1.1
|
||||||
* Translated and faked message unicode-icons to Chrome Browser, since this
|
* Translated and faked message unicode-icons to Chrome Browser, since this
|
||||||
does not work with all native unicodes (like clock and triangled <!>).
|
does not work with all native unicodes (like clock and triangled <!>).
|
||||||
|
|
|
@ -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.1');
|
$propbag->add('version', '1.1.2');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '0.8',
|
'serendipity' => '0.8',
|
||||||
'php' => '5.1'
|
'php' => '5.1'
|
||||||
|
@ -106,7 +106,7 @@ class serendipity_event_autoupdate extends serendipity_event {
|
||||||
case 'plugin_dashboard_updater':
|
case 'plugin_dashboard_updater':
|
||||||
$eventData = '<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=update" method="POST">
|
$eventData = '<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=update" method="POST">
|
||||||
<input type="hidden" name="serendipity[newVersion]" value="'.$addData.'" />
|
<input type="hidden" name="serendipity[newVersion]" value="'.$addData.'" />
|
||||||
<input type="submit" value="'.PLUGIN_EVENT_AUTOUPDATE_UPDATEBUTTON.'" />
|
' . ($serendipity['version'][0] > 1 ? '<button type="submit">'.PLUGIN_EVENT_AUTOUPDATE_UPDATEBUTTON.'</button>' : '<input type="submit" value="'.PLUGIN_EVENT_AUTOUPDATE_UPDATEBUTTON.'" />') . '
|
||||||
</form>';
|
</form>';
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
@ -184,39 +184,39 @@ EOS;
|
||||||
if(false === ($update = $this->fetchUpdate($nv))) {
|
if(false === ($update = $this->fetchUpdate($nv))) {
|
||||||
$this->close_page(true);
|
$this->close_page(true);
|
||||||
}
|
}
|
||||||
usleep(1);
|
usleep(3);
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn fetchUpdate()...\n", $time); // print in readable format 1.2345
|
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn fetchUpdate()...\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 fetch update', 'verify the update pack');
|
$this->show_message('<p class="msg_run"><span class="icon-clock"></span><em>'.$lmsg.'</em></p>', 'Function fetch update', 'verify the update pack');
|
||||||
if (! empty($update)) {
|
if (! empty($update)) {
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
if ($this->verifyUpdate($update, $nv)) {
|
if ($this->verifyUpdate($update, $nv)) {
|
||||||
usleep(1);
|
usleep(3);
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn verifyUpdate()...\n", $time); // print in readable format 1.2345
|
$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);
|
$start = microtime(true);
|
||||||
if ($this->checkWritePermissions($update)) {
|
if ($this->checkWritePermissions($update)) {
|
||||||
usleep(1);
|
usleep(3);
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn checkWritePermissions()...\n", $time); // print in readable format 1.2345
|
$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);
|
$start = microtime(true);
|
||||||
$unpacked = $this->unpackUpdate($nv);
|
$unpacked = $this->unpackUpdate($nv);
|
||||||
usleep(1);
|
usleep(3);
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn unpackUpdate()...\n", $time); // print in readable format 1.2345
|
$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) {
|
if ($unpacked) {
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
if ($this->checkIntegrity($nv)) {
|
if ($this->checkIntegrity($nv)) {
|
||||||
usleep(1);
|
usleep(3);
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn checkIntegrity()...\n", $time); // print in readable format 1.2345
|
$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);
|
$start = microtime(true);
|
||||||
$copied = $this->copyUpdate($nv);
|
$copied = $this->copyUpdate($nv);
|
||||||
usleep(1);
|
usleep(3);
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn copyUpdate()...\n", $time); // print in readable format 1.2345
|
$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');
|
||||||
|
@ -225,7 +225,7 @@ EOS;
|
||||||
if (true === $this->cleanTemplatesC($nv, true) ) {
|
if (true === $this->cleanTemplatesC($nv, true) ) {
|
||||||
$this->show_message('<p class="msg_success"><span class="icon-ok"></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);
|
usleep(3);
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
$logmsg .= $lmsg = sprintf("In %0.4d seconds run fcn cleanTemplatesC()...\n", $time); // print in readable format 1.2345
|
$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');
|
||||||
|
@ -576,9 +576,13 @@ EOS;
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
EOS;
|
||||||
|
if($terminate) {
|
||||||
|
echo <<<EOS
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
EOS;
|
EOS;
|
||||||
|
}
|
||||||
if($terminate) die();
|
if($terminate) die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,12 +594,12 @@ EOS;
|
||||||
function doUpdate() {
|
function doUpdate() {
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
|
|
||||||
$msg = "Autoupdate successfully done!\nWe now refresh to Serendipity Installer!\n";
|
$msg = "Autoupdate successfully done!\\nWe now refresh to Serendipity Installer!\\n"; // escape for js
|
||||||
$this->show_message('<p class="msg_success"><span class="icon-ok"></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->close_page();
|
||||||
|
|
||||||
// this is working for me.... is it for you?
|
// this is working for me.... is it for you?
|
||||||
if(die("<script type='text/javascript'>alert('".serendipity_db_escape_string($msg)."'); window.location = '".$serendipity['serendipityHTTPPath']."';</script>\n")) {
|
if(die('<script type="text/javascript">alert("'.$msg.'"); window.location = "'.$serendipity['serendipityHTTPPath'].'";</script>'."\n </body>\n</html>")) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if(!headers_sent()) {
|
if(!headers_sent()) {
|
||||||
|
@ -617,7 +621,15 @@ EOS;
|
||||||
* @param string directory
|
* @param string directory
|
||||||
*/
|
*/
|
||||||
function empty_dir($dir) {
|
function empty_dir($dir) {
|
||||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
|
if (!is_dir($dir)) return;
|
||||||
|
try {
|
||||||
|
$_dir = new RecursiveDirectoryIterator($dir);
|
||||||
|
// NOTE: UnexpectedValueException thrown for PHP >= 5.3
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$iterator = new RecursiveIteratorIterator($_dir, RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
|
//$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
foreach ($iterator as $file) {
|
foreach ($iterator as $file) {
|
||||||
if ($file->isFile()) {
|
if ($file->isFile()) {
|
||||||
unlink($file->__toString());
|
unlink($file->__toString());
|
||||||
|
|
Loading…
Reference in a new issue