private function _print_patches_list() { $counter = 0; $counterpatched = 0; $patches = PatchUtil::list_patches(false); print '<table id="patches">'; foreach ($patches as $patch) { if ($patch->was_applied()) { $this->print_row_old_patch($patch); $counterpatched++; } else { $this->print_row_new_patch($patch); $counter++; } } print '<tr><td> </td></tr>'; if ($counter) { print '<tr><td><div class="left"> </div><div class="center strong">New patches found: </div><div class="right red strong">' . $counter . '</div></td></tr>'; } if ($counterpatched) { print '<tr><td><div class="left"> </div><div class="center strong">Patches already installed: </div><div class="right green">' . $counterpatched . '</div></td></tr>'; } if ($counter == 0) { print '<tr><td><div class="content infotext">No new patches were found. Press NEXT to rebuild common cache and theme files. This operation can take a minute...</div></td></tr>'; $this->set_next_step(2); } else { print '<tr><td><div class="content infotext">New patches were found. Press NEXT to apply them. This operation can take a minute...</div></td></tr>'; $this->set_next_step(1); } print '</table>'; }
<?php defined("_VALID_ACCESS") || die('Direct access forbidden'); $patches_db = new PatchesDB(); $patches = PatchUtil::list_patches(false); foreach ($patches as $patch) { $needle = 'patches/'; $filename = $patch->get_file(); $backslash_pos = strpos($filename, $needle); if ($backslash_pos !== false) { $filename[$backslash_pos + strlen($needle) - 1] = '\\'; $id = md5($filename); if ($patches_db->was_applied($id) && !$patch->was_applied()) { $patch->mark_applied(); } } }