public function flushUpdatedFiles() { asort($this->updated_files); $html = "<p>{$this->lang->line('progress_modified_files')}</p><div id=\"updatedFiles\" style=\"width:70%;display: none;\">"; if (!empty($this->updated_files['failed'])) { $html .= sprintf($this->lang->line('text_files_failed'), count($this->updated_files['failed'])) . '<br />'; $html .= '<textarea class="form-control" readonly>' . implode(PHP_EOL, $this->updated_files['failed']) . '</textarea><br />'; } if (!empty($this->updated_files['added'])) { $html .= sprintf($this->lang->line('text_files_added'), count($this->updated_files['added'])) . '<br />'; $html .= '<textarea class="form-control" readonly>' . implode(PHP_EOL, $this->updated_files['added']) . '</textarea><br>'; } if (!empty($this->updated_files['modified'])) { $html .= sprintf($this->lang->line('text_files_modified'), count($this->updated_files['modified'])) . '<br />'; $html .= '<textarea class="form-control" readonly>' . implode(PHP_EOL, $this->updated_files['modified']) . '</textarea><br>'; } if (!empty($this->updated_files['unchanged'])) { $html .= sprintf($this->lang->line('text_files_unchanged'), count($this->updated_files['unchanged'])) . '<br />'; $html .= '<textarea class="form-control" readonly>' . implode(PHP_EOL, $this->updated_files['unchanged']) . '</textarea><br>'; } $html .= '</div><script type="text/javascript">jQuery(\'#toggleUpdatedFiles\').on(\'click\', function () { jQuery(\'#updatedFiles\').slideToggle(); });</script>'; $html .= '<p>' . sprintf($this->lang->line('progress_update_success'), 'TastyIgniter') . '</p>'; flush_output($html, FALSE); }
public function upgrade() { $this->output->enable_profiler(FALSE); if (!extension_loaded('zip')) { $this->alert->set('warning', $this->lang->line('alert_zip_warning')); redirect('updates'); } if (!$this->uri->rsegment(3)) { $this->alert->set('warning', $this->lang->line('alert_bad_request')); redirect('updates'); } else { if (!$this->user->hasPermission('Site.Updates.Add')) { $this->alert->set('warning', $this->lang->line('alert_permission_warning')); redirect('updates'); } } $update_type = $this->uri->rsegment(3); $this->setHTMLHead(); set_time_limit(300); // 5 minutes if (function_exists('apache_setenv')) { @apache_setenv('no-gzip', 1); } @ini_set('zlib.output_compression', 0); @ini_set('implicit_flush', 1); ob_implicit_flush(TRUE); ignore_user_abort(TRUE); if (ob_get_level() == 0) { ob_start(); } flush_output($this->load->view($this->config->item('admin', 'default_themes') . 'updates_upgrade', '', TRUE), FALSE); if ($update_type === 'core') { // Enable maintenance mode, will be disabled after update flush_output($this->lang->line('progress_enable_maintenance') . "<br />"); $maintenance_mode = $this->config->item('maintenance_mode'); $this->config->set_item('maintenance_mode', 0); $this->Updates_model->update($update_type); // Restore maintenance mode flush_output($this->lang->line('progress_disable_maintenance')); $this->config->set_item('maintenance_mode', $maintenance_mode); flush_output(sprintf($this->lang->line('text_complete_installation'), base_url())); } else { if ($updates = $this->input->get('updates')) { foreach ($updates as $update) { $update = explode('|', $update); if (count($update) === 2) { $this->Updates_model->update($update_type, $update[0], $update[1]); } } } } flush_output('<script type="text/javascript"> parent.jQuery(\'#updateProgress\').attr(\'class\', \'fa fa-check\') .attr(\'title\', \'Complete\'); </script>', FALSE); flush_output('</body></html>', FALSE); ob_end_flush(); }