static function mass_update_db($number_to_update, $from_version) { if (!is_numeric($number_to_update) or !is_numeric($from_version)) { // All of these must be numbers so return false if any of them arent return false; } $all_db_versions = Mhi_Site_Model::get_db_versions($number_to_update); $i = 0; foreach ($all_db_versions as $db => $current_version) { if ($i == $number_to_update) { break; } if ($current_version == $from_version) { Mhi_Site_Database_Model::update_db($db); $i++; } } }
/** * Lists the reports. * @param int $page */ function updatelist() { $this->template->content = new View('admin/mhi_updatelist'); $settings = kohana::config('settings'); if (isset($_POST['mhiupdatedb'])) { Mhi_Site_Database_Model::update_db($_POST['db']); } if (isset($_GET['mhimassupdatedb']) and isset($_GET['from_version'])) { Mhi_Site_Database_Model::mass_update_db($_GET['mhimassupdatedb'], $_GET['from_version']); } $this->template->content->db_versions = Mhi_Site_Model::get_db_versions(100); asort($this->template->content->db_versions); $this->template->content->current_version = $settings['db_version']; }